diff --git a/code/HTMLWriter.cpp b/code/HTMLWriter.cpp index 434ff27..0ff824f 100644 --- a/code/HTMLWriter.cpp +++ b/code/HTMLWriter.cpp @@ -1,6 +1,6 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/HTMLWriter.h b/code/HTMLWriter.h index 89ae1c5..c8c1c9b 100644 --- a/code/HTMLWriter.h +++ b/code/HTMLWriter.h @@ -1,6 +1,6 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/MeOSFeatures.cpp b/code/MeOSFeatures.cpp index 718efc9..0195120 100644 --- a/code/MeOSFeatures.cpp +++ b/code/MeOSFeatures.cpp @@ -1,6 +1,6 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/MeOSFeatures.h b/code/MeOSFeatures.h index ac31161..baeb596 100644 --- a/code/MeOSFeatures.h +++ b/code/MeOSFeatures.h @@ -1,7 +1,7 @@ #pragma once /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/MeosSQL.cpp b/code/MeosSQL.cpp index c1b6819..de7939d 100644 --- a/code/MeosSQL.cpp +++ b/code/MeosSQL.cpp @@ -1,6 +1,6 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 @@ -1023,7 +1023,7 @@ bool MeosSQL::storeData(oDataInterface odi, const RowWrapper &row, unsigned long list::iterator it_int; for(it_int=varint.begin(); it_int!=varint.end(); it_int++) { if (it_int->data32) { - int val = int(row[it_int->name]); + int val = int(row[(const char *)it_int->name]); if (val != *(it_int->data32)) { *(it_int->data32) = val; @@ -1031,7 +1031,7 @@ bool MeosSQL::storeData(oDataInterface odi, const RowWrapper &row, unsigned long } } else { - __int64 val = row[it_int->name].ulonglong(); + __int64 val = row[(const char*)it_int->name].ulonglong(); __int64 oldVal = *(it_int->data64); if (val != oldVal) { memcpy(it_int->data64, &val, 8); @@ -1049,7 +1049,7 @@ bool MeosSQL::storeData(oDataInterface odi, const RowWrapper &row, unsigned long odi.getVariableString(varstring); list::iterator it_string; for(it_string=varstring.begin(); it_string!=varstring.end(); it_string++) { - wstring w(fromUTF(row[it_string->name].c_str())); + wstring w(fromUTF(row[(const char*)it_string->name].c_str())); if (it_string->store(w.c_str())) updated = true; } @@ -1822,12 +1822,12 @@ OpFailStatus MeosSQL::storeRunner(const RowWrapper &row, oRunner &r, if (rid>0) { pRunner pr = oe->getRunner(rid, 0); if (pr==0) { - oRunner or(oe, rid); - or.setImplicitlyCreated(); + oRunner oR(oe, rid); + oR.setImplicitlyCreated(); if (allowSubRead) - success = min(success, syncRead(true, &or, false, readCourseCard)); - if (!or.isRemoved()) { - pr = oe->addRunner(or , false); + success = min(success, syncRead(true, &oR, false, readCourseCard)); + if (!oR.isRemoved()) { + pr = oe->addRunner(oR , false); addedFromDatabase(pr); } else { @@ -1931,18 +1931,18 @@ OpFailStatus MeosSQL::storeTeam(const RowWrapper &row, oTeam &t, if (rns[k]>0) { pRns[k] = oe->getRunner(rns[k], 0); if (!pRns[k]) { - oRunner or(oe, rns[k]); - or.setImplicitlyCreated(); + oRunner oR(oe, rns[k]); + oR.setImplicitlyCreated(); if (allowSubRead) - success = min(success, syncRead(true, &or, readRecursive, readRecursive)); + success = min(success, syncRead(true, &oR, readRecursive, readRecursive)); - if (or.sName.empty()) { - or.sName = L"@AutoCorrection"; - or.getRealName(or.sName, or.tRealName); + if (oR.sName.empty()) { + oR.sName = L"@AutoCorrection"; + oR.getRealName(oR.sName, oR.tRealName); } - if (!or.isRemoved()) { - pRns[k] = oe->addRunner(or , false); + if (!oR.isRemoved()) { + pRns[k] = oe->addRunner(oR , false); addedFromDatabase(pRns[k]); assert(pRns[k] && !pRns[k]->changed); } @@ -3262,10 +3262,10 @@ bool MeosSQL::syncListRunner(oEvent *oe) st = opStatusOK; } else { - oRunner or(oe, Id); - or.setImplicitlyCreated(); - st = syncRead(true, &or, false, false); - r = oe->addRunner(or, false); + oRunner oR(oe, Id); + oR.setImplicitlyCreated(); + st = syncRead(true, &oR, false, false); + r = oe->addRunner(oR, false); } } updateCounters(st, counter, modified, oe->sqlRunners, maxCounterRunner); @@ -4259,9 +4259,9 @@ bool MeosSQL::checkConsistency(oEvent *oe, bool force) { checkAgainstDB("oControl", bmap, needUpdate); for (auto id : needUpdate) { if (!id.second) { - oControl or(oe, id.first); - or.setImplicitlyCreated(); - auto c = oe->addControl(or); + oControl oR(oe, id.first); + oR.setImplicitlyCreated(); + auto c = oe->addControl(oR); if (c != nullptr) syncRead(true, c); } @@ -4275,9 +4275,9 @@ bool MeosSQL::checkConsistency(oEvent *oe, bool force) { checkAgainstDB("oCourse", bmap, needUpdate); for (auto id : needUpdate) { if (!id.second) { - oCourse or(oe, id.first); - or.setImplicitlyCreated(); - auto c = oe->addCourse(or); + oCourse oR(oe, id.first); + oR.setImplicitlyCreated(); + auto c = oe->addCourse(oR); if (c != nullptr) syncRead(true, c); } @@ -4291,9 +4291,9 @@ bool MeosSQL::checkConsistency(oEvent *oe, bool force) { checkAgainstDB("oClass", bmap, needUpdate); for (auto id : needUpdate) { if (!id.second) { - oClass or(oe, id.first); - or .setImplicitlyCreated(); - auto c = oe->addClass(or); + oClass oR(oe, id.first); + oR.setImplicitlyCreated(); + auto c = oe->addClass(oR); if (c != nullptr) syncRead(true, c); } @@ -4307,9 +4307,9 @@ bool MeosSQL::checkConsistency(oEvent *oe, bool force) { checkAgainstDB("oClub", bmap, needUpdate); for (auto id : needUpdate) { if (!id.second) { - oClub or(oe, id.first); - or.setImplicitlyCreated(); - auto c = oe->addClub(or); + oClub oR(oe, id.first); + oR.setImplicitlyCreated(); + auto c = oe->addClub(oR); if (c != nullptr) syncRead(true, c); } @@ -4323,9 +4323,9 @@ bool MeosSQL::checkConsistency(oEvent *oe, bool force) { checkAgainstDB("oCard", bmap, needUpdate); for (auto id : needUpdate) { if (!id.second) { - oCard or (oe, id.first); - or .setImplicitlyCreated(); - auto c = oe->addCard(or ); + oCard oR(oe, id.first); + oR.setImplicitlyCreated(); + auto c = oe->addCard(oR); if (c != nullptr) syncRead(true, c); } @@ -4339,10 +4339,10 @@ bool MeosSQL::checkConsistency(oEvent *oe, bool force) { checkAgainstDB("oRunner", bmap, needUpdate); for (auto id : needUpdate) { if (!id.second) { - oRunner or (oe, id.first); - or .setImplicitlyCreated(); - syncRead(true, &or ); - oe->addRunner(or , false); + oRunner oR(oe, id.first); + oR.setImplicitlyCreated(); + syncRead(true, &oR); + oe->addRunner(oR, false); } else { id.second->counter = 0; diff --git a/code/MeosSQL.h b/code/MeosSQL.h index 328d5e3..55b6290 100644 --- a/code/MeosSQL.h +++ b/code/MeosSQL.h @@ -1,7 +1,7 @@ #pragma once /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 @@ -89,7 +89,7 @@ protected: bool storeData(oDataInterface odi, const RowWrapper &row, unsigned long &revision); void importLists(oEvent *oe, const char *bf); - void encodeLists(const oEvent *or, string &listEnc) const; + void encodeLists(const oEvent *oe, string &listEnc) const; //Set DB to default competition DB void setDefaultDB(); diff --git a/code/Printer.h b/code/Printer.h index 12b44b4..db7b7fb 100644 --- a/code/Printer.h +++ b/code/Printer.h @@ -4,7 +4,7 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 @@ -95,19 +95,19 @@ struct PrinterObject { bool onlyChanged; struct DATASET { - int pWidth_mm; - int pHeight_mm; - double pMgBottom; - double pMgTop; - double pMgRight; - double pMgLeft; + int pWidth_mm = 0; + int pHeight_mm = 0; + double pMgBottom = 0.0; + double pMgTop = 0.0; + double pMgRight = 0.0; + double pMgLeft = 0.0; - int MarginX; - int MarginY; - int PageX; - int PageY; - double Scale; - bool LastPage; + int MarginX = 0; + int MarginY = 0; + int PageX = 0; + int PageY = 0; + double Scale = 0.0; + bool LastPage = false; } ds; void operator=(const PrinterObject &po); diff --git a/code/RestService.cpp b/code/RestService.cpp index 4ec1fba..73c3358 100644 --- a/code/RestService.cpp +++ b/code/RestService.cpp @@ -1,6 +1,6 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/RestService.h b/code/RestService.h index 8380ab4..eebbe3b 100644 --- a/code/RestService.h +++ b/code/RestService.h @@ -1,6 +1,6 @@ /************************************************************************ MeOS - Orienteering Software -Copyright (C) 2009-2021 Melin Software HB +Copyright (C) 2009-2022 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 diff --git a/code/RunnerDB.cpp b/code/RunnerDB.cpp index d023d20..9de2948 100644 --- a/code/RunnerDB.cpp +++ b/code/RunnerDB.cpp @@ -1,6 +1,6 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 @@ -872,7 +872,6 @@ void RunnerDB::loadClubs(const wstring &file) else if (pc != pc2) problems.push_back(pc->getName() + L"-" + pc2->getName()); } - problems.begin(); } } @@ -1330,11 +1329,24 @@ void RunnerDB::refreshRunnerTableData(Table &table) { int runnerId; bool found = false; + pRunner r = nullptr; if (rdb[k].extId != 0) found = runnerInEvent.lookup(rdb[k].extId, runnerId); + else if (rdb[k].cardNo != 0) { + found = runnerInEvent.lookup(rdb[k].cardNo + cardIdConstant, runnerId); + if (found) { + r = oe->getRunner(runnerId, 0); + const RunnerWDBEntry &rw = rwdb[k]; + rw.initName(); + if (!r || !r->matchName(rw.name)) { + found = false; + } + } + } if (found) { - pRunner r = oe->getRunner(runnerId, 0); + if (r == nullptr) + r = oe->getRunner(runnerId, 0); row->updateCell(cellEntryIndex, cellEdit, r ? r->getClass(true) : L""); } else if (!found && row->getCellType(cellEntryIndex) == cellEdit) { @@ -1414,8 +1426,18 @@ void oDBRunnerEntry::addTableRow(Table &table) const { int runnerId; bool found = false; + pRunner cr = nullptr; if (rn.extId != 0) found = db->runnerInEvent.lookup(rn.extId, runnerId); + else if (rn.cardNo != 0) { + found = db->runnerInEvent.lookup(rn.cardNo + cardIdConstant, runnerId); + if (found) { + cr = oe->getRunner(runnerId, 0); + if (!cr || !cr->matchName(r.name)) { + found = false; + } + } + } if (canEdit) table.setTableProp(Table::CAN_DELETE|Table::CAN_INSERT|Table::CAN_PASTE); @@ -1426,8 +1448,9 @@ void oDBRunnerEntry::addTableRow(Table &table) const { if (!found) table.set(row++, it, TID_ENTER, L"@+", false, cellAction); else { - pRunner r = oe->getRunner(runnerId, 0); - table.set(row++, it, TID_ENTER, r ? r->getClass(true) : L"", false, cellEdit); + if (cr == nullptr) + cr = oe->getRunner(runnerId, 0); + table.set(row++, it, TID_ENTER, cr ? cr->getClass(true) : L"", false, cellEdit); } } diff --git a/code/RunnerDB.h b/code/RunnerDB.h index 91ab598..c75b5a9 100644 --- a/code/RunnerDB.h +++ b/code/RunnerDB.h @@ -11,7 +11,7 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 @@ -33,7 +33,7 @@ const int baseNameLength = 64; const int baseNameLengthUTF = 96; - +constexpr int64_t cardIdConstant = 100000000000L; //Has 0-clearing constructor. Must not contain any //dynamic data etc. struct RunnerDBEntryV1 { @@ -139,7 +139,7 @@ public: void setNameUTF(const char *name); - const wchar_t *RunnerWDBEntry::getNameCstr() const; + const wchar_t *getNameCstr() const; wstring getGivenName() const; wstring getFamilyName() const; diff --git a/code/SportIdent.cpp b/code/SportIdent.cpp index af14257..990fa9a 100644 --- a/code/SportIdent.cpp +++ b/code/SportIdent.cpp @@ -1,6 +1,6 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 @@ -1921,97 +1921,49 @@ void SIPunch::analyseHour12Time(DWORD zeroTime) { } } -void SportIdent::EnumrateSerialPorts(list &ports) +void SportIdent::EnumrateSerialPorts(list& ports) { //Make sure we clear out any elements which may already be in the array ports.clear(); - //Determine what OS we are running on - OSVERSIONINFO osvi; - osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); - BOOL bGetVer = GetVersionEx(&osvi); - - //On NT use the QueryDosDevice API - if (bGetVer && (osvi.dwPlatformId == VER_PLATFORM_WIN32_NT)) - { //Use QueryDosDevice to look for all devices of the form COMx. This is a better //solution as it means that no ports have to be opened at all. - TCHAR szDevices[65535]; - DWORD dwChars = QueryDosDevice(NULL, szDevices, 65535); - if (dwChars) + TCHAR szDevices[65535]; + DWORD dwChars = QueryDosDevice(NULL, szDevices, 65535); + if (dwChars) + { + int i = 0; + + for (;;) { - int i=0; + //Get the current device name + TCHAR* pszCurrentDevice = &szDevices[i]; - for (;;) + //If it looks like "COMX" then + //add it to the array which will be returned + int nLen = _tcslen(pszCurrentDevice); + if (nLen > 3 && _tcsnicmp(pszCurrentDevice, _T("COM"), 3) == 0) { - //Get the current device name - TCHAR* pszCurrentDevice = &szDevices[i]; + //Work out the port number + int nPort = _ttoi(&pszCurrentDevice[3]); + ports.push_front(nPort); + } - //If it looks like "COMX" then - //add it to the array which will be returned - int nLen = _tcslen(pszCurrentDevice); - if (nLen > 3 && _tcsnicmp(pszCurrentDevice, _T("COM"), 3) == 0) - { - //Work out the port number - int nPort = _ttoi(&pszCurrentDevice[3]); - ports.push_front(nPort); - } - - // Go to next NULL character - while(szDevices[i] != _T('\0')) - i++; - - // Bump pointer to the next string + // Go to next NULL character + while (szDevices[i] != _T('\0')) i++; - // The list is double-NULL terminated, so if the character is - // now NULL, we're at the end - if (szDevices[i] == _T('\0')) - break; - } - } - //else - // TRACE(_T("Failed in call to QueryDosDevice, GetLastError:%d\n"), GetLastError()); - } - else - { - //On 95/98 open up each port to determine their existence + // Bump pointer to the next string + i++; - //Up to 255 COM ports are supported so we iterate through all of them seeing - //if we can open them or if we fail to open them, get an access denied or general error error. - //Both of these cases indicate that there is a COM port at that number. - for (UINT i=1; i<256; i++) - { - //Form the Raw device name - wchar_t sPort[256]; - - swprintf_s(sPort, 256, L"\\\\.\\COM%d", i); - - //Try to open the port - BOOL bSuccess = FALSE; - HANDLE hPort = ::CreateFile(sPort, GENERIC_READ | GENERIC_WRITE, 0, 0, OPEN_EXISTING, 0, 0); - if (hPort == INVALID_HANDLE_VALUE) - { - DWORD dwError = GetLastError(); - - //Check to see if the error was because some other app had the port open or a general failure - if (dwError == ERROR_ACCESS_DENIED || dwError == ERROR_GEN_FAILURE) - bSuccess = TRUE; - } - else - { - //The port was opened successfully - bSuccess = TRUE; - - //Don't forget to close the port, since we are going to do nothing with it anyway - CloseHandle(hPort); - } - - //Add the port number to the array which will be returned - if (bSuccess) - ports.push_front(i); + // The list is double-NULL terminated, so if the character is + // now NULL, we're at the end + if (szDevices[i] == _T('\0')) + break; } } + + } diff --git a/code/SportIdent.h b/code/SportIdent.h index f82386b..3f02d11 100644 --- a/code/SportIdent.h +++ b/code/SportIdent.h @@ -13,7 +13,7 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/TabAuto.cpp b/code/TabAuto.cpp index 55b99e0..8e7c700 100644 --- a/code/TabAuto.cpp +++ b/code/TabAuto.cpp @@ -1,6 +1,6 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 @@ -100,7 +100,10 @@ AutoMachine *TabAuto::getMachine(int id) { } void AutoMachine::save(oEvent &oe, gdioutput &gdi, bool doProcess) { + wstring oldMachineName = getMachineName(); machineName = gdi.getText("MachineName"); + wstring newMachineName = getMachineName(); + oe.getMachineContainer().rename(getTypeString(), oldMachineName, newMachineName); } void AutoMachine::status(gdioutput &gdi) { @@ -665,18 +668,18 @@ bool TabAuto::loadPage(gdioutput &gdi, bool showSettingsLast) return true; } -void AutoMachine::settingsTitle(gdioutput &gdi, char *title) { +void AutoMachine::settingsTitle(gdioutput &gdi, const char *title) { gdi.fillDown(); gdi.dropLine(0.5); gdi.addString("", fontMediumPlus, title).setColor(colorDarkBlue); gdi.dropLine(0.5); } -void AutoMachine::startCancelInterval(gdioutput &gdi, char *startCommand, State state, IntervalType type, const wstring &intervalIn) { +void AutoMachine::startCancelInterval(gdioutput &gdi, const char *startCommand, State state, IntervalType type, const wstring &intervalIn) { gdi.pushX(); gdi.fillRight(); - gdi.addInput("MachineName", machineName, 10, nullptr, L"Namn", L"Om du vill kan du namnge automaten"); + gdi.addInput("MachineName", machineName, 10, nullptr, L"Automatnamn:", L"Om du vill kan du namnge automaten"); if (type == IntervalMinute) gdi.addInput("Interval", intervalIn, 7, 0, L"Tidsintervall (MM:SS):"); @@ -1117,7 +1120,7 @@ void PunchMachine::process(gdioutput &gdi, oEvent *oe, AutoSyncType ast) if (!sic.empty()) { if (!radio) si.addCard(sic); } - else gdi.addInfoBox("", L"Failed to generate card.", interval * 2); + else gdi.addInfoBox("", L"Failed to generate card.", interval * 2000); } else { SICard sic(ConvertedTimeStatus::Hour24); diff --git a/code/TabAuto.h b/code/TabAuto.h index 4f59b66..c83054a 100644 --- a/code/TabAuto.h +++ b/code/TabAuto.h @@ -1,7 +1,7 @@ #pragma once /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 @@ -67,9 +67,9 @@ private: protected: bool editMode; - void settingsTitle(gdioutput &gdi, char *title); + void settingsTitle(gdioutput &gdi, const char *title); enum IntervalType {IntervalNone, IntervalMinute, IntervalSecond}; - void startCancelInterval(gdioutput &gdi, char *startCommand, State state, IntervalType type, const wstring &interval); + void startCancelInterval(gdioutput &gdi, const char *startCommand, State state, IntervalType type, const wstring &interval); virtual bool hasSaveMachine() const { return false; @@ -81,6 +81,8 @@ public: } virtual void loadMachine(oEvent &oe, const wstring &name) { + if (name != L"default") + machineName = name; } // Return true to auto-remove diff --git a/code/TabBase.cpp b/code/TabBase.cpp index de04b7f..ffd674b 100644 --- a/code/TabBase.cpp +++ b/code/TabBase.cpp @@ -1,6 +1,6 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/TabBase.h b/code/TabBase.h index 66a02a2..707c448 100644 --- a/code/TabBase.h +++ b/code/TabBase.h @@ -1,7 +1,7 @@ #pragma once /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/TabClass.cpp b/code/TabClass.cpp index c8cae56..2add24a 100644 --- a/code/TabClass.cpp +++ b/code/TabClass.cpp @@ -1,6 +1,6 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/TabClass.h b/code/TabClass.h index 598528c..4561cdc 100644 --- a/code/TabClass.h +++ b/code/TabClass.h @@ -1,7 +1,7 @@ #pragma once /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 @@ -81,7 +81,7 @@ class TabClass : void drawDialog(gdioutput &gdi, oEvent::DrawMethod method, const oClass &cls); void pursuitDialog(gdioutput &gdi); void addVacantPosition(gdioutput &gdi); - oEvent::VacantPosition TabClass::readVacantPosition(gdioutput &gdi) const; + oEvent::VacantPosition readVacantPosition(gdioutput &gdi) const; bool warnDrawStartTime(gdioutput &gdi, int time, bool absTime); bool warnDrawStartTime(gdioutput &gdi, const wstring &firstStart); diff --git a/code/TabClub.cpp b/code/TabClub.cpp index 10f87fc..9caa2cc 100644 --- a/code/TabClub.cpp +++ b/code/TabClub.cpp @@ -1,6 +1,6 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/TabClub.h b/code/TabClub.h index 8e9a1d7..1d286f9 100644 --- a/code/TabClub.h +++ b/code/TabClub.h @@ -1,7 +1,7 @@ #pragma once /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/TabCompetition.cpp b/code/TabCompetition.cpp index f4290a5..0e723b8 100644 --- a/code/TabCompetition.cpp +++ b/code/TabCompetition.cpp @@ -1,6 +1,6 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 @@ -2382,7 +2382,7 @@ void TabCompetition::copyrightLine(gdioutput &gdi) const gdi.dropLine(0.4); gdi.fillDown(); - gdi.addString("", 0, makeDash(L"#Copyright © 2007-2021 Melin Software HB")); + gdi.addString("", 0, makeDash(L"#Copyright © 2007-2022 Melin Software HB")); gdi.dropLine(1); gdi.popX(); @@ -2412,7 +2412,7 @@ void TabCompetition::loadAboutPage(gdioutput &gdi) const gdi.dropLine(1.5); gdi.setCX(gdi.getCX() + gdi.scaleLength(20)); - gdi.addStringUT(1, makeDash(L"Copyright © 2007-2021 Melin Software HB")); + gdi.addStringUT(1, makeDash(L"Copyright © 2007-2022 Melin Software HB")); gdi.dropLine(); gdi.addStringUT(10, "The database connection used is MySQL++\nCopyright " "(c) 1998 by Kevin Atkinson, (c) 1999, 2000 and 2001 by MySQL AB," diff --git a/code/TabCompetition.h b/code/TabCompetition.h index f8c0ad3..8d7b3ca 100644 --- a/code/TabCompetition.h +++ b/code/TabCompetition.h @@ -1,7 +1,7 @@ #pragma once /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/TabControl.cpp b/code/TabControl.cpp index 2557c5d..c80133b 100644 --- a/code/TabControl.cpp +++ b/code/TabControl.cpp @@ -1,6 +1,6 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/TabControl.h b/code/TabControl.h index d2c88d6..f8153f7 100644 --- a/code/TabControl.h +++ b/code/TabControl.h @@ -1,7 +1,7 @@ #pragma once /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/TabCourse.cpp b/code/TabCourse.cpp index 8aac547..9afe3a0 100644 --- a/code/TabCourse.cpp +++ b/code/TabCourse.cpp @@ -1,6 +1,6 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/TabCourse.h b/code/TabCourse.h index a1ba2fd..26355aa 100644 --- a/code/TabCourse.h +++ b/code/TabCourse.h @@ -1,7 +1,7 @@ #pragma once /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/TabList.cpp b/code/TabList.cpp index a1efe8b..2e1ef1c 100644 --- a/code/TabList.cpp +++ b/code/TabList.cpp @@ -1,6 +1,6 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 @@ -398,7 +398,7 @@ int TabList::listCB(gdioutput &gdi, int type, void *data) } else if (bi.id == "Window" || bi.id == "AutoScroll" || bi.id == "FullScreen" || bi.id == "FullScreenLive") { - gdioutput *gdi_new; + gdioutput *gdi_new = nullptr; TabList *tl_new = this; if (!ownWindow) { auto nw = makeOwnWindow(gdi); @@ -571,8 +571,9 @@ int TabList::listCB(gdioutput &gdi, int type, void *data) gdi.getTabs().get(TabType(bi.getExtraInt()))->loadPage(gdi); } else if (bi.id=="SavePS") { - const char *ctype = (char *)gdi.getData("Type"); - saveExtraLines(*oe, ctype, gdi); + string ctype; + gdi.getData("Type", ctype); + saveExtraLines(*oe, ctype.c_str(), gdi); if (gdi.hasWidget("SplitAnalysis")) { int aflag = (gdi.isChecked("SplitAnalysis") ? 0 : 1) + (gdi.isChecked("Speed") ? 0 : 2) @@ -2745,7 +2746,7 @@ void TabList::splitPrintSettings(oEvent &oe, gdioutput &gdi, bool setupPrinter, } gdi.popX(); gdi.fillDown(); - char *ctype = type == Splits ? "SPExtra" : "EntryExtra"; + const char *ctype = type == Splits ? "SPExtra" : "EntryExtra"; customTextLines(oe, ctype, gdi); if (type == Splits) { diff --git a/code/TabList.h b/code/TabList.h index 3775827..6d36f0c 100644 --- a/code/TabList.h +++ b/code/TabList.h @@ -1,7 +1,7 @@ #pragma once /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/TabMulti.cpp b/code/TabMulti.cpp index f88677c..5b36c08 100644 --- a/code/TabMulti.cpp +++ b/code/TabMulti.cpp @@ -1,6 +1,6 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/TabMulti.h b/code/TabMulti.h index 50e578a..689e778 100644 --- a/code/TabMulti.h +++ b/code/TabMulti.h @@ -1,7 +1,7 @@ #pragma once /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/TabRunner.cpp b/code/TabRunner.cpp index e102f90..b45c5bf 100644 --- a/code/TabRunner.cpp +++ b/code/TabRunner.cpp @@ -1,6 +1,6 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 @@ -260,12 +260,12 @@ void TabRunner::selectRunner(gdioutput &gdi, pRunner r) { if (r->getCourse(false)) crsName = r->getCourse(false)->getName(); - wstring courseType = lang.tl("[Klassens bana]"); + wstring courseType = lang.tl(" [Klassens bana]"); pClass cClass = r->getClassRef(false); if (cClass && (cClass->hasCoursePool() || r->getClassRef(true)->hasCoursePool())) { if (!crsName.empty()) courseType = L", ... "; - courseType += L"[" + lang.tl("Banpool") + L"]"; + courseType += L" [" + lang.tl("Banpool") + L"]"; } else if (crsName.empty()) crsName += L" "; diff --git a/code/TabRunner.h b/code/TabRunner.h index 2389ba7..1426401 100644 --- a/code/TabRunner.h +++ b/code/TabRunner.h @@ -1,7 +1,7 @@ #pragma once /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/TabSI.cpp b/code/TabSI.cpp index 4d7ff02..db0fb8c 100644 --- a/code/TabSI.cpp +++ b/code/TabSI.cpp @@ -1,6 +1,6 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 @@ -51,6 +51,7 @@ #include "autocomplete.h" constexpr bool addTestPort = false; +void tabForceSync(gdioutput& gdi, pEvent oe); TabSI::TabSI(oEvent *poe):TabBase(poe), activeSIC(ConvertedTimeStatus::Unknown) { editCardData.tabSI = this; @@ -74,6 +75,7 @@ TabSI::TabSI(oEvent *poe):TabBase(poe), activeSIC(ConvertedTimeStatus::Unknown) inputId = 0; printErrorShown = false; NC = 8; + splitPrinter.onlyChanged = false; } TabSI::~TabSI(void) @@ -117,6 +119,22 @@ int SportIdentCB(gdioutput *gdi, int type, void *data) { return tsi.siCB(*gdi, type, data); } +string TabSI::typeFromSndType(SND s) { + switch (s) { + case SND::OK: + return "SoundOK"; + case SND::NotOK: + return "SoundNotOK"; + case SND::Leader: + return "SoundLeader"; + case SND::ActionNeeded: + return "SoundAction"; + default: + assert(false); + } + return ""; +} + int TabSI::siCB(gdioutput &gdi, int type, void *data) { if (type == GUI_BUTTON) { @@ -150,11 +168,29 @@ int TabSI::siCB(gdioutput &gdi, int type, void *data) gdi.fillRight(); auto addSoundWidget = [&gdi, this](const wchar_t *name, SND type, const wstring &label) { + int itype = int(type); string nname = gdioutput::narrow(name); - gdi.addInput(nname, oe->getPropertyString(nname.c_str(), L""), 32, nullptr, label); + wstring fn = oe->getPropertyString(nname.c_str(), L""); + bool doPlay = true; + if (fn == L"none") { + doPlay = false; + fn = L""; + } + + gdi.dropLine(1); + gdi.addCheckbox(("DoPlay" + nname).c_str(), "", SportIdentCB, doPlay, "Använd").setExtra(itype); + gdi.dropLine(-1); + gdi.addInput("SoundFile", fn, 32, SportIdentCB, label).setExtra(itype); gdi.dropLine(0.8); - gdi.addButton("BrowseSound", "Bläddra...", SportIdentCB).setExtra(name); - gdi.addButton("TestSound", "Testa", SportIdentCB).setExtra(int(type)); + gdi.addButton("BrowseSound", "Bläddra...", SportIdentCB).setExtra(itype); + gdi.addButton("TestSound", "Testa", SportIdentCB).setExtra(itype); + + if (!doPlay) { + gdi.setInputStatus("SoundFile", false, false, itype); + gdi.setInputStatus("BrowseSound", false, false, itype); + gdi.setInputStatus("TestSound", false, false, itype); + } + gdi.dropLine(3); gdi.popX(); }; @@ -193,15 +229,26 @@ int TabSI::siCB(gdioutput &gdi, int type, void *data) wstring file = gdi.browseForOpen(ext, L"wav"); if (!file.empty()) { - wchar_t *type = bi.getExtra(); - string name = gdioutput::narrow(type); - gdi.setText(name, file); + SND iType = SND(bi.getExtraInt()); + gdi.setText("SoundFile", file, false, int(iType)); + string name = typeFromSndType(iType); oe->setProperty(name.c_str(), file); } } - else if (bi.id == "SoundOK" || bi.id == "SoundNotOK" || - bi.id == "SoundLeader" || bi.id == "SoundAction") { - oe->setProperty(bi.id.c_str(), bi.text); + else if (bi.id.substr(0, 6) == "DoPlay") { + SND itype = SND(bi.getExtraInt()); + bool checked = gdi.isChecked(bi.id); + gdi.setInputStatus("SoundFile", checked, false, int(itype)); + gdi.setInputStatus("BrowseSound", checked, false, int(itype)); + gdi.setInputStatus("TestSound", checked, false, int(itype)); + string name = typeFromSndType(itype); + if (!checked) { + oe->setProperty(name.c_str(), L"none"); + } + else { + wstring sf = gdi.getText("SoundFile", false, int(itype)); + oe->setProperty(name.c_str(), sf); + } } else if (bi.id == "TestSound") { oe->setProperty("PlaySound", 1); @@ -1623,6 +1670,11 @@ int TabSI::siCB(gdioutput &gdi, int type, void *data) gdi.setText(ii.id, L""); } } + else if (ii.id == "SoundFile") { + SND iType = SND(ii.getExtraInt()); + string name = typeFromSndType(iType); + oe->setProperty(name.c_str(), ii.text); + } } else if (type==GUI_INFOBOX) { DWORD loaded; @@ -3174,6 +3226,7 @@ void TabSI::generateStartInfo(gdioutput &gdi, const oRunner &r) { void TabSI::printerSetup(gdioutput &gdi) { gdi.printSetup(splitPrinter); + splitPrinter.onlyChanged = false; } void TabSI::checkMoreCardsInQueue(gdioutput &gdi) { @@ -3865,7 +3918,7 @@ void TabSI::showRegisterHiredCards(gdioutput &gdi) { gdi.fillDown(); oe->synchronizeList(oListId::oLPunchId); - auto &hiredCards = oe->getHiredCards(); + auto hiredCards = oe->getHiredCards(); for (int i : hiredCards) { gdi.addStringUT(0, itos(i)).setExtra(i).setHandler(getResetHiredCardHandler()); } @@ -4375,17 +4428,32 @@ void TabSI::playReadoutSound(SND type) { case SND::NotOK: fn = oe->getPropertyString("SoundNotOK", L""); res = 52; + if (fn == L"none") { + fn = oe->getPropertyString("SoundAction", L""); + res = 53; + } break; case SND::Leader: fn = oe->getPropertyString("SoundLeader", L""); res = 51; + if (fn == L"none") { + fn = oe->getPropertyString("SoundOK", L""); + res = 50; + } break; case SND::ActionNeeded: fn = oe->getPropertyString("SoundAction", L""); res = 53; + if (fn == L"none") { + fn = oe->getPropertyString("SoundNotOK", L""); + res = 52; + } break; } + if (fn == L"none") + return; + if (checkedSound.count(fn) || (!fn.empty() && fileExists(fn))) { playSoundFile(fn); checkedSound.insert(fn); diff --git a/code/TabSI.h b/code/TabSI.h index 536deb0..4e9244c 100644 --- a/code/TabSI.h +++ b/code/TabSI.h @@ -1,7 +1,7 @@ #pragma once /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 @@ -75,6 +75,8 @@ private: ActionNeeded }; + string typeFromSndType(SND s); + set checkedSound; void playReadoutSound(SND type); diff --git a/code/TabSpeaker.cpp b/code/TabSpeaker.cpp index 52b3fc0..a5d0ef6 100644 --- a/code/TabSpeaker.cpp +++ b/code/TabSpeaker.cpp @@ -1,6 +1,6 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 @@ -1302,10 +1302,10 @@ SpeakerMonitor *TabSpeaker::getSpeakerMonitor() { void TabSpeaker::getSettings(gdioutput &gdi, multimap &settings) { RECT rc; gdi.getWindowsPosition(rc); - settings.insert(make_pair("left", itow(rc.left))); - settings.insert(make_pair("right", itow(rc.right))); - settings.insert(make_pair("top", itow(rc.top))); - settings.insert(make_pair("bottom", itow(rc.bottom))); + settings.insert(make_pair("left", itow(int(rc.left)))); + settings.insert(make_pair("right", itow(int(rc.right)))); + settings.insert(make_pair("top", itow(int(rc.top)))); + settings.insert(make_pair("bottom", itow(int(rc.bottom)))); for (auto clsId : classesToWatch) { pClass cls = oe->getClass(clsId); diff --git a/code/TabSpeaker.h b/code/TabSpeaker.h index eb89905..a880975 100644 --- a/code/TabSpeaker.h +++ b/code/TabSpeaker.h @@ -1,7 +1,7 @@ #pragma once /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/TabTeam.cpp b/code/TabTeam.cpp index 0e0d505..74f801b 100644 --- a/code/TabTeam.cpp +++ b/code/TabTeam.cpp @@ -1,6 +1,6 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/TabTeam.h b/code/TabTeam.h index ab97507..64a1027 100644 --- a/code/TabTeam.h +++ b/code/TabTeam.h @@ -1,7 +1,7 @@ #pragma once /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/Table.cpp b/code/Table.cpp index 7c67d84..4317919 100644 --- a/code/Table.cpp +++ b/code/Table.cpp @@ -1,6 +1,6 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/Table.h b/code/Table.h index 512351d..58aa164 100644 --- a/code/Table.h +++ b/code/Table.h @@ -1,7 +1,7 @@ #pragma once /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/TimeStamp.cpp b/code/TimeStamp.cpp index adfc925..a30bd9b 100644 --- a/code/TimeStamp.cpp +++ b/code/TimeStamp.cpp @@ -1,6 +1,6 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 @@ -28,18 +28,13 @@ #include "meos.h" #include "TimeStamp.h" #include - -#ifdef _DEBUG -#undef THIS_FILE -static char THIS_FILE[]=__FILE__; -#define new DEBUG_NEW -#endif +#include "meos_util.h" ////////////////////////////////////////////////////////////////////// // Construction/Destruction ////////////////////////////////////////////////////////////////////// -const __int64 minYearConstant = 2014 - 1601; +constexpr __int64 minYearConstant = 2014 - 1601; TimeStamp::TimeStamp() { @@ -129,9 +124,9 @@ string TimeStamp::getStampStringN() const FILETIME &ft = *(FILETIME*)&ft64; SYSTEMTIME st; FileTimeToSystemTime(&ft, &st); - - if (st.wYear > 2021 || st.wYear < 2009) { - st.wYear = 2021; + int y = getThisYear(); + if (st.wYear > y || st.wYear < 2009) { + st.wYear = y; st.wDay = 1; st.wMonth = 1; st.wHour = 2; diff --git a/code/TimeStamp.h b/code/TimeStamp.h index 28cdce4..f8ede9a 100644 --- a/code/TimeStamp.h +++ b/code/TimeStamp.h @@ -10,7 +10,7 @@ #endif // _MSC_VER > 1000 /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/animationdata.cpp b/code/animationdata.cpp index 6cc19a1..5e27476 100644 --- a/code/animationdata.cpp +++ b/code/animationdata.cpp @@ -1,6 +1,6 @@ /************************************************************************ MeOS - Orienteering Software -Copyright (C) 2009-2021 Melin Software HB +Copyright (C) 2009-2022 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 @@ -70,12 +70,12 @@ AnimationData::~AnimationData() { } } -bool AnimationData::takeOver(shared_ptr &other) { +bool AnimationData::takeOver(const shared_ptr &other) { delayedTakeOver = other; return true; } -void AnimationData::takeOverInternal(shared_ptr &other) { +void AnimationData::takeOverInternal(const shared_ptr &other) { pages.swap(other->pages); width = other->width; height = other->height; diff --git a/code/animationdata.h b/code/animationdata.h index 633fb09..81cc60a 100644 --- a/code/animationdata.h +++ b/code/animationdata.h @@ -2,7 +2,7 @@ /************************************************************************ MeOS - Orienteering Software -Copyright (C) 2009-2021 Melin Software HB +Copyright (C) 2009-2022 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 @@ -48,7 +48,7 @@ class AnimationData : public GuiHandler { shared_ptr animationThread; shared_ptr delayedTakeOver; - void takeOverInternal(shared_ptr &other); + void takeOverInternal(const shared_ptr &other); void threadRender(gdioutput *gdi, size_t sp, int delay); public: @@ -58,7 +58,7 @@ public: ~AnimationData(); void handle(gdioutput &gdi, BaseInfo &info, GuiEventType type); - bool takeOver(shared_ptr &other); + bool takeOver(const shared_ptr &other); void renderPage(HDC hDC, gdioutput &gdi, DWORD time); }; diff --git a/code/autocomplete.cpp b/code/autocomplete.cpp index 8957770..622427b 100644 --- a/code/autocomplete.cpp +++ b/code/autocomplete.cpp @@ -1,6 +1,6 @@ /************************************************************************ MeOS - Orienteering Software -Copyright (C) 2009-2021 Melin Software HB +Copyright (C) 2009-2022 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 @@ -176,7 +176,7 @@ void AutoCompleteInfo::enter() { } } -void AutoCompleteInfo::setData(vector &items) { +void AutoCompleteInfo::setData(const vector &items) { int newDataIx = -1; if (modifedAutoComplete && size_t(currentIx) < data.size()) { for (size_t k = 0; k < items.size(); k++) { diff --git a/code/autocomplete.h b/code/autocomplete.h index 883d7ad..ca5eb62 100644 --- a/code/autocomplete.h +++ b/code/autocomplete.h @@ -2,7 +2,7 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 @@ -65,7 +65,7 @@ public: } void paint(HDC hDC); - void setData(vector &items); + void setData(const vector &items); void click(int x, int y); void show(); diff --git a/code/autocompletehandler.h b/code/autocompletehandler.h index 3bc7587..d398c36 100644 --- a/code/autocompletehandler.h +++ b/code/autocompletehandler.h @@ -1,7 +1,7 @@ #pragma once /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/autotask.cpp b/code/autotask.cpp index 2859041..7335f2c 100644 --- a/code/autotask.cpp +++ b/code/autotask.cpp @@ -1,6 +1,6 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/autotask.h b/code/autotask.h index fecd8ed..eae701c 100644 --- a/code/autotask.h +++ b/code/autotask.h @@ -2,7 +2,7 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/classconfiginfo.cpp b/code/classconfiginfo.cpp index 8877a76..816d42b 100644 --- a/code/classconfiginfo.cpp +++ b/code/classconfiginfo.cpp @@ -1,6 +1,6 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/classconfiginfo.h b/code/classconfiginfo.h index b99b5d6..8ceee05 100644 --- a/code/classconfiginfo.h +++ b/code/classconfiginfo.h @@ -2,7 +2,7 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/csvparser.cpp b/code/csvparser.cpp index cba250b..f2481de 100644 --- a/code/csvparser.cpp +++ b/code/csvparser.cpp @@ -1,6 +1,6 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/csvparser.h b/code/csvparser.h index ce80f53..cd51110 100644 --- a/code/csvparser.h +++ b/code/csvparser.h @@ -1,6 +1,6 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/download.cpp b/code/download.cpp index 7dc058c..dc63882 100644 --- a/code/download.cpp +++ b/code/download.cpp @@ -1,6 +1,6 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/download.h b/code/download.h index bd470f4..a2389f0 100644 --- a/code/download.h +++ b/code/download.h @@ -7,7 +7,7 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 @@ -46,7 +46,7 @@ class ProgressWindow; class Download { private: - volatile unsigned hThread; + volatile uintptr_t hThread; volatile bool doExit; //HWND hProgress; diff --git a/code/english.lng b/code/english.lng index 8c99a84..71b7567 100644 --- a/code/english.lng +++ b/code/english.lng @@ -1263,7 +1263,7 @@ Zooma ut (Ctrl + '-') = Zoom out (Ctrl + '-') [Bevaka] = [Watch] [Flytta ner] = [Move down] [Bort] = [Remove] -[Klassens bana] = [From Class] +[Klassens bana] = [From class] [Uppdaterad anmälan] = [Updated entry] [VARNING] ingen/okänd = [VARNING] none/unknown [Ã…terställ] = [Reset] @@ -1326,8 +1326,8 @@ help:59395 = In this form, you can quickly make basic settings for many classes help:59395_more = The class fees, which shows if you have activated Economy features, are used for new entries. If you change a fee, MeOS will ask if you wish to apply the change to existing competitors.\n\nFor bibs you have the options None, Consecutive and Manual. You can also type the first bib in the class, for example A100, or 50. Consecutive means that the last number of the preceeding class is used to define the first number in this class. Reserved bib numbers gives a gap (of the specified width) in the numbering between classes.\n\nMeOS updates bibs when you draw start times or change the settings. Manual means that MeOS will never automatically update bibs.\n\nFor classes with teams the setting Team member controls the relation between the team number and the bibs. It can be the same, increasing (100, 101, 102), leg dependent (100-1, 100-2, etc.) or completely independent. help:7618 = The number of runners in a team is specified on the page Classes. help:7620 = Interval (seconds). Leave the field blank to update when the competition is changed. -help:89064 = For every control, you specify one or more code number (SI codes). In a course, you refer to the control by its ID number. Usually, you do not need to add controls manually, since MeOS automatically adds all controls needed.\n\nMore than one SI code is useful for replacing malfunctioning controls or to create simple forks. For an ordinary control, it is required that the runner visit on of the specified controls. If the control status is , all specified controls must be visited (in any order). If the status is , the control is ignored.\n\nIf you specify a control name, it is possible to print result lists with intermediate times at named controls.\n\nTime adjustment can be used if it turns out that a control has wrong time. Time format is +/-MM:SS or +/-HH:MM:SS.\n\nShortest leg time defines the shortest possible time on that leg. No runner will get a shorter time to this control, no matter how fast he/she is. This can be used, for example, if a dangerous road must be crossed.\n\nStatus means that the time to the control is ignored; the total time will be the same no matter what the actual time to this control is. -help:9373 = Give one or more control numbers (SI codes) used by this control.\nExample: 31, 32, 33. +help:89064 = For every control, you specify one or more code number (SI codes). In a course, you refer to the control by its ID number. Usually, you do not need to add controls manually, since MeOS automatically adds all controls needed.\n\nMore than one SI code is useful for replacing malfunctioning controls or to create simple forks. For an ordinary control, it is required that the runner visit on of the specified controls. If the control status is , all specified controls must be visited (in any order). If the status is , the control is ignored.\n\nThe status works like , but in addition the running time to the next control is ignored; it does not matter for the final time how much time was spent looking for the lost control.\n\nIf you specify a control name, it is possible to print result lists with intermediate times at named controls.\n\nTime adjustment can be used if it turns out that a control has wrong time. Time format is +/-MM:SS or +/-HH:MM:SS.\n\nShortest leg time defines the shortest possible time on that leg. No runner will get a shorter time to this control, no matter how fast he/she is. This can be used, for example, if a dangerous road must be crossed.\n\nStatus means that the time to the control is ignored; the total time will be the same no matter what the actual time to this control is. +help:9373 = Provide one or more control numbers (SI codes) used by this control.\nExample: 31, 250. help:9615 = Received no answer. Do you want to open the port in passive mode; should MeOS listen to incoming punches? help:assignfee = MeOS will take care of entry fees for you automatically in many cases. The competitors are assigned fees based on age and entry date (you define the limits under Competition Settings). Every class defines its fees. You provide default values for different class types under Competition Settings, but you can also manually change class settings using Quick Settings for the class.\n\nThis page lets you manually use different ages and time limits for different fees. On the page competitor, you can manually adjust the fee for individual competitors, if needed. help:baudrate = Transmission speed/Baudrate: use 4800 or 38400. @@ -1531,7 +1531,7 @@ Mappnamnet fÃ¥r inte vara tomt = Folder name cannot be empty Onlineresultat = Online Results Packa stora filer (zip) = Compress large files (zip) Publicera resultat direkt pÃ¥ nätet = Publish results directly on the web -Resultat online = Results OnLine +Resultat online = Results Online Skicka till webben = Send to the web Spara pÃ¥ disk = Save to disk Till exempel X = For example X @@ -2586,3 +2586,7 @@ Testa = Test Fel: Använd X i texten där värdet (Y) ska sättas in = Error: Use X in the text where the value (Y) should be used info:teamcourseassignment = The imported file contains forking data for teams. To import this data you must prepare the competition to match the imported file: \n\n1. Ensure all classes are setup with the correct number of legs.\n2. Provide bib numbers in each class. Use Quick Settings on the page Classes and enter the first bib number in each class (meaning automatic bib setting). You can also import the teams first and assign bibs as usual.\n3. Import the courses. You can import this file several times if needed to update the forking. Försvunnen = Missing +Automatnamn = Service name +Använd = Use +Om du vill kan du namnge automaten = You may give the service a name +Spara inställningar = Save settings diff --git a/code/gdiconstants.h b/code/gdiconstants.h index eae8668..40fbc51 100644 --- a/code/gdiconstants.h +++ b/code/gdiconstants.h @@ -1,6 +1,6 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/gdifonts.h b/code/gdifonts.h index ff40bd7..de4b117 100644 --- a/code/gdifonts.h +++ b/code/gdifonts.h @@ -1,6 +1,6 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 @@ -44,23 +44,23 @@ enum gdiFonts { formatIgnore = 1000, }; -const int pageNewPage=100; -//const int pageReserveHeight=101; -const int pagePageInfo=102; -const int pageNewChapter = 103; +constexpr int pageNewPage=100; +constexpr int pagePageInfo=102; +constexpr int pageNewChapter = 103; -const int textRight=256; -const int textCenter=512; -const int timerCanBeNegative=1024; -const int breakLines=2048; -const int fullTimeHMS = 4096; -const int timeWithTenth = 1<<13; -const int timeSeconds = 1<<14; -const int timerIgnoreSign = 1<<15; -const int Capitalize = 1<<16; -const int absolutePosition = 1 << 17; -const int skipBoundingBox = 1 << 18; -const int hiddenText = 1 << 19; +constexpr int textRight=256; +constexpr int textCenter=512; +constexpr int timerCanBeNegative=1024; +constexpr int breakLines=2048; +constexpr int fullTimeHMS = 4096; +constexpr int timeWithTenth = 1<<13; +constexpr int timeSeconds = 1<<14; +constexpr int timerIgnoreSign = 1<<15; +constexpr int Capitalize = 1<<16; +constexpr int absolutePosition = 1 << 17; +constexpr int skipBoundingBox = 1 << 18; +constexpr int hiddenText = 1 << 19; +constexpr int textLimitEllipsis = 1 << 20; enum GDICOLOR { colorBlack = RGB(0, 0, 0), diff --git a/code/gdiimpl.h b/code/gdiimpl.h index c83d816..c2ffa18 100644 --- a/code/gdiimpl.h +++ b/code/gdiimpl.h @@ -1,6 +1,6 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/gdioutput.cpp b/code/gdioutput.cpp index 932b58a..50e5f79 100644 --- a/code/gdioutput.cpp +++ b/code/gdioutput.cpp @@ -1,6 +1,6 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 @@ -793,7 +793,7 @@ void gdioutput::timerProc(TimerInfo &timer, DWORD timeout) { else if (timer.callBack) timer.callBack(this, GUI_TIMER, &timer); - remove_if(timers.begin(), timers.end(), [timerId](TimerInfo &x) {return x.getId() == timerId; }); + timers.erase(remove_if(timers.begin(), timers.end(), [timerId](TimerInfo &x) {return x.getId() == timerId; }), timers.end()); } void gdioutput::removeHandler(GuiHandler *h) { @@ -1471,7 +1471,7 @@ LRESULT CALLBACK GetMsgProc(HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam) LPARAM res = CallWindowProc(lbi->originalProc, hWnd, iMsg, wParam, lParam); if (iMsg == WM_VSCROLL || iMsg == WM_MOUSEWHEEL || iMsg == WM_KEYDOWN) { - int topIndex = CallWindowProc(lbi->originalProc, hWnd, LB_GETTOPINDEX, 0, 0); + LRESULT topIndex = CallWindowProc(lbi->originalProc, hWnd, LB_GETTOPINDEX, 0, 0); if (lbi->lbiSync) { ListBoxInfo *other = lbi->lbiSync; CallWindowProc(other->originalProc, other->hWnd, LB_SETTOPINDEX, topIndex, 0); @@ -1554,12 +1554,12 @@ void gdioutput::setSelection(const string &id, const set &selection) if (selection.count(-1)==1) SendMessage(it->hWnd, LB_SETSEL, 1, -1); else { - int count=SendMessage(it->hWnd, LB_GETCOUNT, 0,0); + LRESULT count=SendMessage(it->hWnd, LB_GETCOUNT, 0,0); SendMessage(it->hWnd, LB_SETSEL, 0, -1); for(int i=0;ihWnd, LB_GETITEMDATA, i, 0); + LRESULT d=SendMessage(it->hWnd, LB_GETITEMDATA, i, 0); - if (selection.count(d)==1) + if (selection.count(int(d))==1) SendMessage(it->hWnd, LB_SETSEL, 1, i); } return; @@ -1573,12 +1573,12 @@ void gdioutput::getSelection(const string &id, set &selection) { for(it=LBI.begin(); it != LBI.end(); ++it){ if (it->id==id && !it->IsCombo) { selection.clear(); - int count=SendMessage(it->hWnd, LB_GETCOUNT, 0,0); + LRESULT count=SendMessage(it->hWnd, LB_GETCOUNT, 0,0); for(int i=0;ihWnd, LB_GETSEL, i, 0); + LRESULT s=SendMessage(it->hWnd, LB_GETSEL, i, 0); if (s) { - int d=SendMessage(it->hWnd, LB_GETITEMDATA, i, 0); - selection.insert(d); + LRESULT d=SendMessage(it->hWnd, LB_GETITEMDATA, i, 0); + selection.insert(int(d)); } } return; @@ -1683,14 +1683,14 @@ bool gdioutput::addItem(const string &id, const wstring &text, size_t data) for (it=LBI.rbegin(); it != LBI.rend(); ++it) { if (it->id==id) { if (it->IsCombo) { - int index=SendMessage(it->hWnd, CB_ADDSTRING, 0, LPARAM(text.c_str())); + LRESULT index=SendMessage(it->hWnd, CB_ADDSTRING, 0, LPARAM(text.c_str())); SendMessage(it->hWnd, CB_SETITEMDATA, index, data); - it->data2Index[data] = index; + it->data2Index[data] = int(index); } else { - int index=SendMessage(it->hWnd, LB_INSERTSTRING, -1, LPARAM(text.c_str())); + LRESULT index=SendMessage(it->hWnd, LB_INSERTSTRING, -1, LPARAM(text.c_str())); SendMessage(it->hWnd, LB_SETITEMDATA, index, data); - it->data2Index[data] = index; + it->data2Index[data] = int(index); } return true; } @@ -1698,30 +1698,30 @@ bool gdioutput::addItem(const string &id, const wstring &text, size_t data) return false; } -bool gdioutput::addItem(const string &id, const vector< pair > &items) +bool gdioutput::addItem(const string& id, const vector< pair >& items) { list::reverse_iterator it; - for (it=LBI.rbegin(); it != LBI.rend(); ++it) { - if (it->id==id) { + for (it = LBI.rbegin(); it != LBI.rend(); ++it) { + if (it->id == id) { if (it->IsCombo) { SendMessage(it->hWnd, CB_RESETCONTENT, 0, 0); SendMessage(it->hWnd, CB_INITSTORAGE, items.size(), 48); it->data2Index.clear(); - for (size_t k = 0; khWnd, CB_ADDSTRING, 0, LPARAM(items[k].first.c_str())); + for (size_t k = 0; k < items.size(); k++) { + LRESULT index = SendMessage(it->hWnd, CB_ADDSTRING, 0, LPARAM(items[k].first.c_str())); SendMessage(it->hWnd, CB_SETITEMDATA, index, items[k].second); - it->data2Index[items[k].second] = index; + it->data2Index[items[k].second] = int(index); } } else { SendMessage(it->hWnd, LB_RESETCONTENT, 0, 0); SendMessage(it->hWnd, LB_INITSTORAGE, items.size(), 48); it->data2Index.clear(); - for (size_t k = 0; khWnd, LB_INSERTSTRING, -1, LPARAM(items[k].first.c_str())); + for (size_t k = 0; k < items.size(); k++) { + LRESULT index = SendMessage(it->hWnd, LB_INSERTSTRING, -1, LPARAM(items[k].first.c_str())); SendMessage(it->hWnd, LB_SETITEMDATA, index, items[k].second); - it->data2Index[items[k].second] = index; + it->data2Index[items[k].second] = int(index); } } return true; @@ -1738,10 +1738,10 @@ void gdioutput::filterOnData(const string &id, const unordered_set &filter) } else { const HWND &hWnd = it->hWnd; - int count = SendMessage(hWnd, LB_GETCOUNT, 0, 0); - for (int ix = count - 1; ix>=0; ix--) { - int ret = SendMessage(hWnd, LB_GETITEMDATA, ix, 0); - if (ret != LB_ERR && filter.count(ret) == 0) + LRESULT count = SendMessage(hWnd, LB_GETCOUNT, 0, 0); + for (intptr_t ix = count - 1; ix>=0; ix--) { + LRESULT ret = SendMessage(hWnd, LB_GETITEMDATA, ix, 0); + if (ret != LB_ERR && filter.count(int(ret)) == 0) SendMessage(hWnd, LB_DELETESTRING, ix, 0); } return; @@ -1804,14 +1804,14 @@ void ListBoxInfo::copyUserData(ListBoxInfo &dest) const { bool gdioutput::getSelectedItem(ListBoxInfo &lbi) { if (lbi.IsCombo) { - int index=SendMessage(lbi.hWnd, CB_GETCURSEL, 0, 0); + LRESULT index=SendMessage(lbi.hWnd, CB_GETCURSEL, 0, 0); if (index == CB_ERR) { wchar_t bf[256]; GetWindowText(lbi.hWnd, bf, 256); lbi.text=bf; lbi.data=-1; - lbi.index=index; + lbi.index=int(index); return false; } lbi.data=SendMessage(lbi.hWnd, CB_GETITEMDATA, index, 0); @@ -1820,13 +1820,13 @@ bool gdioutput::getSelectedItem(ListBoxInfo &lbi) { lbi.text=bf; } else { - int index=SendMessage(lbi.hWnd, LB_GETCURSEL, 0, 0); + LRESULT index=SendMessage(lbi.hWnd, LB_GETCURSEL, 0, 0); if (index==LB_ERR) return false; lbi.data=SendMessage(lbi.hWnd, LB_GETITEMDATA, index, 0); - lbi.index=index; + lbi.index=int(index); TCHAR bf[1024]; if (SendMessage(lbi.hWnd, LB_GETTEXT, index, LPARAM(bf))!=LB_ERR) @@ -1839,10 +1839,10 @@ int gdioutput::getNumItems(const char *id) { for (auto &lbi : LBI) { if (lbi.id == id) { if (lbi.IsCombo) { - return SendMessage(lbi.hWnd, CB_GETCOUNT, 0, 0); + return (int)SendMessage(lbi.hWnd, CB_GETCOUNT, 0, 0); } else { - return SendMessage(lbi.hWnd, LB_GETCOUNT, 0, 0); + return (int)SendMessage(lbi.hWnd, LB_GETCOUNT, 0, 0); } } } @@ -1861,16 +1861,16 @@ int gdioutput::getItemDataByName(const char *id, const char *name) const{ for(it = LBI.begin(); it != LBI.end(); ++it){ if (it->id==id) { if (it->IsCombo) { - int ix = SendMessage(it->hWnd, CB_FINDSTRING, -1, LPARAM(wname.c_str())); + LRESULT ix = SendMessage(it->hWnd, CB_FINDSTRING, -1, LPARAM(wname.c_str())); if (ix >= 0) { - return SendMessage(it->hWnd, CB_GETITEMDATA, ix, 0); + return (int)SendMessage(it->hWnd, CB_GETITEMDATA, ix, 0); } return -1; } else { - int ix = SendMessage(it->hWnd, LB_FINDSTRING, -1, LPARAM(wname.c_str())); + LRESULT ix = SendMessage(it->hWnd, LB_FINDSTRING, -1, LPARAM(wname.c_str())); if (ix >= 0) { - return SendMessage(it->hWnd, LB_GETITEMDATA, ix, 0); + return (int)SendMessage(it->hWnd, LB_GETITEMDATA, ix, 0); } return -1; } @@ -1895,10 +1895,10 @@ bool gdioutput::selectItemByData(const char *id, int data) return true; } else { - int count = SendMessage(it->hWnd, CB_GETCOUNT, 0, 0); + LRESULT count = SendMessage(it->hWnd, CB_GETCOUNT, 0, 0); for (int m = 0; m < count; m++) { - int ret = SendMessage(it->hWnd, CB_GETITEMDATA, m, 0); + LRESULT ret = SendMessage(it->hWnd, CB_GETITEMDATA, m, 0); if (ret == data) { SendMessage(it->hWnd, CB_SETCURSEL, m, 0); it->data = data; @@ -1924,9 +1924,9 @@ bool gdioutput::selectItemByData(const char *id, int data) return true; } else { - int count = SendMessage(it->hWnd, LB_GETCOUNT, 0, 0); + LRESULT count = SendMessage(it->hWnd, LB_GETCOUNT, 0, 0); for (int m = 0; m < count; m++) { - int ret = SendMessage(it->hWnd, LB_GETITEMDATA, m, 0); + LRESULT ret = SendMessage(it->hWnd, LB_GETITEMDATA, m, 0); if (ret == data) { SendMessage(it->hWnd, LB_SETCURSEL, m, 0); @@ -1962,7 +1962,7 @@ bool gdioutput::selectItemByIndex(const char *id, int index) { } else { SendMessage(it->hWnd, CB_SETCURSEL, index, 0); - int data = SendMessage(it->hWnd, CB_GETITEMDATA, index, 0); + LRESULT data = SendMessage(it->hWnd, CB_GETITEMDATA, index, 0); it->data = data; it->originalIdx = data; TCHAR bf[1024]; @@ -1985,7 +1985,7 @@ bool gdioutput::selectItemByIndex(const char *id, int index) { } else { SendMessage(it->hWnd, LB_SETCURSEL, index, 0); - int data = SendMessage(it->hWnd, LB_GETITEMDATA, index, 0); + LRESULT data = SendMessage(it->hWnd, LB_GETITEMDATA, index, 0); it->data = data; it->originalIdx = data; @@ -2018,7 +2018,7 @@ bool gdioutput::autoGrow(const char *id) { for(it=LBI.begin(); it != LBI.end(); ++it){ if (it->id==id) { if (it->IsCombo) { - int count = SendMessage(it->hWnd, CB_GETCOUNT, 0, 0); + LRESULT count = SendMessage(it->hWnd, CB_GETCOUNT, 0, 0); for (int m = 0; m < count; m++) { wchar_t bf[1024]; if (SendMessage(it->hWnd, CB_GETLBTEXT, m, LPARAM(bf))!=CB_ERR) { @@ -2026,7 +2026,6 @@ bool gdioutput::autoGrow(const char *id) { calcStringSize(TI, hDC); size = max(size, TI.textRect.right - TI.textRect.left); } - m++; } ReleaseDC(hWndTarget, hDC); @@ -2041,15 +2040,15 @@ bool gdioutput::autoGrow(const char *id) { return false; } else { - int count = SendMessage(it->hWnd, LB_GETCOUNT, 0, 0); + LRESULT count = SendMessage(it->hWnd, LB_GETCOUNT, 0, 0); for (int m = 0; m < count; m++) { wchar_t bf[1024]; - int len = SendMessage(it->hWnd, LB_GETTEXT, m, LPARAM(bf)); + LRESULT len = SendMessage(it->hWnd, LB_GETTEXT, m, LPARAM(bf)); if (len!=LB_ERR) { if (it->lastTabStop == 0) TI.text = bf; else { - int pos = len; + auto pos = len; while(pos > 0) { if (bf[pos-1] == '\t') { break; @@ -2122,7 +2121,7 @@ void gdioutput::processButtonMessage(ButtonInfo &bi, WPARAM wParam) cmd = "press(\"" + bi.id + "\", \"" + narrow(bi.getExtra()) + "\"); //" + toUTF8(bi.text); } else { - int arg = int(bi.extra); + int arg = int((size_t)bi.extra); if (arg > 1000000 || arg < -1000000 || arg == 0) cmd = "press(\"" + bi.id + "\"); //" + toUTF8(bi.text); else @@ -2205,7 +2204,7 @@ void gdioutput::processEditMessage(InputInfo &bi, WPARAM wParam) void gdioutput::processComboMessage(ListBoxInfo &bi, WPARAM wParam) { WORD hwParam = HIWORD(wParam); - int index; + LRESULT index; switch (hwParam) { case CBN_SETFOCUS: currentFocus = bi.hWnd; @@ -2322,7 +2321,7 @@ void gdioutput::keyCommand(KeyCommandCode code) { void gdioutput::processListMessage(ListBoxInfo &bi, WPARAM wParam) { WORD hwParam = HIWORD(wParam); - int index; + LRESULT index; switch (hwParam) { case LBN_SETFOCUS: @@ -3118,7 +3117,8 @@ void gdioutput::clearPage(bool autoRefresh, bool keepToolbar) { CurrentX = scaleLength(40); CurrentY = scaleLength(START_YP); - + SX = CurrentX; + SY = CurrentY; OffsetX = 0; OffsetY = 0; @@ -3206,14 +3206,14 @@ BaseInfo &gdioutput::getBaseInfo(const char *id) const { throw std::exception(err.c_str()); } -const wstring &gdioutput::getText(const char *id, bool acceptMissing) const +const wstring &gdioutput::getText(const char *id, bool acceptMissing, int requireExtraMatch) const { TCHAR bf[1024]; TCHAR *bptr=bf; for(list::const_iterator it=II.begin(); it != II.end(); ++it){ - if (it->id==id){ + if (it->id==id && it->matchExtra(requireExtraMatch)){ int len=GetWindowTextLength(it->hWnd); if (len>1023) @@ -3231,7 +3231,7 @@ const wstring &gdioutput::getText(const char *id, bool acceptMissing) const for(list::const_iterator it=LBI.begin(); it != LBI.end(); ++it){ - if (it->id==id && it->IsCombo){ + if (it->id==id && it->IsCombo && it->matchExtra(requireExtraMatch)){ if (!it->writeLock) { GetWindowText(it->hWnd, bf, 1024); const_cast(it->text)=bf; @@ -3242,7 +3242,7 @@ const wstring &gdioutput::getText(const char *id, bool acceptMissing) const for(list::const_iterator it=TL.begin(); it != TL.end(); ++it){ - if (it->id==id) { + if (it->id==id && it->matchExtra(requireExtraMatch)) { return it->text; } } @@ -3324,11 +3324,10 @@ BaseInfo *gdioutput::setTextZeroBlank(const char *id, int number, bool Update) } -BaseInfo *gdioutput::setText(const char *id, const wstring &text, bool Update) +BaseInfo *gdioutput::setText(const char *id, const wstring &text, bool Update, int requireExtraMatch) { - for (list::iterator it=II.begin(); - it != II.end(); ++it) { - if (it->id==id) { + for (auto it = II.begin(); it != II.end(); ++it) { + if (it->id == id && it->matchExtra(requireExtraMatch)) { bool oldWR = it->writeLock; it->writeLock = true; SetWindowText(it->hWnd, text.c_str()); @@ -3341,9 +3340,8 @@ BaseInfo *gdioutput::setText(const char *id, const wstring &text, bool Update) } } - for (list::iterator it=LBI.begin(); - it != LBI.end(); ++it) { - if (it->id==id && it->IsCombo) { + for (auto it = LBI.begin(); it != LBI.end(); ++it) { + if (it->id == id && it->IsCombo && it->matchExtra(requireExtraMatch)) { SetWindowText(it->hWnd, text.c_str()); it->text = text; it->original = text; @@ -3351,25 +3349,23 @@ BaseInfo *gdioutput::setText(const char *id, const wstring &text, bool Update) } } - for (list::iterator it=BI.begin(); - it != BI.end(); ++it) { - if (it->id==id) { + for (auto it = BI.begin(); it != BI.end(); ++it) { + if (it->id == id && it->matchExtra(requireExtraMatch)) { SetWindowText(it->hWnd, text.c_str()); - it->text=text; + it->text = text; return &*it; } } - for(list::iterator it=TL.begin(); - it != TL.end(); ++it){ - if (it->id==id) { - RECT rc=it->textRect; + for (auto it = TL.begin(); it != TL.end(); ++it) { + if (it->id == id && it->matchExtra(requireExtraMatch)) { + RECT rc = it->textRect; - it->text=text; + it->text = text; calcStringSize(*it); - rc.right=max(it->textRect.right, rc.right); - rc.bottom=max(it->textRect.bottom, rc.bottom); + rc.right = max(it->textRect.right, rc.right); + rc.bottom = max(it->textRect.bottom, rc.bottom); bool changed = updatePos(0, 0, it->textRect.right, it->textRect.bottom); @@ -3406,7 +3402,7 @@ bool gdioutput::insertText(const string &id, const wstring &text) void gdioutput::setData(const string &id, DWORD data) { - void *pd = (void *)(data); + void *pd = (void *)(size_t(data)); setData(id, pd); } @@ -3433,7 +3429,7 @@ bool gdioutput::getData(const string &id, DWORD &data) const list::const_iterator it; for(it=DataInfo.begin(); it != DataInfo.end(); ++it){ if (it->id==id){ - data=DWORD(it->data); + data=DWORD(size_t(it->data)); return true; } } @@ -3690,20 +3686,20 @@ void gdioutput::setTabStops(const string &Name, int t1, int t2) } } -void gdioutput::setInputStatus(const char *id, bool status, bool acceptMissing) { +void gdioutput::setInputStatus(const char *id, bool status, bool acceptMissing, int matchExtra) { bool hit = false; for(list::iterator it=II.begin(); it != II.end(); ++it) - if (it->id==id) { + if (it->id==id && (matchExtra == -1 || it->getExtraInt() == matchExtra)) { EnableWindow(it->hWnd, status); hit = true; } for(list::iterator it=LBI.begin(); it != LBI.end(); ++it) - if (it->id==id) { + if (it->id==id && (matchExtra == -1 || it->getExtraInt() == matchExtra)) { EnableWindow(it->hWnd, status); hit = true; } for(list::iterator it=BI.begin(); it != BI.end(); ++it) - if (it->id==id) { + if (it->id==id && (matchExtra == -1 || it->getExtraInt() == matchExtra)) { EnableWindow(it->hWnd, status); if (it->isCheckbox) { string tid = "T" + it->id; @@ -4219,49 +4215,53 @@ void gdioutput::RenderString(TextInfo &ti, HDC hDC) ti.textRect.top = rc.top; ti.textRect.bottom = rc.bottom + h + 5; } - else if (format != 10 && (breakLines&ti.format) == 0){ - if (ti.xlimit==0){ + else if (format != 10 && (breakLines&ti.format) == 0) { + if (ti.xlimit == 0) { if (ti.format&textRight) { - DrawText(hDC, ti.text.c_str(), ti.text.length(), &rc, DT_CALCRECT|DT_NOPREFIX); + DrawText(hDC, ti.text.c_str(), ti.text.length(), &rc, DT_CALCRECT | DT_NOPREFIX); int dx = rc.right - rc.left; ti.realWidth = dx; - rc.right-=dx; - rc.left-=dx; - ti.textRect=rc; - DrawText(hDC, ti.text.c_str(), ti.text.length(), &rc, DT_RIGHT|DT_NOCLIP|DT_NOPREFIX); + rc.right -= dx; + rc.left -= dx; + ti.textRect = rc; + DrawText(hDC, ti.text.c_str(), ti.text.length(), &rc, DT_RIGHT | DT_NOCLIP | DT_NOPREFIX); } else if (ti.format&textCenter) { - DrawText(hDC, ti.text.c_str(), ti.text.length(), &rc, DT_CENTER|DT_CALCRECT|DT_NOPREFIX); + DrawText(hDC, ti.text.c_str(), ti.text.length(), &rc, DT_CENTER | DT_CALCRECT | DT_NOPREFIX); int dx = rc.right - rc.left; ti.realWidth = dx; - rc.right-=dx/2; - rc.left-=dx/2; - ti.textRect=rc; - DrawText(hDC, ti.text.c_str(), ti.text.length(), &rc, DT_CENTER|DT_NOCLIP|DT_NOPREFIX); - } - else{ - DrawText(hDC, ti.text.c_str(), ti.text.length(), &rc, DT_LEFT|DT_CALCRECT|DT_NOPREFIX); - ti.textRect=rc; - ti.realWidth = rc.right - rc.left; - DrawText(hDC, ti.text.c_str(), ti.text.length(), &rc, DT_LEFT|DT_NOCLIP|DT_NOPREFIX); - } - } - else{ - DrawText(hDC, ti.text.c_str(), ti.text.length(), &rc, DT_CALCRECT|DT_NOPREFIX); - ti.realWidth = rc.right - rc.left; - if (ti.format&textRight) { - rc.right = rc.left + ti.xlimit - (rc.bottom - rc.top)/2; - DrawText(hDC, ti.text.c_str(), ti.text.length(), &rc, DT_RIGHT|DT_NOPREFIX); - } - else if (ti.format&textCenter) { - rc.right = rc.left + ti.xlimit - (rc.bottom - rc.top)/2; - DrawText(hDC, ti.text.c_str(), ti.text.length(), &rc, DT_CENTER|DT_NOPREFIX); + rc.right -= dx / 2; + rc.left -= dx / 2; + ti.textRect = rc; + DrawText(hDC, ti.text.c_str(), ti.text.length(), &rc, DT_CENTER | DT_NOCLIP | DT_NOPREFIX); } else { - rc.right=rc.left+ti.xlimit; - DrawText(hDC, ti.text.c_str(), -1, &rc, DT_LEFT|DT_NOPREFIX); + DrawText(hDC, ti.text.c_str(), ti.text.length(), &rc, DT_LEFT | DT_CALCRECT | DT_NOPREFIX); + ti.textRect = rc; + ti.realWidth = rc.right - rc.left; + DrawText(hDC, ti.text.c_str(), ti.text.length(), &rc, DT_LEFT | DT_NOCLIP | DT_NOPREFIX); } - ti.textRect=rc; + } + else { + int flags = DT_NOPREFIX; + if (ti.format & textLimitEllipsis) + flags = DT_END_ELLIPSIS; + + DrawText(hDC, ti.text.c_str(), ti.text.length(), &rc, DT_CALCRECT | flags); + ti.realWidth = rc.right - rc.left; + if (ti.format&textRight) { + rc.right = rc.left + ti.xlimit - (rc.bottom - rc.top) / 2; + DrawText(hDC, ti.text.c_str(), ti.text.length(), &rc, DT_RIGHT | flags); + } + else if (ti.format&textCenter) { + rc.right = rc.left + ti.xlimit - (rc.bottom - rc.top) / 2; + DrawText(hDC, ti.text.c_str(), ti.text.length(), &rc, DT_CENTER | flags); + } + else { + rc.right = rc.left + ti.xlimit; + DrawText(hDC, ti.text.c_str(), -1, &rc, DT_LEFT | flags); + } + ti.textRect = rc; } } else { @@ -5633,7 +5633,7 @@ wstring gdioutput::browseForFolder(const wstring &folderStart, const wchar_t *de bool gdioutput::openDoc(const wchar_t *doc) { - return (int)ShellExecute(hWndTarget, L"open", doc, NULL, L"", SW_SHOWNORMAL ) >32; + return (intptr_t)ShellExecute(hWndTarget, L"open", doc, NULL, L"", SW_SHOWNORMAL ) >32; } void gdioutput::init(HWND hWnd, HWND hMain, HWND hTab) @@ -5664,8 +5664,8 @@ ToolInfo &gdioutput::addToolTip(const string &tipId, const wstring &tip, HWND hW if (hWnd != 0) { ti.uFlags = TTF_IDISHWND; - info.id = int(hWnd); - ti.uId = (UINT) hWnd; + info.id = uintptr_t(hWnd); + ti.uId = (UINT_PTR) hWnd; } else { ti.uFlags = TTF_SUBCLASS; @@ -6900,7 +6900,7 @@ string gdioutput::dbSelect(const string &id, int data) { if (!IsWindowEnabled(it->hWnd)) throw meosException("Selection " + id + " is not active."); if (it->multipleSelection) { - map::const_iterator res = it->data2Index.find(data); + auto res = it->data2Index.find(data); if (res != it->data2Index.end()) SendMessage(it->hWnd, LB_SETSEL, true, res->second); else @@ -7137,7 +7137,7 @@ DWORD gdioutput::selectColor(wstring &def, DWORD input) { return -1; } -void gdioutput::setAnimationMode(shared_ptr &data) { +void gdioutput::setAnimationMode(const shared_ptr &data) { if (animationData && animationData->takeOver(data)) return; animationData = data; diff --git a/code/gdioutput.h b/code/gdioutput.h index 7942a6a..434bce7 100644 --- a/code/gdioutput.h +++ b/code/gdioutput.h @@ -1,6 +1,6 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 @@ -174,7 +174,7 @@ protected: struct FucusInfo { bool wasTabbed; HWND hWnd; - FucusInfo() : wasTabbed(false), hWnd(false) {} + FucusInfo() : wasTabbed(false), hWnd(0) {} FucusInfo(HWND wnd) : wasTabbed(false), hWnd(wnd) {} }; @@ -365,7 +365,7 @@ public: DWORD getBGColor2() const; const wstring &getBGImage() const; - void setAnimationMode(shared_ptr &mode); + void setAnimationMode(const shared_ptr &mode); void setAutoScroll(double speed); void getAutoScroll(double &speed, double &pos) const; @@ -533,11 +533,13 @@ public: BaseInfo *setInputFocus(const string &id, bool select=false); InputInfo *getInputFocus(); - void enableInput(const char *id, bool acceptMissing = false) {setInputStatus(id, true, acceptMissing);} - void disableInput(const char *id, bool acceptMissing = false) {setInputStatus(id, false, acceptMissing);} - void setInputStatus(const char *id, bool status, bool acceptMissing = false); - void setInputStatus(const string &id, bool status, bool acceptMissing = false) - {setInputStatus(id.c_str(), status, acceptMissing);} + void enableInput(const char *id, bool acceptMissing = false, + int requireExtraMatch = -1) {setInputStatus(id, true, acceptMissing, requireExtraMatch);} + void disableInput(const char *id, bool acceptMissing = false, + int requireExtraMatch = -1) {setInputStatus(id, false, acceptMissing, requireExtraMatch);} + void setInputStatus(const char *id, bool status, bool acceptMissing = false, int requireExtraMatch = -1); + void setInputStatus(const string &id, bool status, bool acceptMissing = false, int requireExtraMatch = -1) + {setInputStatus(id.c_str(), status, acceptMissing, requireExtraMatch);} void setTabStops(const string &Name, int t1, int t2=-1); void setData(const string &id, DWORD data); @@ -611,7 +613,7 @@ public: bool hasWidget(const string &id) const; - const wstring &getText(const char *id, bool acceptMissing = false) const; + const wstring &getText(const char *id, bool acceptMissing = false, int requireExtraMatch = -1) const; BaseInfo &getBaseInfo(const string &id) const { return getBaseInfo(id.c_str()); @@ -642,7 +644,7 @@ public: BaseInfo *setTextTranslate(const string &id, const wstring &text, bool update=false); - BaseInfo *setText(const char *id, const wstring &text, bool update=false); + BaseInfo *setText(const char *id, const wstring &text, bool update=false, int requireExtraMatch = -1); BaseInfo *setText(const wchar_t *id, const wstring &text, bool update=false) { return setText(narrow(id), text, update); } diff --git a/code/gdistructures.h b/code/gdistructures.h index 01a8b83..12285eb 100644 --- a/code/gdistructures.h +++ b/code/gdistructures.h @@ -1,6 +1,6 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 @@ -35,6 +35,10 @@ protected: bool dataString; public: + bool matchExtra(int requireExtraMatch) const { + return requireExtraMatch == -1 || requireExtraMatch == getExtraInt(); + } + bool hasEventHandler() const { return handler != 0; } @@ -168,8 +172,8 @@ public: wstring text; wstring font; - int xp; - int yp; + int xp = -1; + int yp = -1; int format; DWORD color; @@ -179,8 +183,8 @@ public: int absPrintY; bool hasTimer; - DWORD zeroTime; - DWORD timeOut; + DWORD zeroTime = -1; + DWORD timeOut = 0; bool hasCapture; GUICALLBACK callBack; @@ -328,10 +332,10 @@ private: bool isEditControl; bool writeLock; wstring original; - int originalIdx; + size_t originalIdx; bool ignoreCheck; // True if changed-state should be ignored - map data2Index; + map data2Index; // Synchronize with other list box WNDPROC originalProc; @@ -428,7 +432,7 @@ struct ToolInfo { string name; TOOLINFOW ti; wstring tip; - int id; + uintptr_t id; }; diff --git a/code/generalresult.cpp b/code/generalresult.cpp index 1a96302..592a6ee 100644 --- a/code/generalresult.cpp +++ b/code/generalresult.cpp @@ -1,6 +1,6 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 @@ -38,7 +38,7 @@ GeneralResultCtr::GeneralResultCtr(const char *tagIn, const wstring &nameIn, con ptr = ptrIn; } -GeneralResultCtr::GeneralResultCtr(wstring &file, const shared_ptr &ptrIn) { +GeneralResultCtr::GeneralResultCtr(const wstring &file, const shared_ptr &ptrIn) { ptr = ptrIn; name = ptrIn->getName(false); tag = ptrIn->getTag(); diff --git a/code/generalresult.h b/code/generalresult.h index 6bd0845..434deb9 100644 --- a/code/generalresult.h +++ b/code/generalresult.h @@ -2,7 +2,7 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 @@ -343,7 +343,7 @@ struct GeneralResultCtr { } GeneralResultCtr(const char *tag, const wstring &name, const shared_ptr &ptr); - GeneralResultCtr(wstring &file, const shared_ptr &ptr); + GeneralResultCtr(const wstring &file, const shared_ptr &ptr); GeneralResultCtr() {} ~GeneralResultCtr(); diff --git a/code/guihandler.h b/code/guihandler.h index 651aa7d..e44b1e4 100644 --- a/code/guihandler.h +++ b/code/guihandler.h @@ -2,7 +2,7 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/image.cpp b/code/image.cpp index 392a1a7..efbe381 100644 --- a/code/image.cpp +++ b/code/image.cpp @@ -1,6 +1,6 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/image.h b/code/image.h index 463d46c..790e1b7 100644 --- a/code/image.h +++ b/code/image.h @@ -1,6 +1,6 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/importformats.cpp b/code/importformats.cpp index 7335ac0..c221f4f 100644 --- a/code/importformats.cpp +++ b/code/importformats.cpp @@ -1,6 +1,6 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/infoserver.cpp b/code/infoserver.cpp index 86d1b86..b71f905 100644 --- a/code/infoserver.cpp +++ b/code/infoserver.cpp @@ -1,6 +1,6 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/infoserver.h b/code/infoserver.h index eba08a4..ecd631c 100644 --- a/code/infoserver.h +++ b/code/infoserver.h @@ -1,6 +1,6 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/inthashmap.h b/code/inthashmap.h index c0cd112..4e6b405 100644 --- a/code/inthashmap.h +++ b/code/inthashmap.h @@ -2,7 +2,7 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/intkeymap.hpp b/code/intkeymap.hpp index 490c9cb..e15de70 100644 --- a/code/intkeymap.hpp +++ b/code/intkeymap.hpp @@ -1,7 +1,7 @@ #pragma once /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/intkeymapimpl.hpp b/code/intkeymapimpl.hpp index 65ed8ef..7b9fedb 100644 --- a/code/intkeymapimpl.hpp +++ b/code/intkeymapimpl.hpp @@ -2,7 +2,7 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/iof30interface.cpp b/code/iof30interface.cpp index 5e4f10b..39e1e9e 100644 --- a/code/iof30interface.cpp +++ b/code/iof30interface.cpp @@ -1,6 +1,6 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 @@ -256,7 +256,7 @@ void IOF30Interface::readCourseData(gdioutput &gdi, const xmlobject &xo, bool up if (pc->getNumStages() == 0) { pc->setNumStages(coursePattern[0].size()); } - for (int leg = 0; leg < pc->getNumStages() && leg < coursePattern[0].size(); leg++) { + for (unsigned leg = 0; leg < pc->getNumStages() && leg < coursePattern[0].size(); leg++) { pc->clearStageCourses(leg); for (int m = 0; m < period; m++) pc->addStageCourse(leg, coursePattern[(patternStart + m)%period][leg], -1); @@ -2501,12 +2501,12 @@ pRunner IOF30Interface::readPerson(gdioutput &gdi, const xmlobject &person) { if (!r) { if ( pid > 0) { - oRunner or(&oe, pid); - r = oe.addRunner(or, true); + oRunner oR(&oe, pid); + r = oe.addRunner(oR, true); } else { - oRunner or(&oe); - r = oe.addRunner(or, true); + oRunner oR(&oe); + r = oe.addRunner(oR, true); } } @@ -2560,7 +2560,7 @@ pClub IOF30Interface::readOrganization(gdioutput &gdi, const xmlobject &xclub, b if (clubId) pc = oe.getClubCreate(clubId, name); - if (!pc) return false; + if (!pc) return nullptr; } else { pc = new oClub(&oe, clubId); diff --git a/code/iof30interface.h b/code/iof30interface.h index 66bc24d..2beaf7d 100644 --- a/code/iof30interface.h +++ b/code/iof30interface.h @@ -1,6 +1,6 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/listeditor.cpp b/code/listeditor.cpp index 260d771..b436e9a 100644 --- a/code/listeditor.cpp +++ b/code/listeditor.cpp @@ -1,6 +1,6 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 @@ -94,6 +94,8 @@ void ListEditor::show(TabBase *dst, gdioutput &gdi) { show(gdi); } +int editListCB(gdioutput* gdi, int type, void* data); + void ListEditor::show(gdioutput &gdi) { gdi.setRestorePoint("BeginListEdit"); @@ -396,6 +398,13 @@ int ListEditor::editList(gdioutput &gdi, int type, BaseInfo &data) { }*/ } if ( bi.id.substr(0, 8) == "EditPost" ) { + if (gdi.hasData("CurrentId")) { + DWORD id; + gdi.getData("CurrentId", id); + getPosFromId(id, groupIx, lineIx, ix); + MetaListPost &mlp = currentList->getMLP(groupIx, lineIx, ix); + saveListPost(gdi, mlp); + } int id = atoi(bi.id.substr(8).c_str()); getPosFromId(id, groupIx, lineIx, ix); MetaListPost &mlp = currentList->getMLP(groupIx, lineIx, ix); @@ -464,55 +473,7 @@ int ListEditor::editList(gdioutput &gdi, int type, BaseInfo &data) { MetaListPost &mlp = currentList->getMLP(groupIx, lineIx, ix); - ListBoxInfo lbi; - bool force = false; - gdi.getSelectedItem("Type", lbi); - - EPostType ptype = EPostType(lbi.data); - - wstring str = gdi.getText("Text"); - if (ptype != lString) { - if (!str.empty() && str.find_first_of('X') == string::npos && str[0]!='@') { - throw meosException("Texten ska innehÃ¥lla tecknet X, som byts ut mot tävlingsspecifik data"); - } - } - - wstring t1 = mlp.getType(); - EPostType newType = EPostType(lbi.data); - mlp.setType(newType); - if (t1 != mlp.getType()) - force = true; - mlp.setText(str); - - gdi.getSelectedItem("AlignType", lbi); - mlp.align(EPostType(lbi.data)); - - mlp.limitBlockWidth(gdi.isChecked("LimitBlockWidth")); - mlp.alignText(gdi.getText("AlignText")); - - auto relPrev = gdi.getSelectedItem("RelPrevious"); - mlp.packWithPrevious(relPrev.first == 2); - mlp.mergePrevious(relPrev.first == 1); - - gdi.getSelectedItem("TextAdjust", lbi); - mlp.setTextAdjust(lbi.data); - - mlp.setColor(GDICOLOR(gdi.getExtraInt("Color"))); - - int leg = readLeg(gdi, newType, true); - mlp.setLeg(leg); - - if (gdi.hasWidget("UseResultModule") && gdi.isChecked("UseResultModule")) - mlp.setResultModule(currentList->getResultModule()); - else - mlp.setResultModule(""); - - mlp.setBlock(gdi.getTextNo("BlockSize")); - mlp.indent(gdi.getTextNo("MinIndent")); - - gdi.getSelectedItem("Fonts", lbi); - mlp.setFont(gdiFonts(lbi.data)); - makeDirty(gdi, MakeDirty, MakeDirty); + bool force = saveListPost(gdi, mlp); if (!gdi.hasData("NoRedraw") || force) { gdi.restore("BeginListEdit", false); @@ -819,6 +780,60 @@ int ListEditor::editList(gdioutput &gdi, int type, BaseInfo &data) { return 0; } +bool ListEditor::saveListPost(gdioutput &gdi, MetaListPost &mlp) { + ListBoxInfo lbi; + bool force = false; + gdi.getSelectedItem("Type", lbi); + + EPostType ptype = EPostType(lbi.data); + + wstring str = gdi.getText("Text"); + if (ptype != lString) { + if (!str.empty() && str.find_first_of('X') == string::npos && str[0] != '@') { + throw meosException("Texten ska innehÃ¥lla tecknet X, som byts ut mot tävlingsspecifik data"); + } + } + + wstring t1 = mlp.getType(); + EPostType newType = EPostType(lbi.data); + mlp.setType(newType); + if (t1 != mlp.getType()) + force = true; + mlp.setText(str); + + gdi.getSelectedItem("AlignType", lbi); + mlp.align(EPostType(lbi.data)); + + mlp.limitBlockWidth(gdi.isChecked("LimitBlockWidth")); + mlp.alignText(gdi.getText("AlignText")); + + auto relPrev = gdi.getSelectedItem("RelPrevious"); + mlp.packWithPrevious(relPrev.first == 2); + mlp.mergePrevious(relPrev.first == 1); + + gdi.getSelectedItem("TextAdjust", lbi); + mlp.setTextAdjust(lbi.data); + + mlp.setColor(GDICOLOR(gdi.getExtraInt("Color"))); + + int leg = readLeg(gdi, newType, true); + mlp.setLeg(leg); + + if (gdi.hasWidget("UseResultModule") && gdi.isChecked("UseResultModule")) + mlp.setResultModule(currentList->getResultModule()); + else + mlp.setResultModule(""); + + mlp.setBlock(gdi.getTextNo("BlockSize")); + mlp.indent(gdi.getTextNo("MinIndent")); + + gdi.getSelectedItem("Fonts", lbi); + mlp.setFont(gdiFonts(lbi.data)); + makeDirty(gdi, MakeDirty, MakeDirty); + + return force; +} + int ListEditor::readLeg(gdioutput &gdi, EPostType newType, bool checkError) const { if (MetaList::isResultModuleOutput(newType)) { int leg = gdi.getTextNo("Leg"); @@ -891,10 +906,14 @@ void ListEditor::updateType(int iType, gdioutput & gdi) { void ListEditor::checkUnsaved(gdioutput &gdi) { if (gdi.hasData("IsEditing")) { - if (gdi.isInputChanged("")) { - gdi.setData("NoRedraw", 1); - gdi.sendCtrlMessage("Apply"); - } + if (gdi.hasData("CurrentId")) { + DWORD id; + gdi.getData("CurrentId", id); + int groupIx, lineIx, ix; + getPosFromId(id, groupIx, lineIx, ix); + MetaListPost &mlp = currentList->getMLP(groupIx, lineIx, ix); + saveListPost(gdi, mlp); + } } if (gdi.hasData("IsEditingList")) { if (gdi.isInputChanged("")) { @@ -1085,6 +1104,7 @@ void ListEditor::editListPost(gdioutput &gdi, const MetaListPost &mlp, int id) { gdi.addInput("MinIndent", itow(mlp.getMinimalIndent()), 7, 0, L"Justering i sidled:"); + int maxX = gdi.getCX(); gdi.popX(); gdi.dropLine(3); vector< pair > fonts; @@ -1094,7 +1114,7 @@ void ListEditor::editListPost(gdioutput &gdi, const MetaListPost &mlp, int id) { gdi.addSelection("Fonts", 200, 500, 0, L"Format:"); gdi.addItem("Fonts", fonts); gdi.selectItemByData("Fonts", currentFont); - int maxX = gdi.getCX(); + maxX = max(maxX, gdi.getCX()); gdi.popX(); gdi.dropLine(3); diff --git a/code/listeditor.h b/code/listeditor.h index 70fa4f4..f4cfb60 100644 --- a/code/listeditor.h +++ b/code/listeditor.h @@ -2,7 +2,7 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 @@ -53,6 +53,8 @@ private: int editList(gdioutput &gdi, int type, BaseInfo &data); void updateType(int iType, gdioutput &gdi); + bool saveListPost(gdioutput &gdi, MetaListPost &mlp); + ButtonInfo &addButton(gdioutput &gdi, const MetaListPost &mlp, int x, int y, int lineIx, int ix) const; diff --git a/code/liveresult.cpp b/code/liveresult.cpp index 33233e2..2d21b29 100644 --- a/code/liveresult.cpp +++ b/code/liveresult.cpp @@ -1,6 +1,6 @@ /********************i**************************************************** MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/liveresult.h b/code/liveresult.h index 6014ded..9ed9dc8 100644 --- a/code/liveresult.h +++ b/code/liveresult.h @@ -1,7 +1,7 @@ #pragma once /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/localizer.cpp b/code/localizer.cpp index 7e6777c..7c5f04c 100644 --- a/code/localizer.cpp +++ b/code/localizer.cpp @@ -1,6 +1,6 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/localizer.h b/code/localizer.h index 5a81880..ef13f96 100644 --- a/code/localizer.h +++ b/code/localizer.h @@ -1,7 +1,7 @@ #pragma once /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/machinecontainer.cpp b/code/machinecontainer.cpp index de1802a..745688e 100644 --- a/code/machinecontainer.cpp +++ b/code/machinecontainer.cpp @@ -4,6 +4,8 @@ #include "meos_util.h" #include "xmlparser.h" #include "gdioutput.h" +#include "TabAuto.h" + int MachineContainer::AbstractMachine::getInt(const string &v) const { return _wtoi(getString(v).c_str()); } @@ -20,7 +22,7 @@ vector MachineContainer::AbstractMachine::getVectorInt(const string &v) con vector sp; split(s, L",", sp); vector res(sp.size()); - for (int j = 0; j < sp.size(); j++) + for (size_t j = 0; j < sp.size(); j++) res[j] = _wtoi(sp[j].c_str()); return res; } @@ -40,7 +42,7 @@ void MachineContainer::AbstractMachine::set(const string &name, int v) { void MachineContainer::AbstractMachine::set(const string &name, const vector &v) { wstring &r = props[name]; - for (int j = 0; j < v.size(); j++) { + for (size_t j = 0; j < v.size(); j++) { if (j == 0) r = itow(v[j]); else @@ -66,7 +68,7 @@ namespace { string encode(const string &in) { string out; out.reserve(in.length()); - for (int j = 0; j < in.length(); j++) { + for (size_t j = 0; j < in.length(); j++) { if (in[j] == '|' || in[j] == '$' || in[j] == '%') { out.push_back('%'); if (in[j] == '|') @@ -85,14 +87,14 @@ namespace { string decode(const string &in) { string out; out.reserve(in.length()); - for (int j = 0; j < in.length(); j++) { + for (size_t j = 0; j < in.length(); j++) { if (in[j] == '%') { j++; if (j < in.length()) { if (in[j] == '1') out.push_back('|'); else if (in[j] == '2') - out.push_back('§'); + out.push_back('$'); else if (in[j] == '3') out.push_back('%'); } @@ -168,8 +170,19 @@ void MachineContainer::save(xmlparser &data) { void MachineContainer::load(const string &data) { vector parts; split(data, "$", parts); - for (int j = 0; j + 2 < parts.size(); j++) { + if ((parts.size() % 3) != 0) { + // Data is corrupt. Repair by delete... + if (parts.size() > 3) + parts.resize(3); + } + + machines.clear(); + for (size_t j = 0; j + 2 < parts.size(); j+=3) { const string &type = parts[j]; + + if (AutoMachine::getType(type) == Machines::Unknown) + continue; + wstring tag = gdioutput::fromUTF8(decode(parts[j + 1])); auto res = machines.emplace(make_pair(type, tag), MachineContainer::AbstractMachine()); if (res.second) @@ -200,3 +213,13 @@ string MachineContainer::save() { } return out; } + +void MachineContainer::rename(const string& type, const wstring& oldName, const wstring& newName) { + if (newName != oldName) { + auto res = machines.find(make_pair(type, oldName)); + if (res != machines.end()) { + machines.emplace(make_pair(type, newName), res->second); + machines.erase(res); + } + } +} diff --git a/code/machinecontainer.h b/code/machinecontainer.h index d571f47..3a4ec0b 100644 --- a/code/machinecontainer.h +++ b/code/machinecontainer.h @@ -64,6 +64,8 @@ public: machines.erase(make_pair(type, name)); } + void rename(const string& type, const wstring& oldName, const wstring& newName); + AbstractMachine &set(const string &type, const wstring &name) { auto &m = machines[make_pair(type, name)]; m.clear(); diff --git a/code/meos.cpp b/code/meos.cpp index d6a99c1..a7f73b5 100644 --- a/code/meos.cpp +++ b/code/meos.cpp @@ -1,6 +1,6 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 @@ -118,7 +118,7 @@ HWND hMainTab=NULL; list *tabList = nullptr; void scrollVertical(gdioutput *gdi, int yInc, HWND hWnd); -static int currentFocusIx = 0; +static size_t currentFocusIx = 0; void resetSaveTimer() { if (autoTask) diff --git a/code/meos.rc b/code/meos.rc index d1a9dfc..df19e9e 100644 --- a/code/meos.rc +++ b/code/meos.rc @@ -169,7 +169,7 @@ BEGIN VALUE "FileDescription", "meos" VALUE "FileVersion", "3.8.0.1" VALUE "InternalName", "meos" - VALUE "LegalCopyright", "Copyright © 2007-2021" + VALUE "LegalCopyright", "Copyright © 2007-2022" VALUE "OriginalFilename", "meos.exe" VALUE "ProductName", " meos" VALUE "ProductVersion", "3.8.0.1" diff --git a/code/meos_util.cpp b/code/meos_util.cpp index 5c90713..76002f3 100644 --- a/code/meos_util.cpp +++ b/code/meos_util.cpp @@ -1,6 +1,6 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 @@ -2286,3 +2286,8 @@ int compareStringIgnoreCase(const wstring &a, const wstring &b) { return CompareString(LOCALE_USER_DEFAULT, NORM_IGNORECASE, a.c_str(), a.length(), b.c_str(), b.length()) - CSTR_EQUAL; } + +const char* meosException::narrow(const wstring& msg) { + static string nmsg(msg.begin(), msg.end()); + return nmsg.c_str(); +} diff --git a/code/meos_util.h b/code/meos_util.h index 1a3d025..90bc1c3 100644 --- a/code/meos_util.h +++ b/code/meos_util.h @@ -1,6 +1,6 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/meosexception.h b/code/meosexception.h index 6f6a379..7d98d9e 100644 --- a/code/meosexception.h +++ b/code/meosexception.h @@ -2,7 +2,7 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 @@ -25,10 +25,7 @@ class meosException : public std::exception { wstring wideMessage; - static const char *narrow(const wstring &msg) { - static string nmsg(msg.begin(), msg.end()); - return nmsg.c_str(); - } + static const char *narrow(const wstring& msg); public: meosException(const wstring &wmsg) : std::exception(narrow(wmsg)), wideMessage(wmsg) { diff --git a/code/meosvc15.vcxproj b/code/meosvc15.vcxproj index 744b86f..95d7666 100644 --- a/code/meosvc15.vcxproj +++ b/code/meosvc15.vcxproj @@ -29,7 +29,6 @@ {B854EF2A-2BB7-4D62-B08B-96BD64B347E8} meos - 5.01 @@ -68,7 +67,7 @@ false Unicode true - v140_xp + v142 @@ -218,13 +217,14 @@ true Use stdafx.h - .\Release/meos.pch - .\Release/ - .\Release/ - .\Release/ + .\x64/meos.pch + ./x64/Release/ + ./x64/Release/ + ./x64/Release/ Level3 true 4091;4267 + false NDEBUG;%(PreprocessorDefinitions) @@ -235,13 +235,14 @@ $(TargetPath) true ./lib64;%(AdditionalLibraryDirectories) - .\Release/meos.pdb + ./x64/Release/meos.pdb Windows false - - + false true 5.02 + true + true true @@ -328,9 +329,9 @@ NotUsing stdafx.h .\Debug/meos.pch - .\Debug/ - .\Debug/ - .\Debug/ + ./x64/Debug/ + ./x64/Debug/ + ./x64/Debug/ false Level3 true @@ -344,18 +345,17 @@ Msimg32.lib;comctl32.lib;odbc32.lib;odbccp32.lib;winmm.lib;ws2_32.lib;wininet.lib;zlibstat_vc15.lib;mysqlpp_vc15.lib;libhpdf.lib;RestBed.lib;libpng.lib;%(AdditionalDependencies) - .\Debug/meos.exe + ./x64/Debug/meos.exe true ./lib_db;%(AdditionalLibraryDirectories) true - .\Debug/meos.pdb + ./x64/Debug/meos.pdb Windows false - /FORCE:MULTIPLE %(AdditionalOptions) true diff --git a/code/meosversion.cpp b/code/meosversion.cpp index bd8e649..6835651 100644 --- a/code/meosversion.cpp +++ b/code/meosversion.cpp @@ -1,6 +1,6 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 @@ -25,17 +25,17 @@ //ABCDEFGHIJKLMNO int getMeosBuild() { - string revision("$Rev: 1103 $"); + string revision("$Rev: 1116 $"); return 174 + atoi(revision.substr(5, string::npos).c_str()); } wstring getMeosDate() { - wstring date(L"$Date: 2021-12-11 15:54:57 +0100 (lör, 11 dec 2021) $"); + wstring date(L"$Date: 2022-02-18 14:51:32 +0100 (fre, 18 feb 2022) $"); return date.substr(7,10); } wstring getBuildType() { - return L"Beta II"; // No parantheses (...) + return L"RC2"; // No parantheses (...) } wstring getMajorVersion() { @@ -68,38 +68,7 @@ wstring getMeosCompectVersion() { void getSupporters(vector &supp, vector &developSupp) { - supp.emplace_back(L"Tjalve IF"); - supp.emplace_back(L"Nyköpings Orienteringsklubb"); - supp.emplace_back(L"Motionsorientering Göteborg"); - supp.emplace_back(L"OK MÃ¥sen"); - supp.emplace_back(L"IF Thor"); - supp.emplace_back(L"SOS JindÅ™ichův Hradec"); - supp.emplace_back(L"Mats Holmberg, OK Gränsen"); - supp.emplace_back(L"Christoffer Ohlsson, Uddevalla OK"); - supp.emplace_back(L"O-Ringen AB"); - supp.emplace_back(L"Hans Carlstedt, Sävedalens AIK"); - supp.emplace_back(L"IFK Mora OK"); - supp.emplace_back(L"Attunda OK"); - supp.emplace_back(L"Siguldas Takas, Latvia"); - supp.emplace_back(L"Eric Teutsch, Ottawa Orienteering Club, Canada"); - supp.emplace_back(L"Silkeborg OK, Denmark"); - supp.emplace_back(L"Erik Ivarsson Sandberg"); - supp.emplace_back(L"Stenungsunds OK"); - supp.emplace_back(L"OK Leipzig"); - supp.emplace_back(L"Degerfors OK"); - supp.emplace_back(L"OK Tjärnen"); - supp.emplace_back(L"Leksands OK"); - supp.emplace_back(L"O-Travel"); - developSupp.emplace_back(L"KOB Kysak"); - supp.emplace_back(L"Ingemar Carlsson"); - supp.emplace_back(L"Tolereds AIK"); - supp.emplace_back(L"OK Snab"); - supp.emplace_back(L"OK 73"); - supp.emplace_back(L"Herlufsholm OK"); - supp.emplace_back(L"Helsingborgs SOK"); - supp.emplace_back(L"Sala OK"); - supp.emplace_back(L"OK Roskilde"); - developSupp.emplace_back(L"Almby IK, Örebro"); + developSupp.emplace_back(L"Almby IK, Örebro");//2019-- supp.emplace_back(L"Ligue PACA"); supp.emplace_back(L"SC vebr-sport"); supp.emplace_back(L"IP Skogen Göteborg"); @@ -162,6 +131,10 @@ void getSupporters(vector &supp, vector &developSupp) supp.emplace_back(L"Järla Orientering"); supp.emplace_back(L"Hans Wilhelmsson, Säffle OK"); supp.emplace_back(L"Cent Vallées Orientation 12 (C.V.O. 12)"); - + supp.emplace_back(L"OK Tyr, Karlstad"); + supp.emplace_back(L"Miroslav Kollar, KOB Kysak"); + supp.emplace_back(L"Zdenko Rohac, KOB ATU KoÅ¡ice"); + supp.emplace_back(L"Hans Carlstedt, Sävedalens AIK"); + supp.emplace_back(L"Javier Arufe Varela, O-Liceo"); reverse(supp.begin(), supp.end()); } diff --git a/code/metalist.cpp b/code/metalist.cpp index fcc1535..86cba25 100644 --- a/code/metalist.cpp +++ b/code/metalist.cpp @@ -1,6 +1,6 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 @@ -41,8 +41,6 @@ extern oEvent *gEvent; const int MAXLISTPARAMID = 10000000; -using namespace tr1; - class PositionVer2 { struct Block { @@ -170,7 +168,7 @@ public: blocks.back().back().alignWith.emplace_back(row, ix); } - void addAlignNext(const string &newName, int width, int indent) { + bool addAlignNext(const string &newName, int width, int indent) { int best = 10000; string bestName; @@ -188,7 +186,10 @@ public: } } } + if (bestName.empty()) + return false; addAlignWith(bestName, newName, width, indent, false); + return true; } @@ -202,7 +203,7 @@ public: } int get(const string &name, double scale) const { - auto &r = pmap.find(name); + auto r = pmap.find(name); if (r != pmap.end()) return int(blocks[r->second.first][r->second.second].getPos() * scale); return 0; @@ -213,7 +214,7 @@ public: } int getOriginalPos(const string &name, double scale) const { - auto &r = pmap.find(name); + auto r = pmap.find(name); if (r != pmap.end()) return int(blocks[r->second.first][r->second.second].getOriginalPos() * scale); return 0; @@ -746,8 +747,10 @@ void MetaList::interpret(oEvent *oe, const gdioutput &gdi, const oListParam &par typeFormats.push_back(make_pair(cline[kk].type, encode(cline[kk].type, cline[kk].text, dmy))); kk++; } - - width = li.getMaxCharWidth(oe, gdi, par.selection, typeFormats, font, + if (mp.limitWidth && mp.blockWidth > 0) + width = gdi.scaleLength(mp.blockWidth); + else + width = li.getMaxCharWidth(oe, gdi, par.selection, typeFormats, font, oPrintPost::encodeFont(fontFaces[i].font, fontFaces[i].scale).c_str(), large, max(mp.blockWidth, extraMinWidth)); @@ -763,9 +766,11 @@ void MetaList::interpret(oEvent *oe, const gdioutput &gdi, const oListParam &par } else { - if (mp.alignType == lAlignNext) - pos.addAlignNext(label, width, mp.minimalIndent); + if (mp.alignType == lAlignNext) { + if (!pos.addAlignNext(label, width, mp.minimalIndent)) + pos.add(label, width, mp.minimalIndent, mp.packPrevious); //pos.alignNext(label, width, mp.alignBlock); + } else if (mp.alignType == lString) { if (stringLabelMap.count(mp.alignWithText) == 0) { throw meosException(L"Don't know how to align with 'X'#" + mp.alignWithText); @@ -874,6 +879,9 @@ void MetaList::interpret(oEvent *oe, const gdioutput &gdi, const oListParam &par added.color = mp.color; if (!mp.mergeWithPrevious) base = &added; + added.useStrictWidth = mp.getLimitBlockWidth(); + if (added.useStrictWidth) + added.format |= textLimitEllipsis; if (last && mp.mergeWithPrevious) { //last->mergeWith = &added; @@ -926,6 +934,10 @@ void MetaList::interpret(oEvent *oe, const gdioutput &gdi, const oListParam &par if (!mp.mergeWithPrevious) base = &added; + added.useStrictWidth = mp.getLimitBlockWidth(); + if (added.useStrictWidth) + added.format |= textLimitEllipsis; + if (last && mp.mergeWithPrevious) { //last->mergeWith = &added; last->doMergeNext = true; @@ -969,6 +981,9 @@ void MetaList::interpret(oEvent *oe, const gdioutput &gdi, const oListParam &par added.resultModuleIndex = getResultModuleIndex(oe, li, mp); setFixedWidth(added, indexPosToWidth, MLList, j, k); added.xlimit = indexPosToWidthSrc[tuple(MLList, j, k)]; + added.useStrictWidth = mp.getLimitBlockWidth(); + if (added.useStrictWidth) + added.format |= textLimitEllipsis; added.color = mp.color; if (!mp.mergeWithPrevious) @@ -1024,6 +1039,9 @@ void MetaList::interpret(oEvent *oe, const gdioutput &gdi, const oListParam &par added.resultModuleIndex = getResultModuleIndex(oe, li, mp); setFixedWidth(added, indexPosToWidth, MLSubList, j, k); added.xlimit = indexPosToWidthSrc[tuple(MLSubList, j, k)]; + added.useStrictWidth = mp.getLimitBlockWidth(); + if (added.useStrictWidth) + added.format |= textLimitEllipsis; if (last && mp.mergeWithPrevious) { last->doMergeNext = true; diff --git a/code/metalist.h b/code/metalist.h index 5251bdd..2c7cbe4 100644 --- a/code/metalist.h +++ b/code/metalist.h @@ -2,7 +2,7 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/methodeditor.cpp b/code/methodeditor.cpp index c613114..dd92eae 100644 --- a/code/methodeditor.cpp +++ b/code/methodeditor.cpp @@ -1,6 +1,6 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/methodeditor.h b/code/methodeditor.h index 8d46a3e..65b3b2e 100644 --- a/code/methodeditor.h +++ b/code/methodeditor.h @@ -2,7 +2,7 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/mysqldaemon.cpp b/code/mysqldaemon.cpp index 95ac271..661cf5e 100644 --- a/code/mysqldaemon.cpp +++ b/code/mysqldaemon.cpp @@ -1,6 +1,6 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/mysqlwrapper.cpp b/code/mysqlwrapper.cpp index f62ca49..72e7bd0 100644 --- a/code/mysqlwrapper.cpp +++ b/code/mysqlwrapper.cpp @@ -95,12 +95,12 @@ const char *RowWrapper::raw_string(int ix) const { ResultBase::ResultBase(ConnectionWrapper *con, MYSQL_RES * res) : con(con), result(res) { } -ResultBase::ResultBase(ResultBase &r) : con(r.con) { +ResultBase::ResultBase(ResultBase &&r) : con(r.con) { result = r.result; r.result = nullptr; } -const ResultBase &ResultBase::operator=(ResultBase &r) { +const ResultBase &ResultBase::operator=(ResultBase &&r) { con = r.con; if (result) mysql_free_result(result); diff --git a/code/mysqlwrapper.h b/code/mysqlwrapper.h index cac44ab..6ae10db 100644 --- a/code/mysqlwrapper.h +++ b/code/mysqlwrapper.h @@ -55,8 +55,10 @@ namespace sqlwrapper { friend class QueryWrapper; friend class RowWrapper; public: - ResultBase(ResultBase &r); - const ResultBase &operator=(ResultBase &); + ResultBase(ResultBase &&r); + const ResultBase &operator=(ResultBase &&); + ResultBase(const ResultBase& r) = delete; + const ResultBase& operator=(const ResultBase&) = delete; virtual ~ResultBase(); int field_num(const string &field); @@ -69,11 +71,13 @@ namespace sqlwrapper { friend class RowWrapper; public: ResultWrapper() : ResultBase(nullptr, nullptr) {} - ResultWrapper(ResultWrapper &r) : ResultBase(r) {} - const ResultBase &operator=(ResultBase &r) { - ResultBase::operator=(r); + ResultWrapper(ResultWrapper &&r) : ResultBase(std::move(r)) {} + ResultWrapper(const ResultWrapper& r) = delete; + const ResultBase &operator=(ResultWrapper &&r) { + ResultBase::operator=(std::move(r)); return *this; } + const ResultBase& operator=(const ResultBase& r) = delete; //ResultWrapper(ResultWrapper &r); //~ResultWrapper(); @@ -86,15 +90,17 @@ namespace sqlwrapper { }; class ResUseWrapper : public ResultBase { - ResUseWrapper(ConnectionWrapper &con, MYSQL_RES *result); + ResUseWrapper(ConnectionWrapper& con, MYSQL_RES* result); friend class QueryWrapper; friend class RowWrapper; public: - ResUseWrapper(ResUseWrapper &r) : ResultBase(r) {} - const ResUseWrapper &operator=(ResUseWrapper &r) { - ResultBase::operator=(r); + ResUseWrapper(ResUseWrapper&& r) : ResultBase(std::move(r)) {} + const ResUseWrapper& operator=(ResUseWrapper&& r) { + ResultBase::operator=(std::move(r)); return *this; } + ResUseWrapper(const ResUseWrapper& r) = delete; + const ResUseWrapper& operator=(const ResUseWrapper& r) = delete; operator bool() const; RowWrapper fetch_row(); diff --git a/code/newcompetition.cpp b/code/newcompetition.cpp index 6f7e68f..0b25f46 100644 --- a/code/newcompetition.cpp +++ b/code/newcompetition.cpp @@ -1,6 +1,6 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/oBase.cpp b/code/oBase.cpp index 580586a..35daa78 100644 --- a/code/oBase.cpp +++ b/code/oBase.cpp @@ -1,6 +1,6 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/oBase.h b/code/oBase.h index 0725069..2bd7bd9 100644 --- a/code/oBase.h +++ b/code/oBase.h @@ -5,7 +5,7 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/oCard.cpp b/code/oCard.cpp index 69f12ac..ffe3738 100644 --- a/code/oCard.cpp +++ b/code/oCard.cpp @@ -1,6 +1,6 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/oCard.h b/code/oCard.h index 9058061..e5766fb 100644 --- a/code/oCard.h +++ b/code/oCard.h @@ -11,7 +11,7 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/oClass.cpp b/code/oClass.cpp index 97c5766..f3e9b6e 100644 --- a/code/oClass.cpp +++ b/code/oClass.cpp @@ -1,6 +1,6 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 @@ -1934,6 +1934,8 @@ void oClass::updateLeaderTimes() const { else if (r->tLeg > leg) needupdate = true; } + if (leg >= tLeaderTime.size()) + break; tLeaderTime[leg].setComplete(); leg++; } @@ -3407,8 +3409,10 @@ void oClass::calculateSplits() { LegResult legRes; LegResult legBestTime; vector rCls; - + oe->getRunners(Id, -1, rCls, false); + /* if (isQualificationFinalBaseClass() || isQualificationFinalBaseClass()) { + for (auto &r : oe->Runners) { if (!r.isRemoved() && r.getClassRef(true) == this) rCls.push_back(&r); @@ -3419,7 +3423,7 @@ void oClass::calculateSplits() { if (!r.isRemoved() && r.Class == this) rCls.push_back(&r); } - } + }*/ for (set::iterator cit = cSet.begin(); cit!= cSet.end(); ++cit) { pCourse pc = *cit; @@ -4044,7 +4048,7 @@ pair oClass::autoForking(const vector< vector > &inputCourses) { } // Sample if there are very many combinations. - int sampleFactor = 1; + uint64_t sampleFactor = 1; while(N > 10000000) { sampleFactor *= 13; N /= 13; @@ -4054,7 +4058,7 @@ pair oClass::autoForking(const vector< vector > &inputCourses) { vector ws; for (size_t k = 0; k < Ns; k ++) { for (int j = 0; j < legs; j++) { - unsigned long long D = k * sampleFactor; + uint64_t D = uint64_t(k) * sampleFactor; if (nf[j]>0) { ix[j] = int((D/prod[j] + j) % nf[j]); } @@ -4088,7 +4092,7 @@ pair oClass::autoForking(const vector< vector > &inputCourses) { for (size_t k = 0; k < Ns; k++) { long long forkKey = 0; for (int j = 0; j < legs; j++) { - unsigned long long D = (k * 997)%Ns * sampleFactor; + uint64_t D = uint64_t((k * 997)%Ns) * sampleFactor; if (nf[j]>0) { ix[j] = int((D/prod[j] + j) % nf[j]); forkKey = forkKey * 997 + ix[j]; diff --git a/code/oClass.h b/code/oClass.h index bdb0ba7..3b721a8 100644 --- a/code/oClass.h +++ b/code/oClass.h @@ -1,7 +1,7 @@ #pragma once /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 @@ -30,6 +30,7 @@ class oClass; typedef oClass* pClass; class oDataInterface; class GeneralResult; +class oRunner; const int MaxClassId = 1000000; @@ -444,7 +445,7 @@ public: // Autoassign new bibs static void extractBibPatterns(oEvent &oe, map > &patterns); pair getNextBib(map > &patterns); // Version that calculates next free bib from cached data (fast, no gap usage) - pair oClass::getNextBib(); // Version that calculates next free bib (slow, but reuses gaps) + pair getNextBib(); // Version that calculates next free bib (slow, but reuses gaps) bool usesCourse(const oCourse &crs) const; @@ -700,7 +701,7 @@ public: int getEntryFee(const wstring &date, int age) const; /// Get all class fees - vector> oClass::getAllFees() const; + vector> getAllFees() const; // Clear cached data void clearCache(bool recalculate); diff --git a/code/oClub.cpp b/code/oClub.cpp index 0061314..6757ace 100644 --- a/code/oClub.cpp +++ b/code/oClub.cpp @@ -1,6 +1,6 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/oClub.h b/code/oClub.h index 2ec5fb7..06f5b53 100644 --- a/code/oClub.h +++ b/code/oClub.h @@ -11,7 +11,7 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/oControl.cpp b/code/oControl.cpp index 7d0dfd2..636008e 100644 --- a/code/oControl.cpp +++ b/code/oControl.cpp @@ -1,6 +1,6 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/oControl.h b/code/oControl.h index 482f57e..424d013 100644 --- a/code/oControl.h +++ b/code/oControl.h @@ -1,6 +1,6 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/oCourse.cpp b/code/oCourse.cpp index cb0f3f9..a02e870 100644 --- a/code/oCourse.cpp +++ b/code/oCourse.cpp @@ -1,6 +1,6 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 @@ -1074,8 +1074,8 @@ pCourse oCourse::getAdapetedCourse(const oCard &card, oCourse &tmpCourse, int &n } map > > preferences; - for (size_t k = 0; k < punchSequence.size(); k++) { - for (size_t j = 0; j < loopKeys.size(); j++) { + for (int k = 0; k < punchSequence.size(); k++) { + for (int j = 0; j < loopKeys.size(); j++) { int v = matchLoopKey(punchSequence[k], loopKeys[j]); if (v < 1000) preferences[v].push_back(make_pair(k, j)); diff --git a/code/oCourse.h b/code/oCourse.h index 90d4c1d..1d81e1a 100644 --- a/code/oCourse.h +++ b/code/oCourse.h @@ -11,7 +11,7 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/oDataContainer.cpp b/code/oDataContainer.cpp index 4bd291a..1eb2e3e 100644 --- a/code/oDataContainer.cpp +++ b/code/oDataContainer.cpp @@ -1,6 +1,6 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/oDataContainer.h b/code/oDataContainer.h index d5fbb55..fd78060 100644 --- a/code/oDataContainer.h +++ b/code/oDataContainer.h @@ -2,7 +2,7 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 @@ -76,9 +76,9 @@ struct oVariableInt { class oVariableString { public: - oVariableString(wchar_t *buff, int size) : data(buff), maxSize(size), strData(0), strIndex(-2) {} - oVariableString(vector &vec) : data(0), maxSize(0), strData(&vec), strIndex(-1) {} - oVariableString(vector &vec, int position) : data(0), maxSize(0), strData(&vec), strIndex(position) {} + oVariableString(wchar_t *buff, int size) : data(buff), maxSize(size), strData(0), strIndex(-2) { name[0] = 0; } + oVariableString(vector &vec) : data(0), maxSize(0), strData(&vec), strIndex(-1) { name[0] = 0; } + oVariableString(vector &vec, int position) : data(0), maxSize(0), strData(&vec), strIndex(position) { name[0] = 0; } char name[20]; bool store(const wchar_t *str); private: diff --git a/code/oEvent.cpp b/code/oEvent.cpp index 63e331d..3b93da4 100644 --- a/code/oEvent.cpp +++ b/code/oEvent.cpp @@ -1,6 +1,6 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 @@ -704,7 +704,9 @@ void oEvent::listProperties(bool userProps, vector< pair > b.insert("FirstTime"); b.insert("ExportCSVSplits"); b.insert("DrawInterlace"); - + b.insert("PlaySound"); + b.insert("showheader"); + // Integers i.insert("YouthFee"); i.insert("YouthAge"); diff --git a/code/oEvent.h b/code/oEvent.h index cd3dead..0b06ed2 100644 --- a/code/oEvent.h +++ b/code/oEvent.h @@ -6,7 +6,7 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/oEventDraw.cpp b/code/oEventDraw.cpp index 7d487c3..5261057 100644 --- a/code/oEventDraw.cpp +++ b/code/oEventDraw.cpp @@ -1,6 +1,6 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 @@ -1611,7 +1611,7 @@ void oEvent::drawListStartGroups(const vector &spec, vector cInfo; vector> outLines; di.vacancyFactor = 0; - auto &group = sgMap.find(groupId); + auto group = sgMap.find(groupId); int length = max(300, group->second.lastStart - group->second.firstStart); int slots = length / di.baseInterval; di.classes.clear(); diff --git a/code/oEventDraw.h b/code/oEventDraw.h index e85b5e2..3f9d3d5 100644 --- a/code/oEventDraw.h +++ b/code/oEventDraw.h @@ -2,7 +2,7 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/oEventResult.cpp b/code/oEventResult.cpp index 3976e58..54c7aa2 100644 --- a/code/oEventResult.cpp +++ b/code/oEventResult.cpp @@ -1,6 +1,6 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/oEventSQL.cpp b/code/oEventSQL.cpp index 050a86b..4ba1a64 100644 --- a/code/oEventSQL.cpp +++ b/code/oEventSQL.cpp @@ -1,6 +1,6 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/oEventSpeaker.cpp b/code/oEventSpeaker.cpp index 71d6c86..499e717 100644 --- a/code/oEventSpeaker.cpp +++ b/code/oEventSpeaker.cpp @@ -1,6 +1,6 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/oFreeImport.cpp b/code/oFreeImport.cpp index ccaf83d..fa32b1c 100644 --- a/code/oFreeImport.cpp +++ b/code/oFreeImport.cpp @@ -1,6 +1,6 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 @@ -332,7 +332,7 @@ void oWordList::save(const wstring &file) const if (f!=-1) { vector serial; serialize(serial); - char *hdr="WWDB"; + const char *hdr="WWDB"; _write(f, hdr, 4); DWORD s=serial.size(); diff --git a/code/oFreeImport.h b/code/oFreeImport.h index da9cc33..9cf6ae2 100644 --- a/code/oFreeImport.h +++ b/code/oFreeImport.h @@ -2,7 +2,7 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/oFreePunch.cpp b/code/oFreePunch.cpp index ba00f27..9a48ccf 100644 --- a/code/oFreePunch.cpp +++ b/code/oFreePunch.cpp @@ -1,6 +1,6 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/oFreePunch.h b/code/oFreePunch.h index 6b94ade..f93cc07 100644 --- a/code/oFreePunch.h +++ b/code/oFreePunch.h @@ -2,7 +2,7 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/oImportExport.cpp b/code/oImportExport.cpp index 5fd2444..7dde59f 100644 --- a/code/oImportExport.cpp +++ b/code/oImportExport.cpp @@ -1,6 +1,6 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 @@ -861,12 +861,12 @@ bool oEvent::addXMLTeamEntry(const xmlobject &xentry, int clubId) if (t == 0) { if ( id > 0) { - oTeam or(this, id); - t = addTeam(or, true); + oTeam oR(this, id); + t = addTeam(oR, true); } else { - oTeam or(this); - t = addTeam(or, true); + oTeam oR(this); + t = addTeam(oR, true); } t->setStartNo(Teams.size(), oBase::ChangeType::Update); } @@ -950,12 +950,12 @@ pRunner oEvent::addXMLPerson(const xmlobject &person) { if (!r) { if ( pid > 0) { - oRunner or(this, pid); - r = addRunner(or, true); + oRunner oR(this, pid); + r = addRunner(oR, true); } else { - oRunner or(this); - r = addRunner(or, true); + oRunner oR(this); + r = addRunner(oR, true); } } @@ -1048,12 +1048,12 @@ pRunner oEvent::addXMLEntry(const xmlobject &xentry, int clubId, bool setClass) if (!r2) { if ( pid2 > 0) { - oRunner or(this, pid2); - r2 = addRunner(or, true); + oRunner oR(this, pid2); + r2 = addRunner(oR, true); } else { - oRunner or(this); - r2 = addRunner(or, true); + oRunner oR(this); + r2 = addRunner(oR, true); } } diff --git a/code/oListInfo.cpp b/code/oListInfo.cpp index 79fd0c9..9949080 100644 --- a/code/oListInfo.cpp +++ b/code/oListInfo.cpp @@ -1,6 +1,6 @@ /********************i**************************************************** MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 @@ -274,7 +274,7 @@ public: TextInfo ti; HDC hDC = GetDC(gdi.getHWNDTarget()); - for (multimap::iterator it = words.begin(); it != words.end(); ++it) { + for (auto it = words.begin(); it != words.end(); ++it) { ti.xp = 0; ti.yp = 0; ti.format = font; @@ -2436,7 +2436,10 @@ bool oEvent::formatPrintPost(const list &ppli, PrintPostInfo &ppi, else keepNext = true; - limit = max(pp.fixedWidth, limit); + if (pp.useStrictWidth) + limit = max(pp.fixedWidth - 5, 0); // Allow some space + else + limit = max(pp.fixedWidth, limit); assert(limit >= 0); pRunner rr = r; diff --git a/code/oListInfo.h b/code/oListInfo.h index 24f4095..2714c33 100644 --- a/code/oListInfo.h +++ b/code/oListInfo.h @@ -1,7 +1,7 @@ #pragma once /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 @@ -317,6 +317,7 @@ struct oPrintPost { return *this; } int fixedWidth; + bool useStrictWidth = false; // Crop text bool doMergeNext; mutable const oPrintPost *mergeWithTmp; // Merge text with this output }; @@ -595,7 +596,7 @@ public: const set &clsSel, const vector< pair > &typeFormats, gdiFonts font, - const wchar_t *fontFace = 0, + const wchar_t *fontFace = nullptr, bool large = false, int minSize = 0) const; @@ -605,7 +606,7 @@ public: EPostType type, wstring formats, gdiFonts font, - const wchar_t *fontFace = 0, + const wchar_t *fontFace = nullptr, bool large = false, int minSize = 0) const { vector< pair > typeFormats(1, make_pair(type, formats)); diff --git a/code/oPunch.cpp b/code/oPunch.cpp index 69796c6..7246d3a 100644 --- a/code/oPunch.cpp +++ b/code/oPunch.cpp @@ -1,6 +1,6 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/oPunch.h b/code/oPunch.h index 44bcb4e..cdfac98 100644 --- a/code/oPunch.h +++ b/code/oPunch.h @@ -7,7 +7,7 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/oReport.cpp b/code/oReport.cpp index 16bb310..4393bef 100644 --- a/code/oReport.cpp +++ b/code/oReport.cpp @@ -1,6 +1,6 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/oRunner.cpp b/code/oRunner.cpp index a5f27d7..e4b8ffb 100644 --- a/code/oRunner.cpp +++ b/code/oRunner.cpp @@ -1,6 +1,6 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 @@ -1382,7 +1382,7 @@ bool oRunner::evaluateCard(bool doApply, vector & MissingPunches, if (ctrl->Status == oControl::StatusOK) { int code = tp_it->Type; if (expectedPunchCount[code]>1 && punchCount[code] < expectedPunchCount[code]) { - tp_it==Card->punches.end(); + tp_it=Card->punches.end(); ctrl->uncheckNumber(code); break; } @@ -5044,7 +5044,7 @@ void oRunner::printSplits(gdioutput& gdi) const { if (hasInputData()) oe->calculateResults({ getClassId(true) }, oEvent::ResultType::TotalResult); if (tInTeam) - oe->calculateTeamResults({ getClassId(true) }, oEvent::ResultType::ClassResult); + oe->calculateTeamResults(std::set({ getClassId(true) }), oEvent::ResultType::ClassResult); if (withResult && statusOK(true)) { gdi.dropLine(0.5); @@ -5084,6 +5084,7 @@ void oRunner::printSplits(gdioutput& gdi) const { else warning = lang.tl("OK"); gdi.fillRight(); + gdi.pushX(); gdi.addString("", fontSmall, L"Batteristatus:"); gdi.addStringUT(boldSmall, getCard()->getCardVoltage()); gdi.fillDown(); @@ -6083,6 +6084,11 @@ void oEvent::getDBRunnersInEvent(intkeymap &runners) const { __int64 id = it->getExtIdentifier(); if (id != 0) runners.insert(id, it->getId()); + else if (it->getCardNo() != 0) { + // Lookup by card + constant + id = it->getCardNo() + cardIdConstant; + runners.insert(id, it->getId()); + } } } diff --git a/code/oRunner.h b/code/oRunner.h index 120b66d..e0cba87 100644 --- a/code/oRunner.h +++ b/code/oRunner.h @@ -11,7 +11,7 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/oTeam.cpp b/code/oTeam.cpp index 1b18e4c..1c70405 100644 --- a/code/oTeam.cpp +++ b/code/oTeam.cpp @@ -1,6 +1,6 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 @@ -766,13 +766,13 @@ int oTeam::getLegPlace(int leg, bool multidayTotal, bool allowUpdate) const { auto &p = getTeamPlace(leg); if (!multidayTotal) { if (Class && allowUpdate && p.p.isOld(*oe)) { - oe->calculateTeamResults({getClassId(true)}, oEvent::ResultType::ClassResult); + oe->calculateTeamResults(std::set({getClassId(true)}), oEvent::ResultType::ClassResult); } return p.p.get(!allowUpdate); } else { if (Class && allowUpdate && p.totalP.isOld(*oe)) { - oe->calculateTeamResults({ getClassId(true) }, oEvent::ResultType::TotalResult); + oe->calculateTeamResults(std::set({ getClassId(true) }), oEvent::ResultType::TotalResult); } return p.totalP.get(!allowUpdate); } diff --git a/code/oTeam.h b/code/oTeam.h index 6f891fd..5eafd77 100644 --- a/code/oTeam.h +++ b/code/oTeam.h @@ -2,7 +2,7 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 @@ -76,7 +76,7 @@ protected: mutable vector tPlace; - TeamPlace &oTeam::getTeamPlace(int leg) const; + TeamPlace &getTeamPlace(int leg) const; struct ComputedLegResult { int version = -1; diff --git a/code/oTeamEvent.cpp b/code/oTeamEvent.cpp index 23a5724..be16b99 100644 --- a/code/oTeamEvent.cpp +++ b/code/oTeamEvent.cpp @@ -1,6 +1,6 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/oevent_transfer.cpp b/code/oevent_transfer.cpp index c38aea4..ca63ad0 100644 --- a/code/oevent_transfer.cpp +++ b/code/oevent_transfer.cpp @@ -1,6 +1,6 @@ /************************************************************************ MeOS - Orienteering Software -Copyright (C) 2009-2021 Melin Software HB +Copyright (C) 2009-2022 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 diff --git a/code/onlineinput.cpp b/code/onlineinput.cpp index f757799..ec94ad8 100644 --- a/code/onlineinput.cpp +++ b/code/onlineinput.cpp @@ -1,6 +1,6 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 @@ -235,7 +235,7 @@ void OnlineInput::loadMachine(oEvent &oe, const wstring &name) { auto *cnt = oe.getMachineContainer().get(getTypeString(), name); if (!cnt) return; - + AutoMachine::loadMachine(oe, name); url = cnt->getString("url"); cmpId = cnt->getInt("cmpId"); unitId = cnt->getString("unitId"); @@ -246,7 +246,7 @@ void OnlineInput::loadMachine(oEvent &oe, const wstring &name) { specialPunches.clear(); vector pm = cnt->getVectorInt("map"); - for (int j = 0; j + 1 < pm.size(); j+=2) { + for (size_t j = 0; j + 1 < pm.size(); j+=2) { specialPunches[pm[j]] = oPunch::SpecialPunch(pm[j + 1]); } } diff --git a/code/onlineinput.h b/code/onlineinput.h index d0abaa1..642b6b7 100644 --- a/code/onlineinput.h +++ b/code/onlineinput.h @@ -1,7 +1,7 @@ #pragma once /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/onlineresults.cpp b/code/onlineresults.cpp index 10ba61c..0ab6979 100644 --- a/code/onlineresults.cpp +++ b/code/onlineresults.cpp @@ -1,6 +1,6 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 @@ -619,6 +619,7 @@ void OnlineResults::loadMachine(oEvent &oe, const wstring &name) { if (!cnt) return; + AutoMachine::loadMachine(oe, name); file = cnt->getString("file"); url = cnt->getString("url"); prefix = cnt->getString("prefix"); diff --git a/code/onlineresults.h b/code/onlineresults.h index a41788b..8676d31 100644 --- a/code/onlineresults.h +++ b/code/onlineresults.h @@ -1,7 +1,7 @@ #pragma once /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/ospeaker.h b/code/ospeaker.h index 07dfa37..5c233c1 100644 --- a/code/ospeaker.h +++ b/code/ospeaker.h @@ -2,7 +2,7 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/parser.cpp b/code/parser.cpp index a670b6d..6fa1cd9 100644 --- a/code/parser.cpp +++ b/code/parser.cpp @@ -1,6 +1,6 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/parser.h b/code/parser.h index 6d2f360..d3a3964 100644 --- a/code/parser.h +++ b/code/parser.h @@ -2,7 +2,7 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/pdfwriter.cpp b/code/pdfwriter.cpp index 24d8e80..76e7770 100644 --- a/code/pdfwriter.cpp +++ b/code/pdfwriter.cpp @@ -1,6 +1,6 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/pdfwriter.h b/code/pdfwriter.h index 1979526..3f5f858 100644 --- a/code/pdfwriter.h +++ b/code/pdfwriter.h @@ -1,6 +1,6 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/prefseditor.cpp b/code/prefseditor.cpp index 72e92f4..398f7ea 100644 --- a/code/prefseditor.cpp +++ b/code/prefseditor.cpp @@ -1,6 +1,6 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/prefseditor.h b/code/prefseditor.h index ab3c4c2..24ee5e4 100644 --- a/code/prefseditor.h +++ b/code/prefseditor.h @@ -2,7 +2,7 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/printer.cpp b/code/printer.cpp index 2a546bf..555527f 100644 --- a/code/printer.cpp +++ b/code/printer.cpp @@ -1,6 +1,6 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/progress.cpp b/code/progress.cpp index c81eefd..6be67f7 100644 --- a/code/progress.cpp +++ b/code/progress.cpp @@ -1,6 +1,6 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/progress.h b/code/progress.h index b298117..5d73ad8 100644 --- a/code/progress.h +++ b/code/progress.h @@ -1,6 +1,6 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/qualification_final.cpp b/code/qualification_final.cpp index a470c47..f5ac8ac 100644 --- a/code/qualification_final.cpp +++ b/code/qualification_final.cpp @@ -1,6 +1,6 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/qualification_final.h b/code/qualification_final.h index f6102a7..7542d75 100644 --- a/code/qualification_final.h +++ b/code/qualification_final.h @@ -2,7 +2,7 @@ /************************************************************************ MeOS - Orienteering Software -Copyright (C) 2009-2021 Melin Software HB +Copyright (C) 2009-2022 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 diff --git a/code/random.cpp b/code/random.cpp index a5f0a45..d201171 100644 --- a/code/random.cpp +++ b/code/random.cpp @@ -1,6 +1,6 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/random.h b/code/random.h index 24b268b..524e17c 100644 --- a/code/random.h +++ b/code/random.h @@ -1,6 +1,6 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/recorder.cpp b/code/recorder.cpp index 24504e2..8588bac 100644 --- a/code/recorder.cpp +++ b/code/recorder.cpp @@ -1,6 +1,6 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/recorder.h b/code/recorder.h index 10a7ec8..afe8c45 100644 --- a/code/recorder.h +++ b/code/recorder.h @@ -2,7 +2,7 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/restserver.cpp b/code/restserver.cpp index 607a511..b411c6f 100644 --- a/code/restserver.cpp +++ b/code/restserver.cpp @@ -1,6 +1,6 @@ /************************************************************************ MeOS - Orienteering Software -Copyright (C) 2009-2021 Melin Software HB +Copyright (C) 2009-2022 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 diff --git a/code/restserver.h b/code/restserver.h index ee33dda..7993356 100644 --- a/code/restserver.h +++ b/code/restserver.h @@ -2,7 +2,7 @@ /************************************************************************ MeOS - Orienteering Software -Copyright (C) 2009-2021 Melin Software HB +Copyright (C) 2009-2022 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 diff --git a/code/socket.cpp b/code/socket.cpp index 6b4cadc..30f8dd8 100644 --- a/code/socket.cpp +++ b/code/socket.cpp @@ -1,6 +1,6 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/socket.h b/code/socket.h index f657fb2..7724efb 100644 --- a/code/socket.h +++ b/code/socket.h @@ -1,6 +1,6 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/sound/ok.wav b/code/sound/ok.wav index 6ce80c8..b37546d 100644 Binary files a/code/sound/ok.wav and b/code/sound/ok.wav differ diff --git a/code/speakermonitor.cpp b/code/speakermonitor.cpp index aea63c2..43c75c3 100644 --- a/code/speakermonitor.cpp +++ b/code/speakermonitor.cpp @@ -1,6 +1,6 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 @@ -53,7 +53,7 @@ void SpeakerMonitor::setClassFilter(const set &filter, const set &cfil classFilter = filter; controlIdFilter = cfilter; oListInfo li; - maxClassNameWidth = oe.gdiBase().scaleLength(li.getMaxCharWidth(&oe, classFilter, lClassName, L"", normalText, false)); + maxClassNameWidth = oe.gdiBase().scaleLength(li.getMaxCharWidth(&oe, classFilter, EPostType::lClassName, L"", gdiFonts::normalText)); } void SpeakerMonitor::setLimits(int place, int num) { diff --git a/code/speakermonitor.h b/code/speakermonitor.h index ad1b247..7c6a735 100644 --- a/code/speakermonitor.h +++ b/code/speakermonitor.h @@ -1,7 +1,7 @@ #pragma once /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/subcommand.h b/code/subcommand.h index 5ffc61e..08ff787 100644 --- a/code/subcommand.h +++ b/code/subcommand.h @@ -2,7 +2,7 @@ /************************************************************************ MeOS - Orienteering Software -Copyright (C) 2009-2021 Melin Software HB +Copyright (C) 2009-2022 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 diff --git a/code/swedish.lng b/code/swedish.lng index b8ab4e6..f73c25e 100644 --- a/code/swedish.lng +++ b/code/swedish.lng @@ -1321,8 +1321,8 @@ help:59395 = I det här formuläret kan du snabbt göra grundläggande inställn help:59395_more = Klassernas avgifter, som visas om du har aktiverat Ekonomifunktionerna, används för nya deltagare. Ändrar du dem fÃ¥r du en frÃ¥ga om att uppdatera avgifterna för redan anmälda.\n\nFör nummerlapp finns alternativet Ingen, Löpande och Manuell. Du kan ocksÃ¥ skriva in ett första nummerlappsnummer i klassen, t.ex. A100, eller 50. Löpande betyder att sista nummerlappsnummer i föregÃ¥ende klass används för att sätta första nummer i denna klass. Reserverade nummerlappsnummer innebär att ett motsvarande hopp görs i numreringen mellan klasser.\n\nMeOS uppdaterar nummerlappar vid lottning, eller om inställningarna ändras. Manuell betyder att MeOS aldrig automatiskt ändrar klassens nummerlappar.\n\nFör klasser med lag styr inställningen Lagmedlem löparnas nummerlapp i förhÃ¥llande till lagets. De kan vara samma, ökande (100, 101, 102), bero pÃ¥ sträcka (100-1, 100-2, etc.) eller vara helt oberoende. help:7618 = Antalet löpare i laget ställer man in pÃ¥ sidan klasser. help:7620 = Intervall (sekunder). Lämna blankt för att uppdatera när tävlingsdata ändras -help:89064 = Till varje kontroll anger man en eller flera kodsiffror (SI-kod). När man lägger banor refererar man till kontrollens ID-nummer. Man behöver normalt inte själv lägga till kontroller eftersom MeOS automatiskt lägger till de kontroller som används. \n\nFlera kodsiffror är användbart för att ersätta trasiga kontroller eller för att skapa enkla gafflingar. För en vanlig kontroll krävs att löparen besökt en av de angivna kontrollerna. Sätts status till mÃ¥ste löparen besöka samtliga listade kontroller i valfri ordning.\n\nOm man sätter kontrollens status till , kommer den inte att användas i stämplingskontrollen. \n\nEn kontroll kan tilldelas ett namn, t.ex. 'Varvning'. Det gÃ¥r att skriva ut resultatlistor som innehÃ¥ller mellantider för namngivna kontroller.\n\nTidsjustering används om det visar sig att en kontrolls klocka gÃ¥r fel:formatet är +/-MM:SS eller +/-HH:MM:SS.\n\nMinsta sträcktid kan användas exempelvis vid vägpassage. Ingen löpare kan fÃ¥ en bättre sträcktid in mot kontrollen än den angivna tiden. Överskrider löparen den angivna tiden, används löparens faktiska tid.\n\nStatus betyder att löparens tid till kontrollen ignoreras; sluttiden blir densamma oavsett faktisk sträcktid. -help:9373 = Ange en eller flera kodsiffror (SI-kod) som används av den här kontrollen, t.ex. 31, 250. Fältet poäng används för Rogaining-kontroller. +help:89064 = Till varje kontroll anger man en eller flera kodsiffror (SI-kod). När man lägger banor refererar man till kontrollens ID-nummer. Man behöver normalt inte själv lägga till kontroller eftersom MeOS automatiskt lägger till de kontroller som används. \n\nFlera kodsiffror är användbart för att ersätta trasiga kontroller eller för att skapa enkla gafflingar. För en vanlig kontroll krävs att löparen besökt en av de angivna kontrollerna. Sätts status till mÃ¥ste löparen besöka samtliga listade kontroller i valfri ordning.\n\nOm man sätter kontrollens status till , kommer den inte att användas i stämplingskontrollen.\n\nFörsvunnen fungerar som trasig, men dessutom hoppas tidtagning över till nästa kontroll; det spelar ingen roll hur länge man letade efter den försvunna kontrollen.\n\nEn kontroll kan tilldelas ett namn, t.ex. 'Varvning'. Det gÃ¥r att skriva ut resultatlistor som innehÃ¥ller mellantider för namngivna kontroller.\n\nTidsjustering används om det visar sig att en kontrolls klocka gÃ¥r fel:formatet är +/-MM:SS eller +/-HH:MM:SS.\n\nMinsta sträcktid kan användas exempelvis vid vägpassage. Ingen löpare kan fÃ¥ en bättre sträcktid in mot kontrollen än den angivna tiden. Överskrider löparen den angivna tiden, används löparens faktiska tid.\n\nStatus betyder att löparens tid till kontrollen ignoreras; sluttiden blir densamma oavsett faktisk sträcktid. +help:9373 = Ange en eller flera kodsiffror (SI-kod) som används av den här kontrollen, t.ex. 31, 250. help:9615 = Fick inget svar. Ska porten öppnas i passivt läge; ska MeOS lyssna efter inkommande stämplingar? help:assignfee = MeOS hanterar i de flesta fall avgifter automatiskt. Deltagarna tilldelas en anmälningsavgift utifrÃ¥n Ã¥lder och anmälningsdatum (gränser anger du under tävlingsinställningar). Varje klass definierar vilka avgifter som gäller. Standardvärden för olika klasstyper definierar du under tävlingsinställningar, men du kan ocksÃ¥ göra manuella ändringar pÃ¥ sidan klasser, under snabbinställningar.\n\nMed funktionerna här kan du tilldela manuellt filtrera olika Ã¥ldrar och anmälningsfrister och tilldela avgifter. PÃ¥ sidan deltagare kan du ocksÃ¥ manuellt justera enskilda deltagares avgift. help:baudrate = Överföringshastighet/Baudrate: använd 4800 eller 38400. @@ -2574,12 +2574,11 @@ Sparade automater = Sparade automater Spela upp ett ljud för att indikera resultatet av brickavläsningen = Spela upp ett ljud för att indikera resultatet av brickavläsningen Status inte OK (röd utgÃ¥ng) = Status inte OK (röd utgÃ¥ng) help:selectsound = Välj ljudfiler att spela. Är inget valt spelas MeOS inbyggda ljud. -prefsPlaySound = prefsPlaySound -prefsSoundAction = prefsSoundAction -prefsSoundLeader = prefsSoundLeader -prefsSoundNotOK = prefsSoundNotOK -prefsSoundOK = prefsSoundOK -prefsTestPath = prefsTestPath +prefsPlaySound = Spela ljud vid brickavläsning +prefsSoundAction = Ljudfil, Ã¥tgärd krävs +prefsSoundLeader = Ljudfil, ledartid +prefsSoundNotOK = Ljudfil, röd utgÃ¥ng +prefsSoundOK = Ljudfil, status OK Ã…tgärd krävs = Ã…tgärd krävs Alla tidigare etapper = Alla tidigare etapper Dölj = Dölj @@ -2594,3 +2593,7 @@ Testa = Testa Fel: Använd X i texten där värdet (Y) ska sättas in = Fel: Använd X i texten där värdet (Y) ska sättas in info:teamcourseassignment = Den importerade filen innehÃ¥ller gafflingsdata för lag. För att importera gafflingarna mÃ¥ste tävlingen förberedas sÃ¥ den matchar laginformationen i filen: \n\n1. Se till att alla klasser är uppsatta med korrekt antal sträckor.\n2. Ställ in nummerlappsnummer för varje klass. Använd snabbinställningar pÃ¥ sidan klasser för att mata in första nummerlappsnummer i varje klass (automatisk inställning). Alternativt kan du importera lagen och tilldela nummerlappar som vanligt först.\n3. Importera banorna. Du kan importera den här filen flera gÃ¥nger för att uppdatera lottningen. Försvunnen = Försvunnen +Automatnamn = Automatnamn +Använd = Använd +Om du vill kan du namnge automaten = Om du vill kan du namnge automaten +Spara inställningar = Spara inställningar diff --git a/code/testmeos.cpp b/code/testmeos.cpp index 87e7eef..4d5c4d3 100644 --- a/code/testmeos.cpp +++ b/code/testmeos.cpp @@ -1,6 +1,6 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/testmeos.h b/code/testmeos.h index c3f078e..5f94c91 100644 --- a/code/testmeos.h +++ b/code/testmeos.h @@ -2,7 +2,7 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/toolbar.cpp b/code/toolbar.cpp index 5350b6f..74e7da7 100644 --- a/code/toolbar.cpp +++ b/code/toolbar.cpp @@ -1,6 +1,6 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 @@ -213,7 +213,7 @@ void Toolbar::createToolbar(const string &id, const wstring &title) // Tell the toolbar to resize itself, and show it. SendMessage(hwndToolbar, TB_AUTOSIZE, 0, 0); - DWORD bsize = SendMessage(hwndToolbar, TB_GETBUTTONSIZE, 0,0); + LRESULT bsize = SendMessage(hwndToolbar, TB_GETBUTTONSIZE, 0,0); int bw = LOWORD(bsize); int bh = HIWORD(bsize); diff --git a/code/toolbar.h b/code/toolbar.h index b04edea..3f103ad 100644 --- a/code/toolbar.h +++ b/code/toolbar.h @@ -1,6 +1,6 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/xmlparser.cpp b/code/xmlparser.cpp index dfec585..6a42d92 100644 --- a/code/xmlparser.cpp +++ b/code/xmlparser.cpp @@ -1,6 +1,6 @@ /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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 diff --git a/code/xmlparser.h b/code/xmlparser.h index 8c918b4..cdd7c34 100644 --- a/code/xmlparser.h +++ b/code/xmlparser.h @@ -10,7 +10,7 @@ #endif // _MSC_VER > 1000 /************************************************************************ MeOS - Orienteering Software - Copyright (C) 2009-2021 Melin Software HB + Copyright (C) 2009-2022 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