diff --git a/include/lgi/common/TextConvert.h b/include/lgi/common/TextConvert.h --- a/include/lgi/common/TextConvert.h +++ b/include/lgi/common/TextConvert.h @@ -1,15 +1,15 @@ #pragma once bool Is8Bit(const char *Text); -[[deprecated]] char *DecodeBase64Str(char *Str, ssize_t Len = -1); -LString LDecodeBase64Str(LString Str); +[[deprecated]] LgiFunc char *DecodeBase64Str(char *Str, ssize_t Len = -1); +LgiExtern LString LDecodeBase64Str(LString Str); -[[deprecated]] char *DecodeQuotedPrintableStr(char *Str, ssize_t Len = -1); -LString LDecodeQuotedPrintableStr(LString Str); +[[deprecated]] LgiFunc char *DecodeQuotedPrintableStr(char *Str, ssize_t Len = -1); +LgiExtern LString LDecodeQuotedPrintableStr(LString Str); -[[deprecated]] char *DecodeRfc2047(char *Str); -LString LDecodeRfc2047(LString Str); +[[deprecated]] LgiFunc char *DecodeRfc2047(char *Str); +LgiExtern LString LDecodeRfc2047(LString Str); -[[deprecated]] char *EncodeRfc2047(char *Input, const char *InCharset, LString::Array *OutCharsets = NULL, ssize_t LineLength = 0); -LString LEncodeRfc2047(LString Input, const char *InCharset, LString::Array *OutCharsets = NULL, ssize_t LineLength = 0); +[[deprecated]] LgiFunc char *EncodeRfc2047(char *Input, const char *InCharset, LString::Array *OutCharsets = NULL, ssize_t LineLength = 0); +LgiExtern LString LEncodeRfc2047(LString Input, const char *InCharset, LString::Array *OutCharsets = NULL, ssize_t LineLength = 0); diff --git a/src/common/General/DateTime.cpp b/src/common/General/DateTime.cpp --- a/src/common/General/DateTime.cpp +++ b/src/common/General/DateTime.cpp @@ -1,2571 +1,2581 @@ /* ** FILE: LDateTime.cpp ** AUTHOR: Matthew Allen ** DATE: 11/11/98 ** DESCRIPTION: Scribe Date Time Object ** ** Copyright (C) 1998, Matthew Allen ** fret@memecode.com */ #define _DEFAULT_SOURCE #include #include #include #include #include #if defined(MAC) #include #endif #ifdef WINDOWS #include #define timegm _mkgmtime #endif #include "lgi/common/Lgi.h" #include "lgi/common/DateTime.h" #include "lgi/common/DocView.h" constexpr const char *LDateTime::WeekdaysShort[7]; constexpr const char *LDateTime::WeekdaysLong[7]; constexpr const char *LDateTime::MonthsShort[12]; constexpr const char *LDateTime::MonthsLong[12]; #if !defined(WINDOWS) #define MIN_YEAR 1800 #endif #if defined(LINUX) #define USE_ZDUMP 1 #elif defined(HAIKU) #include "lgi/common/TimeZoneInfo.h" #endif #define DEBUG_DST_INFO 0 ////////////////////////////////////////////////////////////////////////////// uint16 LDateTime::DefaultFormat = GDTF_DEFAULT; char LDateTime::DefaultSeparator = '/'; uint16 LDateTime::GetDefaultFormat() { if (DefaultFormat == GDTF_DEFAULT) { #ifdef WIN32 TCHAR s[80] = _T("1"); GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_IDATE, s, CountOf(s)); switch (_tstoi(s)) { case 0: DefaultFormat = GDTF_MONTH_DAY_YEAR; break; default: case 1: DefaultFormat = GDTF_DAY_MONTH_YEAR; break; case 2: DefaultFormat = GDTF_YEAR_MONTH_DAY; break; } GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_ITIME, s, sizeof(s)); if (_tstoi(s) == 1) { DefaultFormat |= GDTF_24HOUR; } else { DefaultFormat |= GDTF_12HOUR; } if (GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SDATE, s, sizeof(s))) DefaultSeparator = (char)s[0]; if (GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SSHORTDATE, s, sizeof(s))) { char Sep[] = { DefaultSeparator, '/', '\\', '-', '.', 0 }; LString Str = s; auto t = Str.SplitDelimit(Sep); for (int i=0; i= low && (v) <= high) bool LDateTime::IsValid() const { return InRange(_Day, 1, 31 ) && InRange(_Year, 1600, 2100) && InRange(_Thousands, 0, 999 ) && InRange(_Month, 1, 12 ) && InRange(_Seconds, 0, 59 ) && InRange(_Minutes, 0, 59 ) && InRange(_Hours, 0, 23 ) && InRange(_Tz, -780, 780 ); } void LDateTime::SetTimeZone(int NewTz, bool ConvertTime) { if (ConvertTime && NewTz != _Tz) AddMinutes(NewTz - _Tz); _Tz = NewTz; } LDateTime::operator struct tm() const { struct tm t = {}; t.tm_year = _Year - 1900; t.tm_mon = _Month - 1; t.tm_mday = _Day; t.tm_hour = _Hours; t.tm_min = _Minutes; t.tm_sec = _Seconds; t.tm_isdst = -1; return t; } #ifdef WINDOWS LDateTime::operator SYSTEMTIME() const { SYSTEMTIME System = {}; System.wYear = _Year; System.wMonth = limit(_Month, 1, 12); System.wDay = limit(_Day, 1, 31); System.wHour = limit(_Hours, 0, 23); System.wMinute = limit(_Minutes, 0, 59); System.wSecond = limit(_Seconds, 0, 59); System.wMilliseconds = limit(_Thousands, 0, 999); System.wDayOfWeek = DayOfWeek(); return System; } LDateTime &LDateTime::operator =(const SYSTEMTIME &st) { _Year = st.wYear; _Month = st.wMonth; _Day = st.wDay; _Hours = st.wHour; _Minutes = st.wMinute; _Seconds = st.wSecond; _Thousands = st.wMilliseconds; return *this; } #endif bool LDateTime::InferTimeZone(bool ConvertTime) { #ifdef WINDOWS SYSTEMTIME System = *this; // Compare the non-year parts of the SYSTEMTIMEs auto SysCmp = [](SYSTEMTIME &a, SYSTEMTIME &b) { #define CMP(name) if (auto d = a.name - b.name) return d; CMP(wMonth); CMP(wDay); CMP(wHour); CMP(wMinute); CMP(wSecond); CMP(wMilliseconds); return 0; }; auto MakeAbsolute = [this](SYSTEMTIME &s) { if (s.wYear == 0) { // Convert from relative to absolute... LDateTime dt = *this; dt.Month(s.wMonth); int days = dt.DaysInMonth(); if (s.wDay == 5) { // Use the final day of the month for (int day = days; day > 0; day--) { dt.Day(day); if (dt.DayOfWeek() == s.wDayOfWeek) break; } s.wDay = dt.Day(); } else if (s.wDay > 0) { // Find the 'wDay'th instance of 'wDayOfWeek' int week = 1; for (int day = 1; day <= days; day++) { dt.Day(day); if (dt.DayOfWeek() == s.wDayOfWeek) { if (week++ == s.wDay) break; } } s.wDay = dt.Day(); } else LAssert(!"unexpected relative date"); } }; // 'System' is currently in 'UTC' but we want the local version of the time, // not in the _Tz timezone, but the effective timezone for that // actual moment in question, which could have a different DST offset. TIME_ZONE_INFORMATION tzi = {}; if (!GetTimeZoneInformationForYear(_Year, NULL, &tzi)) return false; MakeAbsolute(tzi.StandardDate); MakeAbsolute(tzi.DaylightDate); auto order = SysCmp(tzi.DaylightDate, tzi.StandardDate); // order > 0 = DaylightDate is after StandardDate // order < 0 = DaylightDate is before StandardDate LAssert(order != 0); auto a = SysCmp(System, tzi.StandardDate); // a > 0 = System is after StandardDate // a < 0 = System is before StandardDate auto b = SysCmp(System, tzi.DaylightDate); // b > 0 = System is after DaylightDate // b < 0 = System is before DaylightDate int tz = (int16)-tzi.Bias; if (order > 0) { // year is: DST -> Normal -> DST if (a < 0 || b > 0) tz -= (int16)tzi.DaylightBias; } else { // year is: Normal -> DST -> Normal if (a < 0 && b > 0) tz -= (int16)tzi.DaylightBias; } if (ConvertTime) SetTimeZone(tz - _Tz, true); else _Tz = tz; return true; #else - #warning "Impl me." + auto tt = GetUnix(); + auto local = localtime(&tt); + if (!local) + return false; + + auto tz = local->tm_gmtoff / 60; + if (ConvertTime) + SetTimeZone(tz - _Tz, true); + else + _Tz = (int16)tz; + return true; #endif return false; } int LDateTime::SystemTimeZone(bool ForceUpdate) { if (ForceUpdate || CurTz == NO_ZONE) { CurTz = 0; CurTzOff = 0; #ifdef MAC #ifdef LGI_COCOA NSTimeZone *timeZone = [NSTimeZone localTimeZone]; if (timeZone) { NSDate *Now = [NSDate date]; CurTz = (int) [timeZone secondsFromGMTForDate:Now] / 60; CurTzOff = [timeZone daylightSavingTimeOffsetForDate:Now] / 60; CurTz -= CurTzOff; } #elif defined LGI_CARBON CFTimeZoneRef tz = CFTimeZoneCopySystem(); CFAbsoluteTime now = CFAbsoluteTimeGetCurrent(); Boolean dst = CFTimeZoneIsDaylightSavingTime(tz, now); if (dst) { CFAbsoluteTime next = CFTimeZoneGetNextDaylightSavingTimeTransition(tz, now); CurTz = CFTimeZoneGetSecondsFromGMT(tz, next + 100) / 60; } else { CurTz = CFTimeZoneGetSecondsFromGMT(tz, now) / 60; } CurTzOff = CFTimeZoneGetDaylightSavingTimeOffset(tz, now) / 60; CFRelease(tz); #endif #elif defined(WIN32) timeb tbTime; ftime(&tbTime); CurTz = -tbTime.timezone; TIME_ZONE_INFORMATION Tzi; if (GetTimeZoneInformation(&Tzi) == TIME_ZONE_ID_DAYLIGHT) CurTzOff = -Tzi.DaylightBias; #elif defined(LINUX) || defined(HAIKU) int six_months = (365 * 24 * 60 * 60) / 2; time_t now = 0, then = 0; time (&now); then = now - six_months; tm now_tz, then_tz; tm *t = localtime_r(&now, &now_tz); if (t) { localtime_r(&then, &then_tz); CurTz = now_tz.tm_gmtoff / 60; if (now_tz.tm_isdst) { CurTzOff = (now_tz.tm_gmtoff - then_tz.tm_gmtoff) / 60; CurTz = then_tz.tm_gmtoff / 60; } else // This is not DST so there is no offset right? CurTzOff = 0; // (then_tz.tm_gmtoff - now_tz.tm_gmtoff) / 60; } else return NO_ZONE; #else #error "Impl me." #endif } return CurTz + CurTzOff; } int LDateTime::SystemTimeZoneOffset() { if (CurTz == NO_ZONE) SystemTimeZone(); return CurTzOff; } #if defined WIN32 LDateTime ConvertSysTime(SYSTEMTIME &st, int year) { LDateTime n; if (st.wYear) { n.Year(st.wYear); n.Month(st.wMonth); n.Day(st.wDay); } else { n.Year(year); n.Month(st.wMonth); // Find the 'nth' matching weekday, starting from the first day in the month n.Day(1); LDateTime c = n; for (int i=0; iCompare(b); } #elif USE_ZDUMP static bool ParseValue(char *s, LString &var, LString &val) { if (!s) return false; char *e = strchr(s, '='); if (!e) return false; *e++ = 0; var = s; val = e; *e = '='; return var != 0 && val != 0; } #endif /* Testing code... LDateTime Start, End; LArray Info; Start.Set("1/1/2010"); End.Set("31/12/2014"); LDateTime::GetDaylightSavingsInfo(Info, Start, &End); LStringPipe p; for (int i=0; i,int> { MonthHash() { for (int i=0; i &Info, LDateTime &Start, LDateTime *End) { bool Status = false; #if defined(WIN32) TIME_ZONE_INFORMATION Tzi; auto r = GetTimeZoneInformation(&Tzi); if (r > TIME_ZONE_ID_UNKNOWN) { Info.Length(0); // Find the dates for the previous year from Start. This allows // us to cover the start of the current year. LDateTime s = ConvertSysTime(Tzi.StandardDate, Start.Year() - 1); LDateTime d = ConvertSysTime(Tzi.DaylightDate, Start.Year() - 1); // Create initial Info entry, as the last change in the previous year auto *i = &Info.New(); if (s < d) { // Year is: Daylight->Standard->Daylight LDateTime tmp = d; i->Offset = -(Tzi.Bias + Tzi.DaylightBias); tmp.AddMinutes(-i->Offset); i->Utc = tmp; } else { // Year is: Standard->Daylight->Standard LDateTime tmp = s; i->Offset = -(Tzi.Bias + Tzi.StandardBias); tmp.AddMinutes(-i->Offset); i->Utc = tmp; } for (auto y=Start.Year(); y<=(End?End->Year():Start.Year()); y++) { if (s < d) { // Cur year, first event: end of DST i = &Info.New(); auto tmp = ConvertSysTime(Tzi.StandardDate, y); i->Offset = -(Tzi.Bias + Tzi.StandardBias); tmp.AddMinutes(-i->Offset); i->Utc = tmp; // Cur year, second event: start of DST i = &Info.New(); tmp = ConvertSysTime(Tzi.DaylightDate, y); i->Offset = -(Tzi.Bias + Tzi.DaylightBias); tmp.AddMinutes(-i->Offset); i->Utc = tmp; } else { // Cur year, first event: start of DST i = &Info.New(); auto tmp = ConvertSysTime(Tzi.DaylightDate, Start.Year()); i->Offset = -(Tzi.Bias + Tzi.DaylightBias); tmp.AddMinutes(-i->Offset); i->Utc = tmp; // Cur year, second event: end of DST i = &Info.New(); tmp = ConvertSysTime(Tzi.StandardDate, Start.Year()); i->Offset = -(Tzi.Bias + Tzi.StandardBias); tmp.AddMinutes(-i->Offset); i->Utc = tmp; } } Status = true; } #elif defined(MAC) LDateTime From = Start; From.AddMonths(-6); LDateTime To = End ? *End : Start; To.AddMonths(6); auto ToUnix = To.GetUnix(); auto tz = [NSTimeZone systemTimeZone]; - auto startDate = [[NSDate alloc] initWithTimeIntervalSince1970:(From.Ts() / Second64Bit) - Offset1800]; + auto startDate = [[NSDate alloc] initWithTimeIntervalSince1970:(From.Ts().Get() / Second64Bit) - Offset1800]; while (startDate) { auto next = [tz nextDaylightSavingTimeTransitionAfterDate:startDate]; auto &i = Info.New(); auto nextTs = [next timeIntervalSince1970]; - i.UtcTimeStamp = (nextTs + Offset1800) * Second64Bit; + i.Utc = (nextTs + Offset1800) * Second64Bit; i.Offset = (int)([tz secondsFromGMTForDate:[next dateByAddingTimeInterval:60]]/60); #if DEBUG_DST_INFO { LDateTime dt; dt.Set(i.UtcTimeStamp); LgiTrace("%s:%i - Ts=%s Off=%i\n", _FL, dt.Get().Get(), i.Offset); } #endif if (nextTs >= ToUnix) break; [startDate release]; startDate = next; } if (startDate) [startDate release]; #elif USE_ZDUMP if (!Zdump.Length()) { static bool First = true; auto linkLoc = "/etc/localtime"; #if defined(LINUX) auto zoneLoc = "/usr/share/zoneinfo"; #elif defined(HAIKU) auto zoneLoc = "/boot/system/data/zoneinfo"; #else #error "Impl me" #endif if (!LFileExists(linkLoc)) { if (First) { LgiTrace("%s:%i - LDateTime::GetDaylightSavingsInfo error: '%s' doesn't exist.\n" " It should link to something in the '%s' tree.\n", _FL, linkLoc, zoneLoc); #ifdef HAIKU LgiTrace(" To fix that: pkgman install timezone_data and then create the '%s' link.\n", linkLoc); #endif } return First = false; } auto f = popen(LString::Fmt("zdump -v %s", linkLoc), "r"); if (f) { char s[1024]; size_t r; LStringPipe p(1024); while ((r = fread(s, 1, sizeof(s), f)) > 0) p.Write(s, (int)r); fclose(f); Zdump = p.NewLStr().Split("\n"); } else { if (First) { LgiTrace("%s:%i - LDateTime::GetDaylightSavingsInfo error: zdump didn't run.\n", _FL); #ifdef HAIKU LgiTrace("To fix that: pkgman install timezone_data\n"); #endif } return First = false; } } MonthHash Lut; LDateTime Prev; int PrevOff = 0; for (auto Line: Zdump) { auto l = Line.SplitDelimit(" \t"); if (l.Length() >= 16 && l[0].Equals("/etc/localtime")) { // /etc/localtime Sat Oct 3 15:59:59 2037 UTC = Sun Oct 4 01:59:59 2037 EST isdst=0 gmtoff=36000 // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 LDateTime Utc; Utc.Year(l[5].Int()); #if DEBUG_DST_INFO if (Utc.Year() < 2020) continue; // printf("DST: %s\n", Line.Get()); #endif auto Tm = l[4].SplitDelimit(":"); if (Tm.Length() != 3) { #if DEBUG_DST_INFO printf("%s:%i - Tm '%s' has wrong parts: %s\n", _FL, l[4].Get(), Line.Get()); #endif continue; } Utc.Hours(Tm[0].Int()); Utc.Minutes(Tm[1].Int()); Utc.Seconds(Tm[2].Int()); if (Utc.Minutes() < 0) { #if DEBUG_DST_INFO printf("%s:%i - Mins is zero: %s\n", _FL, l[4].Get()); #endif continue; } int m = Lut.Find(l[2]); if (!m) { #if DEBUG_DST_INFO printf("%s:%i - Unknown month '%s'\n", _FL, l[2].Get()); #endif continue; } Utc.Day(l[3].Int()); Utc.Month(m); LString Var, Val; if (!ParseValue(l[14], Var, Val) || Var != "isdst") { #if DEBUG_DST_INFO printf("%s:%i - Unknown value for isdst\n", _FL); #endif continue; } if (!ParseValue(l[15], Var, Val) || Var != "gmtoff") { #if DEBUG_DST_INFO printf("%s:%i - Unknown value for isdst\n", _FL); #endif continue; } int Off = atoi(Val) / 60; if (Utc.Ts().Valid() == 0) continue; if (Prev.Year() && Prev < Start && Start < Utc) { // Emit initial entry for 'start' auto &inf = Info.New(); Prev.Get(inf.Utc); inf.Offset = PrevOff; #if DEBUG_DST_INFO printf("Info: Start=%s %i\n", Prev.Get().Get(), inf.Offset); #endif } if (Utc > Start) { // Emit furthur entries for DST events between start and end. auto &inf = Info.New(); Utc.Get(inf.Utc); inf.Offset = Off; #if DEBUG_DST_INFO printf("Info: Next=%s %i\n", Utc.Get().Get(), inf.Offset); #endif if (End && Utc > *End) { // printf("Utc after end: %s > %s\n", Utc.Get().Get(), End->Get().Get()); break; } } Prev = Utc; PrevOff = Off; } } Status = Info.Length() > 1; #elif defined(HAIKU) LTimeZoneInfo tzinfo; if (!tzinfo.Read()) { #if DEBUG_DST_INFO LgiTrace("%s:%i - info read failed.\n", _FL); #endif return false; } Status = tzinfo.GetDaylightSavingsInfo(Info, Start, End); #if DEBUG_DST_INFO if (!Status) printf("%s:%i - GetDaylightSavingsInfo failed.\n", _FL); #endif #else LAssert(!"Not implemented."); #endif return Status; } bool LDateTime::DstToLocal(LArray &Dst, LDateTime &dt) { if (dt.GetTimeZone()) { LAssert(!"Should be a UTC date."); return true; } #if DEBUG_DST_INFO LgiTrace("DstToLocal: %s\n", dt.Get().Get()); #endif LAssert(Dst.Length() > 1); // Needs to have at least 2 entries...? for (size_t i=0; i= start && dt < end; if (InRange) { dt.SetTimeZone(a.Offset, true); #if DEBUG_DST_INFO LgiTrace("\tRng[%i]: %s -> %s, SetTimeZone(%g), dt=%s\n", (int)i, start.Get().Get(), end.Get().Get(), (double)a.Offset/60.0, dt.Get().Get()); #endif return true; } } auto Last = Dst.Last(); LDateTime d; d.Set(Last.Utc); if (dt >= d && dt.Year() == d.Year()) { // If it's after the last DST change but in the same year... it's ok... // Just use the last offset. dt.SetTimeZone(Last.Offset, true); return true; } #if DEBUG_DST_INFO for (auto d: Dst) LgiTrace("Dst: %s = %i\n", d.GetLocal().Get().Get(), d.Offset); #endif LgiTrace("%s:%i - No valid DST range for: %s\n", _FL, dt.Get().Get()); LAssert(!"No valid DST range for this date."); return false; } int LDateTime::DayOfWeek() const { int Index = 0; int Day = IsLeapYear() ? 29 : 28; switch (_Year / 100) { case 19: { Index = 3; break; } case 20: { Index = 2; break; } } // get year right int y = _Year % 100; int r = y % 12; Index = (Index + (y / 12) + r + (r / 4)) % 7; // get month right if (_Month % 2 == 0) { // even month if (_Month > 2) Day = _Month; } else { // odd month switch (_Month) { case 1: { Day = 31; if (IsLeapYear()) { Index = Index > 0 ? Index - 1 : Index + 6; } break; } case 11: case 3: { Day = 7; break; } case 5: { Day = 9; break; } case 7: { Day = 11; break; } case 9: { Day = 5; break; } } } // get day right int Diff = Index - (Day - _Day); while (Diff < 0) Diff += 7; return Diff % 7; } LDateTime LDateTime::Now() { LDateTime dt; dt.SetNow(); return dt; } LDateTime &LDateTime::SetNow() { #ifdef WIN32 SYSTEMTIME stNow; auto sysTz = SystemTimeZone(); if (_Tz == sysTz) GetLocalTime(&stNow); else GetSystemTime(&stNow); #if 1 *this = stNow; if (_Tz && _Tz != sysTz) { // Adjust to this objects timezone... auto tz = _Tz; _Tz = 0; SetTimeZone(tz, true); } #else // This is actually less efficient. FILETIME ftNow; SystemTimeToFileTime(&stNow, &ftNow); uint64 i64 = ((uint64)ftNow.dwHighDateTime << 32) | ftNow.dwLowDateTime; OsTime(i64); #endif #else time_t now; time(&now); struct tm *time = localtime(&now); if (time) *this = time; #ifndef LGI_STATIC else { LgiTrace("%s:%i - Error: localtime failed, now=%u\n", _FL, now); } #endif #endif return *this; } #define Convert24HrTo12Hr(h) ( (h) == 0 ? 12 : (h) > 12 ? (h) % 12 : (h) ) #define Convert24HrToAmPm(h) ( (h) >= 12 ? "p" : "a" ) LString LDateTime::GetDate() const { char s[32]; int Ch = GetDate(s, sizeof(s)); return LString(s, Ch); } int LDateTime::GetDate(char *Str, size_t SLen) const { int Ch = 0; if (Str && SLen > 0) { switch (_Format & GDTF_DATE_MASK) { case GDTF_MONTH_DAY_YEAR: Ch += sprintf_s(Str+Ch, SLen-Ch, _Format&GDTF_MONTH_LEADINGZ?"%2.2i" :"%i" , _Month); Ch += sprintf_s(Str+Ch, SLen-Ch, _Format&GDTF_DAY_LEADINGZ ?"%c%2.2i":"%c%i", DefaultSeparator, _Day); Ch += sprintf_s(Str+Ch, SLen-Ch, "%c%i", DefaultSeparator, _Year); break; default: case GDTF_DAY_MONTH_YEAR: Ch += sprintf_s(Str+Ch, SLen-Ch, _Format&GDTF_DAY_LEADINGZ ?"%2.2i" :"%i" , _Day); Ch += sprintf_s(Str+Ch, SLen-Ch, _Format&GDTF_MONTH_LEADINGZ?"%c%2.2i":"%c%i", DefaultSeparator, _Month); Ch += sprintf_s(Str+Ch, SLen-Ch, "%c%i", DefaultSeparator, _Year); break; case GDTF_YEAR_MONTH_DAY: Ch += sprintf_s(Str+Ch, SLen-Ch, "%i", _Year); Ch += sprintf_s(Str+Ch, SLen-Ch, _Format&GDTF_MONTH_LEADINGZ?"%c%2.2i":"%c%i", DefaultSeparator, _Month); Ch += sprintf_s(Str+Ch, SLen-Ch, _Format&GDTF_DAY_LEADINGZ ?"%c%2.2i":"%c%i", DefaultSeparator, _Day); break; } } return Ch; } LString LDateTime::GetTime() const { char s[32]; int Ch = GetTime(s, sizeof(s)); return LString(s, Ch); } int LDateTime::GetTime(char *Str, size_t SLen) const { int Ch = 0; if (Str && SLen > 0) { switch (_Format & GDTF_TIME_MASK) { case GDTF_12HOUR: default: { Ch += sprintf_s(Str, SLen, "%i:%2.2i:%2.2i%s", Convert24HrTo12Hr(_Hours), _Minutes, _Seconds, Convert24HrToAmPm(_Hours)); break; } case GDTF_24HOUR: { Ch += sprintf_s(Str, SLen, "%i:%2.2i:%2.2i", _Hours, _Minutes, _Seconds); break; } } } return Ch; } LTimeStamp LDateTime::Ts() const { LTimeStamp ts; Get(ts); return ts; } time_t LDateTime::GetUnix() { /* This isn't unit time? LTimeStamp s; Get(s); #if defined(WINDOWS) return s.Get() / LDateTime::Second64Bit / 116445168000000000LL; #else return s.Get() / LDateTime::Second64Bit - Offset1800; #endif */ struct tm t = *this; time_t tt = timegm(&t); if (_Tz) tt -= _Tz * 60; return tt; } bool LDateTime::SetUnix(time_t tt) { /* This isn't unit time? #if defined(WINDOWS) return Set(s * LDateTime::Second64Bit + 116445168000000000LL); #else return Set((s + Offset1800) * LDateTime::Second64Bit); #endif */ struct tm *t; if (_Tz) tt += _Tz * 60; #if !defined(_MSC_VER) || _MSC_VER < _MSC_VER_VS2005 t = gmtime(&tt); if (t) #else struct tm tmp; if (_gmtime64_s(t = &tmp, &tt) == 0) #endif { return Set(t, false); } return false; } bool LDateTime::Set(const LTimeStamp &s) { #if defined WIN32 return OsTime(s.Get()); #else - Set(s.Unix()); + SetUnix(s.Unix()); _Thousands = s.Get() % Second64Bit; return true; #endif } bool LDateTime::Set(struct tm *t, bool inferTimezone) { if (!t) return false; _Year = t->tm_year + 1900; _Month = t->tm_mon + 1; _Day = t->tm_mday; _Hours = t->tm_hour; _Minutes = t->tm_min; _Seconds = t->tm_sec; _Thousands = 0; if (inferTimezone) { auto diff = timegm(t) - mktime(t); _Tz = (int16)(diff / 60); } return true; } uint64_t LDateTime::OsTime() const { #ifdef WINDOWS FILETIME Utc; SYSTEMTIME System = *this; if (SystemTimeToFileTime(&System, &Utc)) { uint64_t s = ((uint64_t)Utc.dwHighDateTime << 32) | Utc.dwLowDateTime; if (_Tz) // Adjust for timezone s -= (int64)_Tz * 60 * Second64Bit; return s; } else { DWORD Err = GetLastError(); LAssert(!"SystemTimeToFileTime failed."); } #else if (_Year < MIN_YEAR) return 0; struct tm t; ZeroObj(t); t.tm_year = _Year - 1900; t.tm_mon = _Month - 1; t.tm_mday = _Day; t.tm_hour = _Hours; t.tm_min = _Minutes; t.tm_sec = _Seconds; t.tm_isdst = -1; time_t sec = timegm(&t); if (sec == -1) return 0; if (_Tz) { // Adjust the output to UTC from the current timezone. sec -= _Tz * 60; } return sec; #endif return 0; } bool LDateTime::OsTime(uint64_t ts) { #ifdef WINDOWS if (_Tz) // Adjust for timezone ts += (int64)_Tz * 60 * Second64Bit; FILETIME Utc; Utc.dwHighDateTime = ts >> 32; Utc.dwLowDateTime = ts & 0xffffffff; SYSTEMTIME System; if (!FileTimeToSystemTime(&Utc, &System)) { DWORD Err = GetLastError(); LAssert(!"FileTimeToSystemTime failed."); return false; } *this = System; return true; #else return SetUnix((time_t)ts); #endif } bool LDateTime::Get(LTimeStamp &s) const { #ifdef WINDOWS if (!IsValid()) { LAssert(!"Needs a valid date."); return false; } s.Ref() = OsTime(); if (!s.Valid()) return false; return true; #else if (_Year < MIN_YEAR) return false; auto sec = OsTime(); s.Ref() = (uint64)(sec + Offset1800) * Second64Bit + _Thousands; return true; #endif } LString LDateTime::Get() const { char buf[32]; int Ch = GetDate(buf, sizeof(buf)); buf[Ch++] = ' '; Ch += GetTime(buf+Ch, sizeof(buf)-Ch); return LString(buf, Ch); } void LDateTime::Get(char *Str, size_t SLen) const { if (Str) { GetDate(Str, SLen); size_t len = strlen(Str); if (len < SLen - 1) { Str[len++] = ' '; GetTime(Str+len, SLen-len); } } } bool LDateTime::Set(const char *Str) { if (!Str) return false; if (Strlen(Str) > 100) return false; char Local[256]; strcpy_s(Local, sizeof(Local), Str); char *Sep = strchr(Local, ' '); if (Sep) { *Sep++ = 0; if (!SetTime(Sep)) return false; } if (!SetDate(Local)) return false; return true; } void LDateTime::Month(char *m) { int i = IsMonth(m); if (i >= 0) _Month = i + 1; } int DateComponent(const char *s) { int64 i = Atoi(s); return i ? (int)i : LDateTime::IsMonth(s); } bool LDateTime::SetDate(const char *Str) { bool Status = false; if (Str) { auto T = LString(Str).SplitDelimit("/-.,_\\"); if (T.Length() == 3) { int i[3] = { DateComponent(T[0]), DateComponent(T[1]), DateComponent(T[2]) }; int fmt = _Format & GDTF_DATE_MASK; // Do some guessing / overrides. // Don't let _Format define the format completely. if (i[0] > 1000) { fmt = GDTF_YEAR_MONTH_DAY; } else if (i[2] > 1000) { if (i[0] > 12) fmt = GDTF_DAY_MONTH_YEAR; else if (i[1] > 12) fmt = GDTF_MONTH_DAY_YEAR; } switch (fmt) { case GDTF_MONTH_DAY_YEAR: { _Month = i[0]; _Day = i[1]; _Year = i[2]; break; } case GDTF_DAY_MONTH_YEAR: { _Day = i[0]; _Month = i[1]; _Year = i[2]; break; } case GDTF_YEAR_MONTH_DAY: { _Year = i[0]; _Month = i[1]; _Day = i[2]; break; } default: { _Year = i[2]; if ((DefaultFormat & GDTF_DATE_MASK) == GDTF_MONTH_DAY_YEAR) { // Assume m/d/yyyy _Day = i[1]; _Month = i[0]; } else { // Who knows??? // Assume d/m/yyyy _Day = i[0]; _Month = i[1]; } break; } } if (_Year < 100) { LAssert(_Day < 1000 && _Month < 1000); if (_Year >= 80) _Year += 1900; else _Year += 2000; } Status = true; } else { // Fall back to fuzzy matching auto T = LString(Str).SplitDelimit(" ,"); MonthHash Lut; int FMonth = 0; int FDay = 0; int FYear = 0; for (unsigned i=0; i 0) { if (i >= 1000) { FYear = i; } else if (i < 32) { FDay = i; } } } else { int i = Lut.Find(p); if (i) FMonth = i; } } if (FMonth && FDay) { Day(FDay); Month(FMonth); } if (FYear) { Year(FYear); } else { LDateTime Now; Now.SetNow(); Year(Now.Year()); } } } return Status; } bool LDateTime::SetTime(const char *Str) { if (!Str) return false; auto T = LString(Str).SplitDelimit(":."); if (T.Length() < 2 || T.Length() > 4) return false; #define SetClamp(out, in, minVal, maxVal) \ out = (int)Atoi(in.Get(), 10, 0); \ if (out > maxVal) out = maxVal; \ else if (out < minVal) out = minVal SetClamp(_Hours, T[0], 0, 23); SetClamp(_Minutes, T[1], 0, 59); SetClamp(_Seconds, T[2], 0, 59); _Thousands = 0; const char *s = T.Last(); if (s) { if (strchr(s, 'p') || strchr(s, 'P')) { if (_Hours != 12) _Hours += 12; } else if (strchr(s, 'a') || strchr(s, 'A')) { if (_Hours == 12) _Hours -= 12; } } if (T.Length() > 3) { LString t = "0."; t += s; _Thousands = (int) (t.Float() * 1000); } return true; } int LDateTime::IsWeekDay(const char *s) { for (unsigned n=0; n= 4) { Year((int)t[0].Int()); Month((int)t[1].Int()); Day((int)t[2].Int()); } else if (t[2].Length() >= 4) { Day((int)t[0].Int()); Month((int)t[1].Int()); Year((int)t[2].Int()); } else { LAssert(!"Unknown date format?"); return false; } } } else if (a[i].Length() == 4) Year((int)a[i].Int()); else if (!Day()) Day((int)a[i].Int()); } else if (IsAlpha(*c)) { int WkDay = IsWeekDay(c); if (WkDay >= 0) continue; int Mnth = IsMonth(c); if (Mnth >= 0) Month(Mnth + 1); } else if (*c == '-' || *c == '+') { c++; if (strlen(c) == 4) { // Timezone.. int64 Tz = a[i].Int(); int Hrs = (int) (Tz / 100); int Min = (int) (Tz % 100); SetTimeZone(Hrs * 60 + Min, false); } } } return IsValid(); } int LDateTime::Sizeof() { return sizeof(int) * 7; } bool LDateTime::Serialize(LFile &f, bool Write) { int32 i; if (Write) { #define wf(fld) i = fld; f << i; wf(_Day); wf(_Month); wf(_Year); wf(_Thousands); wf(_Seconds); wf(_Minutes); wf(_Hours); } else { #define rf(fld) f >> i; fld = i; rf(_Day); rf(_Month); rf(_Year); rf(_Thousands); rf(_Seconds); rf(_Minutes); rf(_Hours); } return true; } /* bool LDateTime::Serialize(ObjProperties *Props, char *Name, bool Write) { #ifndef LGI_STATIC if (Props && Name) { struct _Date { uint8_t Day; uint8_t Month; int16_t Year; uint8_t Hour; uint8_t Minute; uint16_t ThouSec; }; LAssert(sizeof(_Date) == 8); if (Write) { _Date d; d.Day = _Day; d.Month = _Month; d.Year = _Year; d.Hour = _Hours; d.Minute = _Minutes; d.ThouSec = (_Seconds * 1000) + _Thousands; return Props->Set(Name, &d, sizeof(d)); } else // Read { void *Ptr; int Len; if (Props->Get(Name, Ptr, Len) && sizeof(_Date) == Len) { _Date *d = (_Date*) Ptr; _Day = d->Day; _Month = d->Month; _Year = d->Year; _Hours = d->Hour; _Minutes = d->Minute; _Seconds = d->ThouSec / 1000; _Thousands = d->ThouSec % 1000; return true; } } } #endif return false; } */ int LDateTime::Compare(const LDateTime *Date) const { // this - *Date auto ThisTs = IsValid() ? Ts() : LTimeStamp(); auto DateTs = Date->IsValid() ? Date->Ts() : LTimeStamp(); if (ThisTs.Get() & 0x800000000000000) { Get(ThisTs); } // If these ever fire, the cast to int64_t will overflow LAssert((ThisTs.Get() & 0x800000000000000) == 0); LAssert((DateTs.Get() & 0x800000000000000) == 0); auto Diff = ThisTs - DateTs; if (Diff < 0) return -1; return Diff > 0 ? 1 : 0; } #define DATETIME_OP(op) \ bool LDateTime::operator op(const LDateTime &dt) const \ { \ auto a = Ts(); \ auto b = dt.Ts(); \ return a op b; \ } DATETIME_OP(<) DATETIME_OP(<=) DATETIME_OP(>) DATETIME_OP(>=) bool LDateTime::operator ==(const LDateTime &dt) const { return _Year == dt._Year && _Month == dt._Month && _Day == dt._Day && _Hours == dt._Hours && _Minutes == dt._Minutes && _Seconds == dt._Seconds && _Thousands == dt._Thousands; } bool LDateTime::operator !=(const LDateTime &dt) const { return _Year != dt._Year || _Month != dt._Month || _Day != dt._Day || _Hours != dt._Hours || _Minutes != dt._Minutes || _Seconds != dt._Seconds || _Thousands != dt._Thousands; } int LDateTime::DiffMonths(const LDateTime &dt) { int a = (Year() * 12) + Month(); int b = (dt.Year() * 12) + dt.Month(); return b - a; } LDateTime LDateTime::operator -(const LDateTime &dt) { LTimeStamp a, b; Get(a); dt.Get(b); /// Resolution of a second when using 64 bit timestamps int64 Sec = Second64Bit; int64 Min = 60 * Sec; int64 Hr = 60 * Min; int64 Day = 24 * Hr; int64 d = (int64)a.Get() - (int64)b.Get(); LDateTime r; r._Day = (int16) (d / Day); d -= r._Day * Day; r._Hours = (int16) (d / Hr); d -= r._Hours * Hr; r._Minutes = (int16) (d / Min); d -= r._Minutes * Min; r._Seconds = (int16) (d / Sec); #ifdef WIN32 d -= r._Seconds * Sec; r._Thousands = (int16) (d / 10000); #else r._Thousands = 0; #endif return r; } LDateTime LDateTime::operator +(const LDateTime &dt) { LDateTime s = *this; s.AddMonths(dt.Month()); s.AddDays(dt.Day()); s.AddHours(dt.Hours()); s.AddMinutes(dt.Minutes()); // s.AddSeconds(dt.Seconds()); return s; } LDateTime &LDateTime::operator =(const LDateTime &t) { _Day = t._Day; _Year = t._Year; _Thousands = t._Thousands; _Month = t._Month; _Seconds = t._Seconds; _Minutes = t._Minutes; _Hours = t._Hours; _Tz = t._Tz; _Format = t._Format; return *this; } LDateTime &LDateTime::operator =(struct tm *time) { if (time) { _Seconds = time->tm_sec; _Minutes = time->tm_min; _Hours = time->tm_hour; _Day = time->tm_mday; _Month = time->tm_mon + 1; _Year = time->tm_year + 1900; } else Empty(); return *this; } bool LDateTime::IsSameDay(LDateTime &d) const { return Day() == d.Day() && Month() == d.Month() && Year() == d.Year(); } bool LDateTime::IsSameMonth(LDateTime &d) const { return Day() == d.Day() && Month() == d.Month(); } bool LDateTime::IsSameYear(LDateTime &d) const { return Year() == d.Year(); } LDateTime LDateTime::StartOfDay() const { LDateTime dt = *this; dt.Hours(0); dt.Minutes(0); dt.Seconds(0); dt.Thousands(0); return dt; } LDateTime LDateTime::EndOfDay() const { LDateTime dt = *this; dt.Hours(23); dt.Minutes(59); dt.Seconds(59); dt.Thousands(999); return dt; } bool LDateTime::IsLeapYear(int Year) const { if (Year < 0) Year = _Year; if (Year % 4 != 0) return false; if (Year % 400 == 0) return true; if (Year % 100 == 0) return false; return true; } int LDateTime::DaysInMonth() const { if (_Month == 2 && IsLeapYear()) { return 29; } short DaysInMonth[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; return _Month >= 1 && _Month <= 12 ? DaysInMonth[_Month-1] : 0; } void LDateTime::AddSeconds(int64 Seconds) { LTimeStamp i; if (Get(i)) { i.Ref() += Seconds * Second64Bit; Set(i); } } void LDateTime::AddMinutes(int64 Minutes) { LTimeStamp i; if (Get(i)) { int64 delta = Minutes * 60 * Second64Bit; i.Ref() += delta; Set(i); } } void LDateTime::AddHours(int64 Hours) { LTimeStamp i; if (Get(i)) { i.Ref() += Hours * HourLength * Second64Bit; Set(i); } } bool LDateTime::AddDays(int64 Days) { if (!Days) return true; LTimeStamp Ts; if (!Get(Ts)) return false; Ts.Ref() += Days * LDateTime::DayLength * Second64Bit; bool b = Set(Ts); return b; } void LDateTime::AddMonths(int64 Months) { int64 m = _Month + Months; do { if (m < 1) { _Year--; m += 12; } else if (m > 12) { _Year++; m -= 12; } else { break; } } while (1); _Month = (int16) m; if (_Day > DaysInMonth()) _Day = DaysInMonth(); } LString LDateTime::DescribePeriod(double seconds) { int mins = (int) (seconds / 60); seconds -= mins * 60; int hrs = mins / 60; mins -= hrs * 60; int days = hrs / 24; hrs -= days * 24; LString s; if (days > 0) s.Printf("%id %ih %im %is", days, hrs, mins, (int)seconds); else if (hrs > 0) s.Printf("%ih %im %is", hrs, mins, (int)seconds); else if (mins > 0) s.Printf("%im %is", mins, (int)seconds); else s.Printf("%is", (int)seconds); return s; } LString LDateTime::DescribePeriod(LDateTime to) { auto ThisTs = Ts(); auto ToTs = to.Ts(); auto diff = ThisTs < ToTs ? ToTs - ThisTs : ThisTs - ToTs; auto seconds = (double)diff / LDateTime::Second64Bit; return DescribePeriod(seconds); } int LDateTime::MonthFromName(const char *Name) { if (Name) { for (int m=0; m<12; m++) { if (strnicmp(Name, MonthsShort[m], strlen(MonthsShort[m])) == 0) { return m + 1; break; } } } return -1; } bool LDateTime::Decode(const char *In) { // Test data: // // Tue, 6 Dec 2005 1:25:32 -0800 Empty(); if (!In) { LAssert(0); return false; } bool Status = false; // Tokenize delimited by whitespace LString::Array T = LString(In).SplitDelimit(", \t\r\n"); if (T.Length() < 2) { if (T[0].IsNumeric()) { // Some sort of timestamp? uint64_t Ts = Atoi(T[0].Get()); if (Ts > 0) { return SetUnix(Ts); } else return false; } else { // What now? return false; } } else { bool GotDate = false; for (unsigned i=0; i 31) { // Y/M/D? Year((int)Date[0].Int()); Day((int)Date[2].Int()); } else if (Date[2].Int() > 31) { // D/M/Y? Day((int)Date[0].Int()); Year((int)Date[2].Int()); } else { // Ambiguous year... bool YrFirst = true; if (Date[0].Length() == 1) YrFirst = false; // else we really can't tell.. just go with year first if (YrFirst) { Year((int)Date[0].Int()); Day((int)Date[2].Int()); } else { Day((int)Date[0].Int()); Year((int)Date[2].Int()); } LDateTime Now; Now.SetNow(); if (Year() + 2000 <= Now.Year()) Year(2000 + Year()); else Year(1900 + Year()); } if (Date[1].IsNumeric()) Month((int)Date[1].Int()); else { int m = MonthFromName(Date[1]); if (m > 0) Month(m); } GotDate = true; Status = true; } else if (s.Find(":") >= 0) { // whole time // Do some validation bool Valid = true; for (char *c = s; *c && Valid; c++) { if (!(IsDigit(*c) || *c == ':')) Valid = false; } if (Valid) { LString::Array Time = s.Split(":"); if (Time.Length() == 2 || Time.Length() == 3) { // Hour int i = (int) Time[0].Int(); if (i >= 0) Hours(i); if (s.Lower().Find("p") >= 0) { if (Hours() < 12) Hours(Hours() + 12); } // Minute i = (int) Time[1].Int(); if (i >= 0) Minutes(i); if (Time.Length() == 3) { // Second i = (int) Time[2].Int(); if (i >= 0) Seconds(i); } Status = true; } } } else if (IsAlpha(s(0))) { // text int m = MonthFromName(s); if (m > 0) Month(m); } else if (strchr("+-", *s)) { // timezone DoTimeZone: LDateTime Now; double OurTmz = (double)Now.SystemTimeZone() / 60; if (s && strchr("-+", *s) && strlen(s) == 5) { #if 1 int i = atoi(s); int hr = i / 100; int min = i % 100; SetTimeZone(hr * 60 + min, false); #else // adjust for timezone char Buf[32]; memcpy(Buf, s, 3); Buf[3] = 0; double TheirTmz = atof(Buf); memcpy(Buf+1, s + 3, 2); TheirTmz += (atof(Buf) / 60); if (Tz) { *Tz = TheirTmz; } double AdjustHours = OurTmz - TheirTmz; AddMinutes((int) (AdjustHours * 60)); #endif } else { // assume GMT AddMinutes((int) (OurTmz * 60)); } } else if (s.IsNumeric()) { int Count = 0; for (char *c = s; *c; c++) { if (!IsDigit(*c)) break; Count++; } if (Count <= 2) { if (Day()) { // We already have a day... so this might be // a 2 digit year... LDateTime Now; Now.SetNow(); int Yr = atoi(s); if (2000 + Yr <= Now.Year()) Year(2000 + Yr); else Year(1900 + Yr); } else { // A day number (hopefully)? Day((int)s.Int()); } } else if (Count == 4) { if (!Year()) { // A year! Year((int)s.Int()); Status = true; } else { goto DoTimeZone; } // My one and only Y2K fix // d.Year((Yr < 100) ? (Yr > 50) ? 1900+Yr : 2000+Yr : Yr); } } } } return Status; } bool LDateTime::GetVariant(const char *Name, LVariant &Dst, char *Array) { LDomProperty p = LStringToDomProp(Name); switch (p) { case DateYear: // Type: Int32 Dst = Year(); break; case DateMonth: // Type: Int32 Dst = Month(); break; case DateDay: // Type: Int32 Dst = Day(); break; case DateHour: // Type: Int32 Dst = Hours(); break; case DateMinute: // Type: Int32 Dst = Minutes(); break; case DateSecond: // Type: Int32 Dst = Seconds(); break; case DateDate: // Type: String { char s[32]; GetDate(s, sizeof(s)); Dst = s; break; } case DateTime: // Type: String { char s[32]; GetTime(s, sizeof(s)); Dst = s; break; } case TypeString: // Type: String case DateDateAndTime: // Type: String { char s[32]; Get(s, sizeof(s)); Dst = s; break; } case TypeInt: // Type: Int64 case DateTimestamp: // Type: Int64 { LTimeStamp i; if (Get(i)) Dst = (int64)i.Get(); break; } case DateSecond64Bit: { Dst = Second64Bit; break; } default: { return false; } } return true; } bool LDateTime::SetVariant(const char *Name, LVariant &Value, char *Array) { LDomProperty p = LStringToDomProp(Name); switch (p) { case DateYear: Year(Value.CastInt32()); break; case DateMonth: Month(Value.CastInt32()); break; case DateDay: Day(Value.CastInt32()); break; case DateHour: Hours(Value.CastInt32()); break; case DateMinute: Minutes(Value.CastInt32()); break; case DateSecond: Seconds(Value.CastInt32()); break; case DateDate: SetDate(Value.Str()); break; case DateTime: SetTime(Value.Str()); break; case DateDateAndTime: Set(Value.Str()); break; case DateTimestamp: Set((uint64)Value.CastInt64()); break; default: return false; } return true; } bool LDateTime::CallMethod(const char *Name, LVariant *ReturnValue, LArray &Args) { switch (LStringToDomProp(Name)) { case DateSetNow: SetNow(); if (ReturnValue) *ReturnValue = true; break; case DateSetStr: if (Args.Length() < 1) return false; bool Status; if (Args[0]->Type == GV_INT64) Status = Set((uint64) Args[0]->Value.Int64); else Status = Set(Args[0]->Str()); if (ReturnValue) *ReturnValue = Status; break; case DateGetStr: { char s[256] = ""; Get(s, sizeof(s)); if (ReturnValue) *ReturnValue = s; break; } default: return false; } return true; } #ifdef _DEBUG #define DATE_ASSERT(i) \ if (!(i)) \ { \ LAssert(!"LDateTime unit test failed."); \ return false; \ } static bool CompareDateStr(LString a, LString b) { auto delim = "/: ap"; auto aParts = a.SplitDelimit(delim); auto bParts = a.SplitDelimit(delim); if (aParts.Length() != 6 || bParts.Length() != 6) return false; for (int i=0; i= 8); // Check 64bit get/set LDateTime t("1/1/2017 0:0:0"), t2; LTimeStamp i; DATE_ASSERT(t.Get(i)); // LgiTrace("Get='%s'\n", t.Get().Get()); auto i2 = i + (24ULL * 60 * 60 * LDateTime::Second64Bit); t2.SetFormat(GDTF_DAY_MONTH_YEAR); t2.Set(i2); LString s = t2.Get(); // LgiTrace("Set='%s'\n", s.Get()); DATE_ASSERT(CompareDateStr(s, "2/1/2017 12:00:00a")); t.SetNow(); // LgiTrace("Now.Local=%s Tz=%.2f\n", t.Get().Get(), t.GetTimeZoneHours()); t2 = t; t2.ToUtc(); // LgiTrace("Now.Utc=%s Tz=%.2f\n", t2.Get().Get(), t2.GetTimeZoneHours()); t2.ToLocal(); // LgiTrace("Now.Local=%s Tz=%.2f\n", t2.Get().Get(), t2.GetTimeZoneHours()); DATE_ASSERT(t == t2); // Check get/set Unix time t.ToUtc(); t.SetUnix(tt = 1704067200); s = t.Get(); DATE_ASSERT(CompareDateStr(s, Jan1)); auto new_tt = t.GetUnix(); DATE_ASSERT(new_tt == tt); // Now do it with a timezone set... t.SetTimeZone(t.SystemTimeZone(), false); t.SetUnix(tt); DATE_ASSERT(CompareDateStr(s, Jan1)); new_tt = t.GetUnix(); DATE_ASSERT(new_tt == tt); // Check various Add### functions // Check infer timezone t.Empty(); t.Set(Jan1); DATE_ASSERT(t.InferTimeZone(false)); DATE_ASSERT(t.GetTimeZone() == 660); t.SetTimeZone(660, false); // Now try something right on the edge of the DST change... just before... t.SetUnix(1712412000); // 7/4/2024 1:00:00 +1100 - t.SetTimeZone(0, false); + t.SetTimeZone(0, true); DATE_ASSERT(t.InferTimeZone(false)); DATE_ASSERT(t.GetTimeZone() == 660); // Just after... t.SetUnix(1712426400); // 7/4/2024 4:00:00 +1000 - t.SetTimeZone(0, false); + t.SetTimeZone(0, true); DATE_ASSERT(t.InferTimeZone(false)); DATE_ASSERT(t.GetTimeZone() == 600); return true; } #endif //////////////////////////////////////////////////////////////////////////////////////////////////// LTimeStamp <imeStamp::operator =(const time_t unixTime) { #if defined(WINDOWS) ts = (unixTime + SEC_TO_UNIX_EPOCH) * WINDOWS_TICK; #else ts = (unixTime + LDateTime::Offset1800) * LDateTime::Second64Bit; #endif return *this; } LTimeStamp <imeStamp::operator =(const LDateTime &dt) { dt.Get(*this); return *this; } time_t LTimeStamp::Unix() const { #if defined(WINDOWS) return (ts / WINDOWS_TICK) - SEC_TO_UNIX_EPOCH; #else return (ts / LDateTime::Second64Bit) - LDateTime::Offset1800; #endif } diff --git a/src/common/Widgets/ItemContainer.cpp b/src/common/Widgets/ItemContainer.cpp --- a/src/common/Widgets/ItemContainer.cpp +++ b/src/common/Widgets/ItemContainer.cpp @@ -1,1315 +1,1315 @@ #include "lgi/common/Lgi.h" #include "lgi/common/ItemContainer.h" #include "lgi/common/DisplayString.h" #include "lgi/common/SkinEngine.h" #include "lgi/common/ScrollBar.h" #include "lgi/common/Edit.h" #include "lgi/common/CssTools.h" // Colours #if defined(__GTK_H__) #define DOUBLE_BUFFER_COLUMN_DRAWING 1 #else #define DOUBLE_BUFFER_COLUMN_DRAWING 0 #endif #if defined(WIN32) #if !defined(WS_EX_LAYERED) #define WS_EX_LAYERED 0x80000 #endif #if !defined(LWA_ALPHA) #define LWA_ALPHA 2 #endif typedef BOOL (__stdcall *_SetLayeredWindowAttributes)(HWND hwnd, COLORREF crKey, BYTE bAlpha, DWORD dwFlags); #endif class LItemColumnPrivate { LDisplayString *Txt = NULL; public: LRect Pos; bool Down = false; bool Drag = false; #define _(name) bool name = false; COLUMN_FLAGS() #undef _ LItemContainer *Parent = NULL; LString cName; int cWidth = 0; LSurface *cIcon = NULL; int cImage = -1; bool OwnIcon = false; bool CanResize = true; LItemColumnPrivate(LItemContainer *parent) { Parent = parent; } ~LItemColumnPrivate() { DeleteObj(Txt); if (OwnIcon) { DeleteObj(cIcon); } } void SetName(const char *n) { cName = n; DeleteObj(Txt); } // Try and delay the creation of the display string till // the code is being called from an event, and in the window's thread // on Haiku. That way it gets a thread specific font handle. LDisplayString *&GetDs() { if (!Txt) { auto f = Parent && Parent->GetFont() && Parent->GetFont()->Handle() ? Parent->GetFont() : LSysFont; Txt = new LDisplayString(f, cName); } return Txt; } }; static LColour cActiveCol(0x86, 0xba, 0xe9); static void FillStops(LArray &Stops, LRect &r, bool Active) { if (Active) { Stops[0].Set(0.0f, LColour(0xd0, 0xe2, 0xf5)); Stops[1].Set(2.0f / (r.Y() - 2), LColour(0x98, 0xc1, 0xe9)); Stops[2].Set(0.5f, LColour(0x86, 0xba, 0xe9)); Stops[3].Set(0.51f, LColour(0x68, 0xaf, 0xea)); Stops[4].Set(1.0f, LColour(0xbb, 0xfc, 0xff)); } else { LColour cMed(L_MED), cWs(L_WORKSPACE); if (cWs.GetGray() < 96) { cMed = cMed.Mix(LColour::White, 0.25f); cWs = cWs.Mix(LColour::White, 0.25f); } Stops[0].Set(0.0f, cWs); Stops[1].Set(0.5f, cMed.Mix(cWs)); Stops[2].Set(0.51f, cMed); Stops[3].Set(1.0f, cWs); } } ////////////////////////////////////////////////////////////////////////////////////// LItemContainer::LItemContainer() { ColumnHeader.ZOff(-1, -1); Columns.SetFixedLength(true); } LItemContainer::~LItemContainer() { DeleteObj(ItemEdit); DeleteObj(DragCol); Columns.DeleteObjects(); } void LItemContainer::PaintColumnHeadings(LSurface *pDC) { // Draw column headings if (!ColumnHeaders() || !ColumnHeader.Valid()) return; LSurface *ColDC = pDC; LRect cr; #if DOUBLE_BUFFER_COLUMN_DRAWING LMemDC Bmp; if (!pDC->SupportsAlphaCompositing() && Bmp.Create(ColumnHeader.X(), ColumnHeader.Y(), System32BitColourSpace)) { ColDC = &Bmp; Bmp.Op(GDC_ALPHA); cr = ColumnHeader.ZeroTranslate(); } else #endif { cr = ColumnHeader; pDC->ClipRgn(&cr); } // Draw columns int cx = cr.x1; if (IconCol) { cr.x1 = cx; cr.x2 = cr.x1 + IconCol->Width() - 1; IconCol->SetPos(cr); IconCol->OnPaint(ColDC, cr); cx += IconCol->Width(); } // Draw other columns for (int i=0; iWidth() - 1; c->SetPos(cr); c->OnPaint(ColDC, cr); cx += c->Width(); } else LAssert(0); } // Draw ending piece cr.x1 = cx; cr.x2 = ColumnHeader.x2 + 2; if (cr.Valid()) { // Draw end section where there are no columns #ifdef MAC LArray Stops; LRect j(cr.x1, cr.y1, cr.x2-1, cr.y2-1); FillStops(Stops, j, false); LFillGradient(ColDC, j, true, Stops); ColDC->Colour(L_LOW); ColDC->Line(cr.x1, cr.y2, cr.x2, cr.y2); #else if (LApp::SkinEngine) { LSkinState State; State.pScreen = ColDC; State.Rect = cr; State.Enabled = Enabled(); State.View = this; LApp::SkinEngine->OnPaint_ListColumn(0, 0, &State); } else { LWideBorder(ColDC, cr, DefaultRaisedEdge); ColDC->Colour(LColour(L_MED)); ColDC->Rectangle(&cr); } #endif } #if DOUBLE_BUFFER_COLUMN_DRAWING if (!pDC->SupportsAlphaCompositing()) pDC->Blt(ColumnHeader.x1, ColumnHeader.y1, &Bmp); else #endif pDC->ClipRgn(0); } LItemColumn *LItemContainer::AddColumn(const char *Name, int Width, int Where) { LItemColumn *c = 0; if (Lock(_FL)) { c = new LItemColumn(this, Name, Width); if (c) { Columns.SetFixedLength(false); Columns.AddAt(Where, c); Columns.SetFixedLength(true); UpdateAllItems(); SendNotify(LNotifyItemColumnsChanged); } Unlock(); } return c; } bool LItemContainer::AddColumn(LItemColumn *Col, int Where) { bool Status = false; if (Col && Lock(_FL)) { Columns.SetFixedLength(false); Status = Columns.AddAt(Where, Col); Columns.SetFixedLength(true); if (Status) { UpdateAllItems(); SendNotify(LNotifyItemColumnsChanged); } Unlock(); } return Status; } void LItemContainer::DragColumn(int Index) { DeleteObj(DragCol); if (Index >= 0) { DragCol = new LDragColumn(this, Index); if (DragCol) { Capture(true); DragMode = DRAG_COLUMN; } } } int LItemContainer::ColumnAtX(int x, LItemColumn **Col, int *Offset) { LItemColumn *Column = NULL; if (!Col) Col = &Column; int Cx = GetImageList() ? 16 : 0; int c; for (c=0; c= Cx && x < Cx + (*Col)->Width()) { if (Offset) *Offset = Cx; return c; } Cx += (*Col)->Width(); } return -1; } void LItemContainer::EmptyColumns() { Columns.DeleteObjects(); Invalidate(&ColumnHeader); SendNotify(LNotifyItemColumnsChanged); } int LItemContainer::HitColumn(int x, int y, LItemColumn *&Resize, LItemColumn *&Over) { int Index = -1; Resize = 0; Over = 0; if (ColumnHeaders() && ColumnHeader.Overlap(x, y)) { // Clicked on a column heading int cx = ColumnHeader.x1 + ((IconCol) ? IconCol->Width() : 0); for (int n = 0; n < Columns.Length(); n++) { LItemColumn *c = Columns[n]; cx += c->Width(); if (abs(x-cx) < 5) { if (c->Resizable()) { Resize = c; Index = n; break; } } else if (c->d->Pos.Overlap(x, y)) { Over = c; Index = n; break; } } } return Index; } void LItemContainer::OnColumnClick(int Col, LMouse &m) { ColClick = Col; ColMouse = m; LNotification n(LNotifyItemColumnClicked); n.Int[0] = Col; SendNotify(n); } bool LItemContainer::GetColumnClickInfo(int &Col, LMouse &m) { if (ColClick < 0) { Col = ColumnAtX(m.x); return true; } else if (ColClick >= 0) { Col = ColClick; m = ColMouse; return true; } return false; } void LItemContainer::GetColumnSizes(ColSizes &cs) { // Read in the current sizes cs.FixedPx = 0; cs.ResizePx = 0; for (int i=0; iResizable()) { ColInfo &Inf = cs.Info.New(); Inf.Col = c; Inf.Idx = i; Inf.ContentPx = c->GetContentSize(); Inf.WidthPx = c->Width(); cs.ResizePx += Inf.ContentPx; } else { cs.FixedPx += c->Width(); } } } void LItemContainer::SetSortingMark(int ColIdx, bool Up) { for (int i=0; iUpArrow(ColIdx == i && Up); c->DownArrow(ColIdx == i && !Up); } } LMessage::Result LItemContainer::OnEvent(LMessage *Msg) { switch (Msg->Msg()) { case M_RESIZE_TO_CONTENT: { ResizeColumnsToContent((int)Msg->A()); break; } default: break; } return LLayout::OnEvent(Msg); } void LItemContainer::ResizeColumnsToContent(int Border) { if (!InThread()) { PostEvent(M_RESIZE_TO_CONTENT, Border); return; } if (Lock(_FL)) { // Read in the current sizes ColSizes Sizes; GetColumnSizes(Sizes); // Allocate space int AvailablePx = GetClient().X() - 5; if (VScroll) AvailablePx -= VScroll->X(); int ExpandPx = AvailablePx - Sizes.FixedPx; Sizes.Info.Sort([](auto a, auto b) { int AGrowPx = a->GrowPx(); int BGrowPx = b->GrowPx(); return AGrowPx - BGrowPx; }); for (int i=0; iResizable()) { if (ExpandPx > Sizes.ResizePx) { // Everything fits... Inf.Col->Width(Inf.ContentPx + Border); } else { int Cx = GetClient().X(); double Ratio = Cx ? (double)Inf.ContentPx / Cx : 1.0; if (Ratio < 0.25) { Inf.Col->Width(Inf.ContentPx + Border); } else { // Need to scale to fit... int Px = Inf.ContentPx * ExpandPx / Sizes.ResizePx; Inf.Col->Width(Px + Border); } } ClearDs(Inf.Idx); } } Unlock(); } Invalidate(); } ////////////////////////////////////////////////////////////////////////////// LDragColumn::LDragColumn(LItemContainer *list, int col) { List = list; Index = col; Offset = 0; #ifdef LINUX Back = 0; #endif Col = List->ColumnAt(Index); if (Col) { Col->d->Down = false; Col->d->Drag = true; LRect r = Col->d->Pos; r.y1 = 0; r.y2 = List->Y()-1; List->Invalidate(&r, true); #if WINNATIVE LArray Ver; bool Layered = ( LGetOs(&Ver) == LGI_OS_WIN32 || LGetOs(&Ver) == LGI_OS_WIN64 ) && Ver[0] >= 5; SetStyle(WS_POPUP); SetExStyle(GetExStyle() | WS_EX_TOOLWINDOW); if (Layered) { SetExStyle(GetExStyle() | WS_EX_LAYERED | WS_EX_TRANSPARENT); } #endif Attach(0); #if WINNATIVE if (Layered) { SetWindowLong(Handle(), GWL_EXSTYLE, GetWindowLong(Handle(), GWL_EXSTYLE) | WS_EX_LAYERED); LLibrary User32("User32"); _SetLayeredWindowAttributes SetLayeredWindowAttributes = (_SetLayeredWindowAttributes)User32.GetAddress("SetLayeredWindowAttributes"); if (SetLayeredWindowAttributes) { if (!SetLayeredWindowAttributes(Handle(), 0, DRAG_COL_ALPHA, LWA_ALPHA)) { DWORD Err = GetLastError(); } } } #elif defined(__GTK_H__) Gtk::GtkWindow *w = WindowHandle(); if (w) { gtk_window_set_decorated(w, FALSE); gtk_widget_set_opacity(GtkCast(w, gtk_widget, GtkWidget), DRAG_COL_ALPHA / 255.0); } #endif LMouse m; List->GetMouse(m); Offset = m.x - r.x1; List->PointToScreen(ListScrPos); r.Offset(ListScrPos.x, ListScrPos.y); SetPos(r); Visible(true); } } LDragColumn::~LDragColumn() { Visible(false); if (Col) { Col->d->Drag = false; } List->Invalidate(); } #if LINUX_TRANS_COL void LDragColumn::OnPosChange() { Invalidate(); } #endif void LDragColumn::OnPaint(LSurface *pScreen) { #if LINUX_TRANS_COL LSurface *Buf = new LMemDC(X(), Y(), GdcD->GetBits()); LSurface *pDC = new LMemDC(X(), Y(), GdcD->GetBits()); #else LSurface *pDC = pScreen; #endif pDC->SetOrigin(Col->d->Pos.x1, 0); if (Col) Col->d->Drag = false; List->OnPaint(pDC); if (Col) Col->d->Drag = true; pDC->SetOrigin(0, 0); #if LINUX_TRANS_COL if (Buf && pDC) { LRect p = GetPos(); // Fill the buffer with the background Buf->Blt(ListScrPos.x - p.x1, 0, Back); // Draw painted column over the back with alpha Buf->Op(GDC_ALPHA); LApplicator *App = Buf->Applicator(); if (App) { App->SetVar(GAPP_ALPHA_A, DRAG_COL_ALPHA); } Buf->Blt(0, 0, pDC); // Put result on the screen pScreen->Blt(0, 0, Buf); } DeleteObj(Buf); DeleteObj(pDC); #endif } /////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////// // List column LItemColumn::LItemColumn(LItemContainer *parent, const char *name, int width) : ResObject(Res_Column) { d = new LItemColumnPrivate(parent); d->cWidth = width; if (name) Name(name); } LItemColumn::~LItemColumn() { if (d->Drag) { d->Parent->DragColumn(-1); } DeleteObj(d); } LItemContainer *LItemColumn::GetList() { return d->Parent; } void LItemColumn::Image(int i) { d->cImage = i; } int LItemColumn::Image() { return d->cImage; } bool LItemColumn::Resizable() { return d->CanResize; } void LItemColumn::Resizable(bool i) { d->CanResize = i; } bool LItemColumn::InDrag() { return d->Drag; } LRect LItemColumn::GetPos() { return d->Pos; } void LItemColumn::SetPos(LRect &r) { d->Pos = r; } void LItemColumn::Name(const char *n) { d->SetName(n); if (d->Parent) d->Parent->Invalidate(&d->Parent->ColumnHeader); } char *LItemColumn::Name() { return d->cName; } int LItemColumn::GetIndex() { if (d->Parent) { return (int)d->Parent->Columns.IndexOf(this); } return -1; } int LItemColumn::GetContentSize() { return d->Parent->GetContentSize(GetIndex()); } void LItemColumn::Width(int i) { if (d->cWidth != i) { d->cWidth = i; // If we are attached to a list... if (d->Parent) { /* FIXME int MyIndex = GetIndex(); // Clear all the cached strings for this column for (List::I it=d->Parent->Items.Start(); it.In(); it++) { DeleteObj((*it)->d->Display[MyIndex]); } if (d->Parent->IsAttached()) { // Update the screen from this column across LRect Up = d->Parent->GetClient(); Up.x1 = d->Pos.x1; d->Parent->Invalidate(&Up); } */ } // Notify listener auto p = d->Parent; if (p) p->SendNotify(LNotifyItemColumnsResized); } } int LItemColumn::Width() { return d->cWidth; } #define _(name) \ bool LItemColumn::name() \ { \ return d->name; \ } \ \ void LItemColumn::name(bool b) \ { \ d->name = b; \ if (d->Parent) \ d->Parent->Invalidate(&d->Parent->ColumnHeader); \ } COLUMN_FLAGS() #undef _ void LItemColumn::Icon(LSurface *i, bool Own) { if (d->OwnIcon) { DeleteObj(d->cIcon); } d->cIcon = i; d->OwnIcon = Own; if (d->Parent) { d->Parent->Invalidate(&d->Parent->ColumnHeader); } } LSurface *LItemColumn::Icon() { return d->cIcon; } bool LItemColumn::Value() { return d->Down; } void LItemColumn::Value(bool i) { d->Down = i; } void LItemColumn::OnPaint_Content(LSurface *pDC, LRect &r, bool FillBackground) { if (d->Drag) return; LCssTools Tools(d->Parent); auto Fore = Tools.GetFore(); auto cMed = LColour(L_MED); int Off = d->Down ? 1 : 0; int Mx = r.x1 + 8, My = r.y1 + ((r.Y() - 8) / 2); if (d->cIcon) { if (FillBackground) { pDC->Colour(cMed); pDC->Rectangle(&r); } int x = (r.X()-d->cIcon->X()) / 2; pDC->Blt( r.x1 + x + Off, r.y1 + ((r.Y()-d->cIcon->Y())/2) + Off, d->cIcon); if (HasSort()) { Mx += x + d->cIcon->X() + 4; } } else if (d->cImage >= 0 && d->Parent) { LColour Background = cMed; if (FillBackground) { pDC->Colour(Background); pDC->Rectangle(&r); } if (d->Parent->GetImageList()) { LRect *b = d->Parent->GetImageList()->GetBounds(); int x = r.x1; int y = r.y1; if (b) { b += d->cImage; x = r.x1 + ((r.X()-b->X()) / 2) - b->x1; y = r.y1 + ((r.Y()-b->Y()) / 2) - b->y1; } d->Parent->GetImageList()->Draw(pDC, x + Off, y + Off, d->cImage, Background); } if (HasSort()) { Mx += d->Parent->GetImageList()->TileX() + 4; } } else if (ValidStr(d->cName)) { auto Ds = d->GetDs(); if (!Ds || !Ds->GetFont()) { LAssert(0); return; } auto f = Ds->GetFont(); LColour cText = Fore; #ifdef MAC // Contrast check - if (d->cMark && (cText - cActiveCol) < 64) + if (HasSort() && (cText - cActiveCol) < 64) cText = cText.Invert(); #endif f->Transparent(!FillBackground); f->Colour(cText, cMed); int ty = Ds->Y(); int ry = r.Y(); int y = r.y1 + ((ry - ty) >> 1); // d->Txt->_debug = true; Ds->Draw(pDC, r.x1 + Off + 3, y + Off, &r); if (HasSort()) { Mx += Ds->X(); } } else { if (FillBackground) { pDC->Colour(cMed); pDC->Rectangle(&r); } } #define ARROW_SIZE 9 pDC->Colour(Fore); Mx += Off; My += Off - 1; if (UpArrow()) { pDC->Line(Mx + 2, My, Mx + 2, My + ARROW_SIZE - 1); pDC->Line(Mx, My + 2, Mx + 2, My); pDC->Line(Mx + 2, My, Mx + 4, My + 2); } else if (DownArrow()) { pDC->Line(Mx + 2, My, Mx + 2, My + ARROW_SIZE - 1); pDC->Line( Mx, My + ARROW_SIZE - 3, Mx + 2, My + ARROW_SIZE - 1); pDC->Line( Mx + 2, My + ARROW_SIZE - 1, Mx + 4, My + ARROW_SIZE - 3); } } void ColumnPaint(void *UserData, LSurface *pDC, LRect &r, bool FillBackground) { ((LItemColumn*)UserData)->OnPaint_Content(pDC, r, FillBackground); } void LItemColumn::OnPaint(LSurface *pDC, LRect &Rgn) { LRect r = Rgn; if (d->Drag) { pDC->Colour(DragColumnColour); pDC->Rectangle(&r); } else { #ifdef MAC LArray Stops; LRect j(r.x1, r.y1, r.x2-1, r.y2-1); - FillStops(Stops, j, d->cMark != 0); + FillStops(Stops, j, HasSort()); LFillGradient(pDC, j, true, Stops); - if (d->cMark) + if (HasSort()) pDC->Colour(Rgb24(0x66, 0x93, 0xc0), 24); else pDC->Colour(Rgb24(178, 178, 178), 24); pDC->Line(r.x1, r.y2, r.x2, r.y2); pDC->Line(r.x2, r.y1, r.x2, r.y2); LRect n = r; n.Inset(2, 2); OnPaint_Content(pDC, n, false); #else if (LApp::SkinEngine) { LSkinState State; State.pScreen = pDC; State.ptrText = &d->GetDs(); State.Rect = Rgn; State.Value = Value(); State.Enabled = GetList()->Enabled(); State.View = d->Parent; LApp::SkinEngine->OnPaint_ListColumn(ColumnPaint, this, &State); } else { if (d->Down) { LThinBorder(pDC, r, DefaultSunkenEdge); LFlatBorder(pDC, r, 1); } else { LWideBorder(pDC, r, DefaultRaisedEdge); } OnPaint_Content(pDC, r, true); } #endif } } /////////////////////////////////////////////////////////////////////////////////////////// LItem::LItem() { SelectionStart = SelectionEnd = -1; } LItem::~LItem() { } LView *LItem::EditLabel(int Col) { LItemContainer *c = GetContainer(); if (!c) return NULL; c->Capture(false); if (!c->ItemEdit) { c->ItemEdit = new LItemEdit(c, this, Col, SelectionStart, SelectionEnd); SelectionStart = SelectionEnd = -1; } return c->ItemEdit; } void LItem::OnEditLabelEnd() { LItemContainer *c = GetContainer(); if (c) c->ItemEdit = NULL; } void LItem::SetEditLabelSelection(int SelStart, int SelEnd) { SelectionStart = SelStart; SelectionEnd = SelEnd; } //////////////////////////////////////////////////////////////////////////////////////////// #define M_END_POPUP (M_USER+0x1500) #define M_LOSING_FOCUS (M_USER+0x1501) class LItemEditBox : public LEdit { LItemEdit *ItemEdit; public: LItemEditBox(LItemEdit *i, int x, int y, const char *s) : LEdit(100, 1, 1, x-3, y-3, s) { ItemEdit = i; Sunken(false); MultiLine(false); #ifndef LINUX SetPos(GetPos()); #endif } const char *GetClass() { return "LItemEditBox"; } void OnCreate() { LEdit::OnCreate(); Focus(true); } void OnFocus(bool f) { if (!f && GetParent()) { #if DEBUG_EDIT_LABEL LgiTrace("%s:%i - LItemEditBox posting M_LOSING_FOCUS\n", _FL); #endif GetParent()->PostEvent(M_LOSING_FOCUS); } LEdit::OnFocus(f); } bool OnKey(LKey &k) { /* This should be handled by LEdit::OnKey now. Which will send a LNotifyEscapeKey or LNotifyReturnKey up to the ItemEdit OnNotify handler. switch (k.vkey) { case LK_RETURN: case LK_ESCAPE: { if (k.Down()) ItemEdit->OnNotify(this, k.c16); return true; } } */ return LEdit::OnKey(k); } bool SetScrollBars(bool x, bool y) { return false; } }; ////////////////////////////////////////////////////////////////////////////////////////// class LItemEditPrivate { public: LItem *Item; LEdit *Edit; int Index; bool Esc; LItemEditPrivate() { Esc = false; Item = 0; Index = 0; } }; LItemEdit::LItemEdit(LView *parent, LItem *item, int index, int SelStart, int SelEnd) : LPopup(parent) { d = new LItemEditPrivate; d->Item = item; d->Index = index; _BorderSize = 0; Sunken(false); Raised(false); #if DEBUG_EDIT_LABEL LgiTrace("%s:%i - LItemEdit(%p/%s, %i, %i, %i)\n", _FL, parent, parent?parent->GetClass():0, index, SelStart, SelEnd); #endif LPoint p; SetParent(parent); GetParent()->PointToScreen(p); LRect r = d->Item->GetPos(d->Index); int MinY = 6 + LSysFont->GetHeight(); if (r.Y() < MinY) r.y2 = r.y1 + MinY - 1; r.Offset(p.x, p.y); SetPos(r); if (Attach(parent)) { d->Edit = new LItemEditBox(this, r.X(), r.Y(), d->Item->GetText(d->Index)); if (d->Edit) { d->Edit->Attach(this); d->Edit->Focus(true); if (SelStart >= 0) { d->Edit->Select(SelStart, SelEnd-SelStart+1); } } Visible(true); } } LItemEdit::~LItemEdit() { if (d->Item) { if (d->Edit && !d->Esc) { auto Str = d->Edit->Name(); #if DEBUG_EDIT_LABEL LgiTrace("%s:%i - ~LItemEdit, updating item(%i) with '%s'\n", _FL, d->Index, Str); #endif LItemContainer *c = d->Item->GetContainer(); if (d->Item->SetText(Str, d->Index)) { d->Item->Update(); } else { // Item is deleting itself... // Make sure there is no dangling ptr on the container.. if (c) c->ItemEdit = NULL; // And we don't touch the no longer existant item.. d->Item = NULL; } } #if DEBUG_EDIT_LABEL else LgiTrace("%s:%i - Edit=%p Esc=%i\n", _FL, d->Edit, d->Esc); #endif if (d->Item) d->Item->OnEditLabelEnd(); } #if DEBUG_EDIT_LABEL else LgiTrace("%s:%i - Error: No item?\n", _FL); #endif DeleteObj(d); } LItem *LItemEdit::GetItem() { return d->Item; } void LItemEdit::OnPaint(LSurface *pDC) { pDC->Colour(L_BLACK); pDC->Rectangle(); } int LItemEdit::OnNotify(LViewI *v, LNotification n) { switch (v->GetId()) { case 100: { if (n.Type == LNotifyEscapeKey) { d->Esc = true; #if DEBUG_EDIT_LABEL LgiTrace("%s:%i - LItemEdit got escape\n", _FL); #endif } if (n.Type == LNotifyEscapeKey || n.Type == LNotifyReturnKey) { #if DEBUG_EDIT_LABEL LgiTrace("%s:%i - LItemEdit hiding on esc/enter\n", _FL); #endif d->Edit->KeyProcessed(); Visible(false); } break; } } return 0; } void LItemEdit::Visible(bool i) { LPopup::Visible(i); if (!i) { #if DEBUG_EDIT_LABEL LgiTrace("%s:%i - LItemEdit posting M_END_POPUP\n", _FL); #endif PostEvent(M_END_POPUP); } } bool LItemEdit::OnKey(LKey &k) { if (d->Edit) return d->Edit->OnKey(k); return false; } void LItemEdit::OnFocus(bool f) { if (f && d->Edit) d->Edit->Focus(true); } LMessage::Result LItemEdit::OnEvent(LMessage *Msg) { switch (Msg->Msg()) { case M_LOSING_FOCUS: { #if DEBUG_EDIT_LABEL LgiTrace("%s:%i - LItemEdit get M_LOSING_FOCUS\n", _FL); #endif // One of us has to retain focus... don't care which control. if (Focus() || d->Edit->Focus()) break; // else fall thru to end the popup #if DEBUG_EDIT_LABEL LgiTrace("%s:%i - LItemEdit falling thru to M_END_POPUP\n", _FL); #endif } case M_END_POPUP: { #if DEBUG_EDIT_LABEL LgiTrace("%s:%i - LItemEdit got M_END_POPUP, quiting\n", _FL); #endif if (d->Item && d->Item->GetContainer()) { d->Item->GetContainer()->Focus(true); } Quit(); return 0; } } return LPopup::OnEvent(Msg); } diff --git a/src/common/Widgets/List.cpp b/src/common/Widgets/List.cpp --- a/src/common/Widgets/List.cpp +++ b/src/common/Widgets/List.cpp @@ -1,2721 +1,2725 @@ /*hdr ** FILE: LList.cpp ** AUTHOR: Matthew Allen ** DATE: 14/2/2000 ** DESCRIPTION: Lgi self-drawn listbox ** ** Copyright (C) 2000 Matthew Allen ** fret@memecode.com */ #include #include #include #include "lgi/common/Lgi.h" #include "lgi/common/SkinEngine.h" #include "lgi/common/List.h" #include "lgi/common/ScrollBar.h" #include "lgi/common/DisplayString.h" #include "lgi/common/LgiRes.h" #include "lgi/common/CssTools.h" // Debug defines #define DEBUG_EDIT_LABEL 1 // Number of pixels you have to move the mouse until a drag is initiated. #define DRAG_THRESHOLD 4 // Switches for various profiling code.. #define LList_POUR_PROFILE 1 #define LList_ONPAINT_PROFILE 0 // Options #define DOUBLE_BUFFER_PAINT 0 #define ForAllItems(Var) for (auto Var : Items) #define ForAllItemsReverse(Var) Iterator ItemIter(&Items); for (LListItem *Var = ItemIter.Last(); Var; Var = ItemIter.Prev()) #define VisibleItems() CompletelyVisible // (LastVisible - FirstVisible + 1) #define MaxScroll() MAX((int)Items.Length() - CompletelyVisible, 0) class LListPrivate { public: // Mode LListMode Mode; int Columns; int VisibleColumns; // This is a pointer to a flag, that gets set when the object // is deleted. Used to trap events deleting the window. If an // event handler deletes the current window we can't touch any // of the member variables anymore, so we need to know to quit/return // ASAP. bool *DeleteFlag; // If this is true the ctrl is selecting lots of things // and we only want to notify once. bool NoSelectEvent; // Drag'n'drop LPoint DragStart; int DragData; // Kayboard search uint64 KeyLast; char16 *KeyBuf; // Class LListPrivate() { DragData = 0; KeyBuf = 0; DeleteFlag = 0; Columns = 0; VisibleColumns = 0; Mode = LListDetails; NoSelectEvent = false; } ~LListPrivate() { if (DeleteFlag) *DeleteFlag = true; DeleteArray(KeyBuf); } }; class LListItemPrivate { public: bool Selected = false; bool Visible = true; int ListItem_Image = -1; List Cols; LArray Str; LArray Display; int16 LayoutColumn = -1; LListItemPrivate() { } ~LListItemPrivate() { Cols.DeleteObjects(); EmptyStrings(); EmptyDisplay(); } void EmptyStrings() { Str.DeleteArrays(); } void EmptyDisplay() { Display.DeleteObjects(); } }; //////////////////////////////////////////////////////////////////////////////////////////// LListItemColumn::LListItemColumn(LListItem *item, int col) { _Column = col; _Item = item; _Value = 0; _Item->d->Cols.Insert(this); } LList *LListItemColumn::GetList() { return _Item ? _Item->Parent : 0; } LItemContainer *LListItemColumn::GetContainer() { return GetList(); } LListT *LListItemColumn::GetAllItems() { return GetList() ? &GetList()->Items : 0; } void LListItemColumn::Value(int64 i) { if (i != _Value) { _Value = i; _Item->OnColumnNotify(_Column, _Value); } } LListItemColumn *LListItemColumn::GetItemCol(LListItem *i, int Col) { if (i) { for (auto c: i->d->Cols) { if (c->_Column == Col) { return c; } } } return 0; } //////////////////////////////////////////////////////////////////////////////////////////// // List item LListItem::LListItem(const char *initStr) { d = new LListItemPrivate; Pos.ZOff(-1, -1); if (initStr) SetText(initStr); } LListItem::~LListItem() { if (Parent) Parent->Remove(this); DeleteObj(d); } void LListItem::SetImage(int i) { d->ListItem_Image = i; } int LListItem::GetImage(int Flags) { return d->ListItem_Image; } LItemContainer *LListItem::GetContainer() { return Parent; } List *LListItem::GetItemCols() { return &d->Cols; } /* Calling this to store your data is optional. Just override the "GetText" function to return your own data to avoid duplication in memory. */ bool LListItem::SetText(const char *s, int i) { if (i < 0) return false; // Delete any existing column DeleteArray((char*&)d->Str[i]); DeleteObj(d->Display[i]); // Add new string in d->Str[i] = NewStr(s); if (Parent) Parent->SendNotify(LNotifyItemChange); return true; } // User can override this if they want to use their own data const char *LListItem::GetText(int i) { return d->Str[i]; } bool LListItem::Select() { return d->Selected; } LRect *LListItem::GetPos(int Col) { static LRect r; r = Pos; if (Parent->GetMode() == LListDetails) { if (Col >= 0) { LItemColumn *Column = 0; int Cx = Parent->GetImageList() ? 16 : 0; for (int c=0; cColumnAt(c); if (Column) { Cx += Column->Width(); } } Column = Parent->ColumnAt(Col); if (Column) { r.x1 = Cx; r.x2 = Cx + Column->Width() - 1; } } } else { r.Offset(16, 0); } return &r; } void LListItem::Select(bool b) { if (d->Selected != b) { d->Selected = b; Update(); if (Parent && d->Selected && !Parent->d->NoSelectEvent) { LArray Items; Items.Add(this); Parent->OnItemSelect(Items); } } } void LListItem::ScrollTo() { if (Parent) { if (Parent->GetMode() == LListDetails && Parent->VScroll) { ssize_t n = Parent->Items.IndexOf(this); if (n < Parent->FirstVisible) { Parent->VScroll->Value(n); Parent->Invalidate(&Parent->ItemsPos); } else if (n >= Parent->LastVisible) { Parent->VScroll->Value(n - (Parent->LastVisible - Parent->FirstVisible) + 1); Parent->Invalidate(&Parent->ItemsPos); } } else if (Parent->GetMode() == LListColumns && Parent->HScroll) { ssize_t n = Parent->Items.IndexOf(this); if (n < Parent->FirstVisible) { Parent->HScroll->Value(d->LayoutColumn); Parent->Invalidate(&Parent->ItemsPos); } else if (n >= Parent->LastVisible) { ssize_t Range = Parent->HScroll->Page(); Parent->HScroll->Value(d->LayoutColumn - Range); Parent->Invalidate(&Parent->ItemsPos); } } } } void LListItem::Update() { if (Parent) { if (Parent->Lock(_FL)) { d->EmptyDisplay(); LPoint Info; OnMeasure(&Info); LRect r = Pos; if (r.Valid()) { if (Info.y != r.Y()) { Pos.y2 = Pos.y1 + Info.y - 1; Parent->PourAll(); r.y1 = MIN(r.y1, Pos.y1); r.y2 = Parent->ItemsPos.y2; } Parent->Invalidate(&r); } Parent->Unlock(); } } else { d->EmptyDisplay(); } } void LListItem::OnMeasure(LPoint *Info) { if (!Info) return; if (Parent && Parent->GetMode() == LListDetails) { Info->x = 4 << 10; } else { auto s = GetDs(0); Info->x = 22 + (s ? s->X() : 0); } LFont *f = Parent ? Parent->GetFont() : LSysFont; Info->y = MAX(16, f->GetHeight() + 2); // the default height } bool LListItem::GridLines() { return (Parent) ? Parent->GridLines : false; } void LListItem::OnMouseClick(LMouse &m) { int Col = Parent ? Parent->ColumnAtX(m.x) : -1; for (auto h: d->Cols) { if (Col == h->GetColumn()) { h->OnMouseClick(m); } } } LDisplayString *LListItem::GetDs(int Col, int FitTo) { if (!d->Display[Col]) { LFont *f = GetFont(); if (!f && Parent) f = Parent->GetFont(); if (!f) f = LSysFont; const char *Text = d->Str[Col] ? d->Str[Col] : GetText(Col); LAssert((NativeInt)Text != 0xcdcdcdcd && (NativeInt)Text != 0xfdfdfdfd); d->Display[Col] = new LDisplayString(f, Text?Text:(char*)""); if (d->Display[Col] && FitTo > 0) { d->Display[Col]->TruncateWithDots(FitTo); } } return d->Display[Col]; } void LListItem::ClearDs(int Col) { if (Col >= 0) { DeleteObj(d->Display[Col]); } else { d->Display.DeleteObjects(); } } void LListItem::OnPaintColumn(LItem::ItemPaintCtx &Ctx, int i, LItemColumn *c) { LSurface *&pDC = Ctx.pDC; if (!pDC) return; LRect ng = Ctx; // non-grid area if (c && c->InDrag()) { pDC->Colour(DragColumnColour); pDC->Rectangle(&ng); } else { LColour Background = Ctx.Back; if (Parent->GetMode() == LListDetails && (c && c->HasSort()) && !d->Selected) { Background = GdcMixColour(LColour(0, 24), Background, (double)1/32); } if (GridLines()) { ng.x2--; ng.y2--; } if (!c || !c->HasImage()) { auto Ds = GetDs(i, Ctx.X()); if (Ds) { Ds->GetFont()->TabSize(0); Ds->GetFont()->Transparent(false); Ds->GetFont()->Colour(Ctx.Fore, Background); switch (Ctx.Align.Type) { case LCss::AlignCenter: Ds->Draw(pDC, ng.x1+((ng.X()-Ds->X())/2), ng.y1+1, &ng); break; case LCss::AlignRight: Ds->Draw(pDC, ng.x2-Ds->X()-1, ng.y1+1, &ng); break; default: // Left or inherit Ds->Draw(pDC, ng.x1+1, ng.y1+1, &ng); break; } } else { pDC->Colour(Background); pDC->Rectangle(&ng); } } else { pDC->Colour(Background); pDC->Rectangle(&ng); if (Parent->GetImageList()) { int Img = GetImage(); if (Img >= 0) { int CenterY = Ctx.y1 + ((Ctx.Y() - Parent->GetImageList()->TileY()) >> 1); LAssert(CenterY >= 0); Parent->GetImageList()->Draw(pDC, Ctx.x1+1, CenterY, Img, Background); } } } if (GridLines()) { pDC->Colour(L_LOW); pDC->Line(Ctx.x1, Ctx.y2, Ctx.x2, Ctx.y2); pDC->Line(Ctx.x2, Ctx.y1, Ctx.x2, Ctx.y2); } } } void LListItem::OnPaint(LItem::ItemPaintCtx &Ctx) { if (!Parent || !d->Visible) return; int x = Ctx.x1; auto CtxX = Ctx.X(); LAutoPtr Prev; if (GetCss()) { Prev.Reset(new ItemPaintCtx(Ctx)); LCss::ColorDef Fill = GetCss()->Color(); if (Fill.Type == LCss::ColorRgb) Ctx.Fore.Set(Fill.Rgb32, 32); if (!Select()) { Fill = GetCss()->BackgroundColor(); if (Fill.Type == LCss::ColorRgb) Ctx.Back.Set(Fill.Rgb32, 32); } } // Icon? if (Parent->IconCol) { LItem::ItemPaintCtx IcoCtx = Ctx; IcoCtx.Set(x, Ctx.y1, x + Parent->IconCol->Width()-1, Ctx.y2); // draw icon OnPaintColumn(IcoCtx, -1, Parent->IconCol); x = IcoCtx.x2 + 1; } // draw columns auto It = d->Cols.begin(); LListItemColumn *h = *It; LItem::ItemPaintCtx ColCtx = Ctx; if (Parent->Columns.Length()) { for (int i=0; iColumns.Length(); i++) { LItemColumn *c = Parent->Columns[i]; if (Parent->GetMode() == LListColumns) ColCtx.Set(x, Ctx.y1, Ctx.x2, Ctx.y2); else ColCtx.Set(x, Ctx.y1, x + c->Width()-1, Ctx.y2); ColCtx.Align = c->TextAlign(); OnPaintColumn(ColCtx, i, c); if (h && i == h->GetColumn()) { h->OnPaintColumn(ColCtx, i, c); h = *(++It); } x = ColCtx.x2 + 1; if (Parent->GetMode() == LListColumns) break; } } else { // One fake column for the whole control: ColCtx.Set(x, Ctx.y1, x+CtxX-1, Ctx.y2); ColCtx.Align = LCss::AlignLeft; OnPaintColumn(ColCtx, 0, NULL); x = ColCtx.x2 + 1; } // after columns if (x <= Ctx.x2) { Ctx.pDC->Colour(Ctx.Back); Ctx.pDC->Rectangle(x, Ctx.y1, Ctx.x2, Ctx.y2); } if (Prev) Ctx = *Prev; } ////////////////////////////////////////////////////////////////////////////// // List control LList::LList(int id, int x, int y, int cx, int cy, const char *name) : ResObject(Res_ListView) { d = new LListPrivate; SetId(id); Name(name); ItemsPos.ZOff(-1, -1); Buf = 0; GridLines = false; FirstVisible = -1; LastVisible = -1; EditLabels = false; MultiSelect(true); CompletelyVisible = 0; Keyboard = -1; Sunken(true); Name("LList"); #if WINNATIVE SetStyle(GetStyle() | WS_TABSTOP); SetDlgCode(DLGC_WANTARROWS); Cursor = 0; #endif SetTabStop(true); LRect r(x, y, x+cx, y+cy); SetPos(r); LResources::StyleElement(this); } LList::~LList() { DeleteObj(Buf); Empty(); EmptyColumns(); DeleteObj(d); } LListMode LList::GetMode() { return d->Mode; } void LList::SetMode(LListMode m) { if (d->Mode ^ m) { d->Mode = m; if (IsAttached()) { PourAll(); Invalidate(); } } } void LList::OnItemClick(LListItem *Item, LMouse &m) { if (Item) Item->OnMouseClick(m); } void LList::OnItemBeginDrag(LListItem *Item, LMouse &m) { if (Item) Item->OnBeginDrag(m); } void LList::OnItemSelect(LArray &It) { if (It.Length()) { Keyboard = (int)Items.IndexOf(It[0]); LAssert(Keyboard >= 0); LHashTbl, bool> Sel; for (int n=0; nOnSelect(); if (!MultiSelect()) Sel.Add(It[n], true); } if (!MultiSelect()) { // deselect all other items ForAllItems(i) { if (!Sel.Find(i)) { if (i->d->Selected) { /* i->d->Selected = false; i->Update(); */ i->Select(false); } } } } } // Notify selection change SendNotify(LNotifyItemSelect); } bool LItemContainer::DeleteColumn(LItemColumn *Col) { bool Status = false; if (Col && Lock(_FL)) { if (Columns.HasItem(Col)) { Columns.Delete(Col); DeleteObj(Col); UpdateAllItems(); SendNotify(LNotifyItemColumnsChanged); Status = true; } Unlock(); } return Status; } LMessage::Result LList::OnEvent(LMessage *Msg) { switch (Msg->Msg()) { #ifdef WIN32 case WM_VSCROLL: { if (VScroll) return VScroll->OnEvent(Msg); break; } #endif } return LItemContainer::OnEvent(Msg); } int LList::OnNotify(LViewI *Ctrl, LNotification n) { if ( (Ctrl->GetId() == IDC_VSCROLL && VScroll) || (Ctrl->GetId() == IDC_HSCROLL && HScroll) ) { if (n.Type == LNotifyScrollBarCreate) UpdateScrollBars(); Invalidate(&ItemsPos); } return LLayout::OnNotify(Ctrl, n); } LRect &LList::GetClientRect() { static LRect r; r = GetPos(); r.Offset(-r.x1, -r.y1); return r; } LListItem *LList::HitItem(int x, int y, int *Index) { int n=0; ForAllItems(i) { if ( ( // Is list mode we consider the item to have infinite width. // This helps with multi-selection when the cursor falls outside // the window's bounds but is still receiving mouse move messages // because of mouse capture. d->Mode == LListDetails && y >= i->Pos.y1 && y <= i->Pos.y2 ) || ( i->Pos.Overlap(x, y) ) ) { if (Index) *Index = n; return i; } n++; } return NULL; } void LList::ClearDs(int Col) { ForAllItems(i) { i->ClearDs(Col); } } void LList::KeyScroll(int iTo, int iFrom, bool SelectItems) { int Start = -1, End = -1, i = 0; { ForAllItems(n) { if (n->Select()) { if (Start < 0) { Start = i; } } else if (Start >= 0 && End < 0) { End = i - 1; } i++; } if (End < 0) End = i - 1; } if (Items.Length() == 0) return; iTo = limit(iTo, 0, (int)Items.Length()-1); iFrom = limit(iFrom, 0, (int)Items.Length()-1); LListItem *To = Items.ItemAt(iTo); LListItem *From = Items.ItemAt(iFrom); // int Inc = (iTo < iFrom) ? -1 : 1; if (To && From && iTo != iFrom) { // LListItem *Item = 0; if (SelectItems) { int OtherEnd = Keyboard == End ? Start : End; int Min = MIN(OtherEnd, iTo); int Max = MAX(OtherEnd, iTo); i = 0; d->NoSelectEvent = true; LArray Sel; ForAllItems(n) { bool s = i>=Min && i<=Max; n->Select(s); if (s) Sel.Add(n); i++; } d->NoSelectEvent = false; OnItemSelect(Sel); } else { Select(To); } To->ScrollTo(); Keyboard = iTo; } } bool LList::OnMouseWheel(double Lines) { if (VScroll) { int64 Old = VScroll->Value(); VScroll->Value(Old + (int)Lines); if (Old != VScroll->Value()) { Invalidate(&ItemsPos); } } if (HScroll) { int64 Old = HScroll->Value(); HScroll->Value(Old + (int)(Lines / 3)); if (Old != HScroll->Value()) { Invalidate(&ItemsPos); } } return true; } bool LList::OnKey(LKey &k) { bool Status = false; LListItem *Item = GetSelected(); if (Item) { Status = Item->OnKey(k); } if (k.vkey != LK_UP && k.vkey != LK_DOWN && k.CtrlCmd()) { switch (k.c16) { case 'A': case 'a': { if (k.Down()) SelectAll(); Status = true; break; } } } else { switch (k.vkey) { case LK_RETURN: { #if WINNATIVE if (!k.IsChar) #endif { if (k.Down()) SendNotify(LNotification(k)); } break; } case LK_BACKSPACE: case LK_DELETE: case LK_ESCAPE: { if (k.Down()) SendNotify(LNotification(k)); break; } case LK_UP: { // int i = Value(); #ifdef MAC if (k.Ctrl()) goto LList_PageUp; else if (k.System()) goto LList_Home; #endif if (k.Down()) KeyScroll(Keyboard-1, Keyboard, k.Shift()); Status = true; break; } case LK_DOWN: { #ifdef MAC if (k.Ctrl()) goto LList_PageDown; else if (k.System()) goto LList_End; #endif if (k.Down()) KeyScroll(Keyboard+1, Keyboard, k.Shift()); Status = true; break; } case LK_LEFT: { if (GetMode() == LListColumns) { if (k.Down()) { LListItem *Hit = GetSelected(); if (Hit) { LListItem *To = 0; int ToDist = 0x7fffffff; for (auto It = Items.begin(FirstVisible); It != Items.end(); ++It) { LListItem *i = *It; if (!i->Pos.Valid()) break; if (i->Pos.x2 < Hit->Pos.x1) { int Dx = i->Pos.x1 - Hit->Pos.x1; int Dy = i->Pos.y1 - Hit->Pos.y1; int IDist = Dx * Dx + Dy * Dy; if (!To || IDist < ToDist) { To = i; ToDist = IDist; } } } if (!To && HScroll) { if (Hit->d->LayoutColumn == HScroll->Value() + 1) { // Seek back to the start of the column before the // first visible column for (auto it = Items.begin(FirstVisible); it.In(); it--) { LListItem *i = *it; if (i->d->LayoutColumn < HScroll->Value()) { it++; break; } } // Now find the entry at the right height } } if (To) { Select(0); To->Select(true); To->ScrollTo(); } } } Status = true; } break; } case LK_RIGHT: { if (GetMode() == LListColumns) { if (k.Down()) { LListItem *Hit = GetSelected(); if (Hit) { LListItem *To = 0; int ToDist = 0x7fffffff; for (auto It = Items.begin(FirstVisible); It != Items.end(); ++It) { LListItem *i = *It; if (!i->Pos.Valid()) break; if (i->Pos.x1 > Hit->Pos.x2) { int Dx = i->Pos.x1 - Hit->Pos.x1; int Dy = i->Pos.y1 - Hit->Pos.y1; int IDist = Dx * Dx + Dy * Dy; if (!To || IDist < ToDist) { To = i; ToDist = IDist; } } } if (To) { Select(0); To->Select(true); To->ScrollTo(); } } } Status = true; } break; } case LK_PAGEUP: { #ifdef MAC LList_PageUp: #endif if (k.Down()) { int Vis = VisibleItems(); Vis = MAX(Vis, 0); KeyScroll(Keyboard-Vis, Keyboard, k.Shift()); } Status = true; break; } case LK_PAGEDOWN: { #ifdef MAC LList_PageDown: #endif if (k.Down()) { int Vis = VisibleItems(); Vis = MAX(Vis, 0); KeyScroll(Keyboard+Vis, Keyboard, k.Shift()); } Status = true; break; } case LK_END: { #ifdef MAC LList_End: #endif if (k.Down()) KeyScroll((int)Items.Length()-1, Keyboard, k.Shift()); Status = true; break; } case LK_HOME: { #ifdef MAC LList_Home: #endif if (k.Down()) KeyScroll(0, Keyboard, k.Shift()); Status = true; break; } #ifdef VK_APPS case VK_APPS: { if (k.Down()) { LListItem *s = GetSelected(); if (s) { LRect *r = &s->Pos; if (r) { LMouse m; LListItem *FirstVisible = ItemAt((VScroll) ? (int)VScroll->Value() : 0); m.x = 32 + ItemsPos.x1; m.y = r->y1 + (r->Y() >> 1) - (FirstVisible ? FirstVisible->Pos.y1 : 0) + ItemsPos.y1; m.Target = this; m.ViewCoords = true; m.Down(true); m.Right(true); OnMouseClick(m); } Status = true; } } break; } #endif default: { if ( !Status && k.IsChar && ( IsDigit(k.c16) || IsAlpha(k.c16) || strchr("_.-", k.c16) ) ) { if (k.Down()) { uint64 Now = LCurrentTime(); LStringPipe p; if (d->KeyBuf && Now < d->KeyLast + 1500) { p.Push(d->KeyBuf); } DeleteArray(d->KeyBuf); d->KeyLast = Now; p.Push(&k.c16, 1); d->KeyBuf = p.NewStrW(); if (d->KeyBuf) { char *c8 = WideToUtf8(d->KeyBuf); if (c8) { int Col = 0; bool Ascend = true; for (int i=0; iHasSort()) { Col = i; if (c->UpArrow()) { Ascend = false; } } } bool Selected = false; auto It = Ascend ? Items.begin() : Items.rbegin(); for (; It.In(); Ascend ? ++It : --It) { LListItem *i = *It; if (!Selected) { const char *t = i->GetText(Col); if (t && stricmp(t, c8) >= 0) { i->Select(true); i->ScrollTo(); Selected = true; } else { i->Select(false); } } else { i->Select(false); } } DeleteArray(c8); } } } Status = true; } break; } } } return Status; } LCursor LList::GetCursor(int x, int y) { LItemColumn *Resize, *Over; HitColumn(x, y, Resize, Over); if (Resize) return LCUR_SizeHor; return LCUR_Normal; } void LList::OnMouseClick(LMouse &m) { // m.Trace("LList::OnMouseClick"); if (Lock(_FL)) { if (m.Down()) { Focus(true); DragMode = DRAG_NONE; d->DragStart.x = m.x; d->DragStart.y = m.y; if (ColumnHeaders() && ColumnHeader.Overlap(m.x, m.y)) { // Clicked on a column heading LItemColumn *Resize, *Over; int Index = HitColumn(m.x, m.y, Resize, Over); if (Resize) { if (m.Double()) { if (m.CtrlCmd()) { ResizeColumnsToContent(); } else { ColSizes Sizes; GetColumnSizes(Sizes); int AvailablePx = GetClient().X() - 5; if (VScroll) AvailablePx -= VScroll->X(); int ExpandPx = AvailablePx - (Sizes.FixedPx + Sizes.ResizePx); if (ExpandPx > 0) { int MaxPx = Resize->GetContentSize() + DEFAULT_COLUMN_SPACING; int AddPx = MIN(ExpandPx, MaxPx - Resize->Width()); if (AddPx > 0) { Resize->Width(Resize->Width() + AddPx); ClearDs(Index); Invalidate(); } } } } else { DragMode = RESIZE_COLUMN; d->DragData = (int)Columns.IndexOf(Resize); Capture(true); } } else { DragMode = CLICK_COLUMN; d->DragData = (int)Columns.IndexOf(Over); if (Over) { Over->Value(true); LRect r = Over->GetPos(); Invalidate(&r); Capture(true); } } } else if (ItemsPos.Overlap(m.x, m.y)) { // Clicked in the items area bool HandlerHung = false; int ItemIndex = -1; LListItem *Item = HitItem(m.x, m.y, &ItemIndex); // LViewI *Notify = Item ? (GetNotify()) ? GetNotify() : GetParent() : 0; d->DragData = ItemIndex; if (Item && Item->Select()) { // Click on selected item if (m.CtrlCmd()) { Item->Select(false); OnItemClick(Item, m); } else { // Could be drag'n'drop operation // Or just a select int64 StartHandler = LCurrentTime(); // this will get set if 'this' is deleted. bool DeleteFlag = false; // Setup the delete flag pointer d->DeleteFlag = &DeleteFlag; // Do the event... may delete 'this' object, or hang for a long time OnItemClick(Item, m); // If the object has been deleted... exit out of here NOW! if (DeleteFlag) { return; } // Shut down the delete flag pointer... it'll point to invalid stack soon. d->DeleteFlag = 0; // Check if the handler hung for a long time... uint64 Now = LCurrentTime(); HandlerHung = Now - StartHandler > 200; if (!HandlerHung && !m.Double() && !m.IsContextMenu()) { // Start d'n'd watcher pulse... SetPulse(100); Capture(true); DragMode = CLICK_ITEM; } if (!IsCapturing()) { // If capture failed then we reset the dragmode... DragMode = DRAG_NONE; } } } else { // Selection change if (m.Shift() && MultiSelect()) { int n = 0; int a = MIN(ItemIndex, Keyboard); int b = MAX(ItemIndex, Keyboard); LArray Sel; ForAllItems(i) { bool s = n >= a && n <= b; if (i->d->Selected ^ s) { i->d->Selected = s; i->Update(); } if (s) Sel.Add(i); n++; } OnItemSelect(Sel); if (Item) Item->Select(true); } else { bool PostSelect = false; bool SelectionChanged = false; // Temporaily turn off selection events... // and just send one at the end. // d->NoSelectEvent = true; ForAllItems(i) { if (Item == i) // clicked item { if (m.CtrlCmd()) { // Toggle selected state if (!i->Select()) { Keyboard = (int)Items.IndexOf(i); } i->Select(!i->Select()); SelectionChanged = true; } else { // Select this after we have delselected everything else PostSelect = true; } } else if (!m.CtrlCmd() || !MultiSelect()) { if (i->Select()) { i->Select(false); SelectionChanged = true; } } } if (PostSelect) { SelectionChanged |= Item->Select() == false; Item->Select(true); Keyboard = (int)Items.IndexOf(Item); } if (!m.CtrlCmd() && Items.Length() && !m.IsContextMenu()) { DragMode = SELECT_ITEMS; SetPulse(100); Capture(true); } if (SelectionChanged) { SendNotify(LNotifyItemSelect); } // d->NoSelectEvent = false; } OnItemClick(Item, m); } if (!HandlerHung) { if (m.IsContextMenu()) SendNotify(LNotification(m, LNotifyItemContextMenu)); else if (Item || m.Double()) SendNotify(LNotification(m)); else SendNotify(LNotification(m, LNotifyContainerClick)); } } } else // Up Click { switch (DragMode) { case CLICK_COLUMN: { if (d->DragData < 0) break; LItemColumn *c = Columns[d->DragData]; if (c) { c->Value(false); LRect cpos = c->GetPos(); Invalidate(&cpos); if (cpos.Overlap(m.x, m.y)) { OnColumnClick((int)Columns.IndexOf(c), m); } } else { OnColumnClick(-1, m); } break; } case CLICK_ITEM: { // This code allows the user to change a larger selection // down to a single item, by clicking on that item. This // can't be done on the down click because the user may also // be clicking the selected items to drag them somewhere and // if we de-selected all but the clicked item on the down // click they would never be able to drag and drop more than // one item. // // However we also do not want this to select items after the // contents of the list box have changed since the down click if (d->DragData >= Items.Length()) break; auto Item = Items.ItemAt(d->DragData); if (Item) { bool Change = false; LArray s; ForAllItems(i) { bool Sel = Item == i; if (Sel ^ i->Select()) { Change = true; i->Select(Sel); if (Sel) { s.Add(i); } } } if (Change) OnItemSelect(s); } break; } case DRAG_COLUMN: { // End column drag if (DragCol) { LRect DragPos = DragCol->GetPos(); LPoint p(DragPos.x1 + (DragPos.X()/2), 0); PointToView(p); int OldIndex = DragCol->GetIndex(); int Best = 100000000, NewIndex = OldIndex, i=0, delta; for (i=0; iGetPos().x1); if (delta < Best) { Best = delta; NewIndex = i - (i > OldIndex ? 1 : 0); } } delta = abs(p.x - Columns.Last()->GetPos().x2); if (delta < Best) { NewIndex = i; } LItemColumn *Col = DragCol->GetColumn(); if (OldIndex != NewIndex && OnColumnReindex(Col, OldIndex, NewIndex)) { Columns.SetFixedLength(false); Columns.Delete(Col, true); Columns.AddAt(OldIndex < NewIndex ? NewIndex-1 : NewIndex, Col); Columns.SetFixedLength(true); UpdateAllItems(); } DragCol->Quit(); DragCol = NULL; } Invalidate(); break; } + default: + break; } LListItem *Item = HitItem(m.x, m.y); if (Item) { OnItemClick(Item, m); } if (IsCapturing()) { Capture(false); } DragMode = DRAG_NONE; } Unlock(); } } void LList::OnPulse() { if (!Lock(_FL)) return; if (IsCapturing()) { LMouse m; bool HasMs = GetMouse(m); // m.Trace("LList::OnPulse"); if (HasMs && (m.y < 0 || m.y >= Y())) { switch (DragMode) { case SELECT_ITEMS: { int OverIndex = 0; LListItem *Over = 0; if (m.y < 0) { int Space = -m.y; int n = FirstVisible - 1; for (auto It = Items.begin(n); It != Items.end(); --It, n--) { LListItem *i = *It; LPoint Info; i->OnMeasure(&Info); if (Space > Info.y) { Space -= Info.y; } else { OverIndex = n; Over = i; break; } } if (!Over) { Over = Items[0]; OverIndex = 0; } } else if (m.y >= Y()) { int Space = m.y - Y(); int n = LastVisible + 1; for (auto It = Items.begin(n); It != Items.end(); ++It, n++) { LListItem *i = *It; LPoint Info; i->OnMeasure(&Info); if (Space > Info.y) { Space -= Info.y; } else { OverIndex = n; Over = i; break; } } if (!Over) { Over = *Items.rbegin(); OverIndex = (int)Items.Length()-1; } } int Min = MIN(d->DragData, OverIndex); int Max = MAX(d->DragData, OverIndex); int n = Min; for (auto It = Items.begin(Min); It != Items.end() && n <= Max; ++It, n++) { LListItem *i = *It; if (!i->Select()) i->Select(true); } if (Over) { Over->ScrollTo(); } break; } + default: + break; } } } else { DragMode = DRAG_NONE; SetPulse(); } Unlock(); } void LList::OnMouseMove(LMouse &m) { if (!Lock(_FL)) return; // m.Trace("LList::OnMouseMove"); switch (DragMode) { case DRAG_COLUMN: { if (DragCol) { LPoint p; PointToScreen(p); LRect r = DragCol->GetPos(); r.Offset(-p.x, -p.y); // to view co-ord r.Offset(m.x - DragCol->GetOffset() - r.x1, 0); if (r.x1 < 0) r.Offset(-r.x1, 0); if (r.x2 > X()-1) r.Offset((X()-1)-r.x2, 0); r.Offset(p.x, p.y); // back to screen co-ord DragCol->SetPos(r, true); r = DragCol->GetPos(); } break; } case RESIZE_COLUMN: { LItemColumn *c = Columns[d->DragData]; if (c) { // int OldWidth = c->Width(); int NewWidth = m.x - c->GetPos().x1; c->Width(MAX(NewWidth, 4)); ClearDs(d->DragData); Invalidate(); } break; } case CLICK_COLUMN: { if (d->DragData < 0 || d->DragData >= Columns.Length()) break; LItemColumn *c = Columns[d->DragData]; if (c) { if (abs(m.x - d->DragStart.x) > DRAG_THRESHOLD || abs(m.y - d->DragStart.y) > DRAG_THRESHOLD) { OnColumnDrag(d->DragData, m); } else { bool Over = c->GetPos().Overlap(m.x, m.y); if (m.Down() && Over != c->Value()) { c->Value(Over); LRect r = c->GetPos(); Invalidate(&r); } } } break; } case SELECT_ITEMS: { int n=0; // bool Selected = m.y < ItemsPos.y1; if (IsCapturing()) { if (MultiSelect()) { int Over = -1; HitItem(m.x, m.y, &Over); if (m.y < ItemsPos.y1 && FirstVisible == 0) { Over = 0; } else { int n = FirstVisible; for (auto it = Items.begin(n); it != Items.end(); it++) { auto k = *it; if (!k->OnScreen()) break; if ((m.y >= k->Pos.y1) && (m.y <= k->Pos.y2)) { Over = n; break; } n++; } } if (Over >= 0) { n = 0; int Start = MIN(Over, d->DragData); int End = MAX(Over, d->DragData); ForAllItems(i) { i->Select(n >= Start && n <= End); n++; } } } else { ForAllItems(i) { i->Select(i->Pos.Overlap(m.x, m.y)); } } } break; } case CLICK_ITEM: { if (d->DragData >= Items.Length()) break; auto Cur = Items.ItemAt(d->DragData); if (Cur) { Cur->OnMouseMove(m); if (IsCapturing() && (abs(d->DragStart.x-m.x) > DRAG_THRESHOLD || abs(d->DragStart.y-m.y) > DRAG_THRESHOLD)) { Capture(false); OnItemBeginDrag(Cur, m); DragMode = DRAG_NONE; } } break; } default: { List s; if (GetSelection(s)) { for (auto c: s) { LMouse ms = m; ms.x -= c->Pos.x1; ms.y -= c->Pos.y1; c->OnMouseMove(ms); } } break; } } Unlock(); } int64 LList::Value() { int n=0; ForAllItems(i) { if (i->Select()) { return n; } n++; } return -1; } void LList::Value(int64 Index) { int n=0; ForAllItems(i) { if (n == Index) { i->Select(true); Keyboard = n; } else { i->Select(false); } n++; } } void LList::SelectAll() { if (Lock(_FL)) { ForAllItems(i) { i->d->Selected = true; } Unlock(); Invalidate(); } } bool LList::Select(LListItem *Obj) { bool Status = false; ForAllItems(i) { i->Select(Obj == i); if (Obj == i) Status = true; } return true; } LListItem *LList::GetSelected() { LListItem *n = 0; if (Lock(_FL)) { ForAllItems(i) { if (i->Select()) { n = i; break; } } Unlock(); } return n; } bool LList::GetUpdateRegion(LListItem *i, LRegion &r) { r.Empty(); if (d->Mode == LListDetails) { if (i->Pos.Valid()) { LRect u = i->Pos; u.y2 = ItemsPos.y2; r.Union(&u); return true; } } else if (d->Mode == LListColumns) { if (i->Pos.Valid()) { LRect u = i->Pos; u.y2 = ItemsPos.y2; r.Union(&u); u.x1 = u.x2 + 1; u.y1 = ItemsPos.y1; r.Union(&u); return true; } } return false; } bool LList::Insert(LListItem *i, int Index, bool Update) { List l; l.Insert(i); return Insert(l, Index, Update); } bool LList::Insert(List &l, int Index, bool Update) { bool Status = false; if (Lock(_FL)) { bool First = Items.Length() == 0; // Insert list of items for (auto i: l) { if (i->Parent != this) { i->Parent = this; i->Select(false); Items.Insert(i, Index); i->OnInsert(); if (Index >= 0) Index++; if (First) { First = false; Keyboard = 0; i->Select(true); } } } Status = true; Unlock(); if (Update) { // Update screen PourAll(); Invalidate(); // Notify SendNotify(LNotifyItemInsert); } } return Status; } bool LList::Delete(ssize_t Index) { return Delete(Items.ItemAt(Index)); } bool LList::Delete(LListItem *i) { bool Status = false; if (Lock(_FL)) { if (Remove(i)) { // Delete DeleteObj(i); Status = true; } Unlock(); } return Status; } bool LList::Remove(LListItem *i) { bool Status = false; if (Lock(_FL)) { if (i && i->GetList() == this) { LRegion Up; bool Visible = GetUpdateRegion(i, Up); bool Selected = i->Select(); int Index = (int)Items.IndexOf(i); int64 Pos = (VScroll) ? VScroll->Value() : 0; // Remove from list Items.Delete(i); i->OnRemove(); i->Parent = 0; UpdateScrollBars(); // Update screen if ((VScroll && VScroll->Value() != Pos) || Index < FirstVisible) { Invalidate(&ItemsPos); } else if (Visible) { Up.y2 = ItemsPos.y2; Invalidate(&Up); } // Notify LViewI *Note = GetNotify() ? GetNotify() : GetParent(); if (Note) { if (Selected) { LArray s; OnItemSelect(s); } LNotification n(LNotifyItemDelete); Note->OnNotify(this, n); } Status = true; } Unlock(); } return Status; } bool LList::HasItem(LListItem *Obj) { return Items.HasItem(Obj); } int LList::IndexOf(LListItem *Obj) { return (int)Items.IndexOf(Obj); } LListItem *LList::ItemAt(size_t Index) { return Index < Items.Length() ? Items.ItemAt(Index) : NULL; } void LList::ScrollToSelection() { if (VScroll) { int n=0; int Vis = VisibleItems(); ForAllItems(i) { if (i->Select()) { if (n < FirstVisible || n > LastVisible) { int k = n - (Vis/2); VScroll->Value(MAX(k, 0)); Invalidate(&ItemsPos); break; } } n++; } } } void LList::Empty() { if (Lock(_FL)) { ForAllItems(i) { LAssert(i->Parent == this); i->Parent = 0; DeleteObj(i); } Items.Empty(); FirstVisible = LastVisible = -1; DragMode = DRAG_NONE; if (VScroll) { VScroll->Value(0); VScroll->SetRange(0); } Invalidate(); DeleteArray(d->KeyBuf); Unlock(); } } void LList::RemoveAll() { if (Lock(_FL)) { if (Items.Length()) { LArray s; OnItemSelect(s); } for (auto i: Items) { i->OnRemove(); i->Parent = 0; } Items.Empty(); FirstVisible = LastVisible = -1; DragMode = DRAG_NONE; if (VScroll) { // these have to be in this order because // "SetLimits" can cause the VScroll object to // be deleted and becoming NULL VScroll->Value(0); VScroll->SetRange(0); } Invalidate(); DeleteArray(d->KeyBuf); Unlock(); } } void LList::OnPosChange() { LLayout::OnPosChange(); } void LList::UpdateScrollBars() { static bool Processing = false; if (!Processing && InThread()) { Processing = true; if (VScroll) { int Vis = VisibleItems(); int Max = MaxScroll(); if (VScroll->Value() > MAX(Max, 0)) { VScroll->Value(Max); } VScroll->SetPage(Vis); VScroll->SetRange(Items.Length()); } if (HScroll) { HScroll->SetPage(d->VisibleColumns); HScroll->SetRange(d->Columns); } Processing = false; } } void LList::PourAll() { #if LList_POUR_PROFILE LProfile Prof("PourAll()", 100); #endif // Layout all the elements LRect Client = GetClient(); LFont *Font = GetFont(); if (d->Mode == LListDetails) { if (ColumnHeaders()) { ColumnHeader = Client; ColumnHeader.y2 = ColumnHeader.y1 + Font->GetHeight() + 4; ItemsPos = Client; ItemsPos.y1 = ColumnHeader.y2 + 1; } else { ItemsPos = Client; ColumnHeader.ZOff(-1, -1); } int n = 0; int y = ItemsPos.y1; int Max = MaxScroll(); FirstVisible = (VScroll) ? (int)VScroll->Value() : 0; if (FirstVisible > Max) FirstVisible = Max; LastVisible = 0x7FFFFFFF; CompletelyVisible = 0; bool SomeHidden = false; // Process visible flag ForAllItems(i) { auto css = i->GetCss(); i->d->Visible = !css || css->Display() != LCss::DispNone; } #if LList_POUR_PROFILE Prof.Add("List items"); #endif ForAllItems(i) { if (!i->d->Visible) { i->Pos.Set(-1, -1, -2, -2); SomeHidden = true; continue; // Don't increment 'n' } if (n < FirstVisible || n > LastVisible) { i->Pos.Set(-1, -1, -2, -2); SomeHidden = true; } else { LPoint Info; i->OnMeasure(&Info); if (i->Pos.Valid() && Info.y != i->Pos.Y()) { // This detects changes in item height and invalidates the items below this one. LRect in(0, y+Info.y, X()-1, Y()-1); Invalidate(&in); } i->Pos.Set(ItemsPos.x1, y, ItemsPos.x2, y+Info.y-1); y = y+Info.y; if (i->Pos.y2 > ItemsPos.y2) { LastVisible = n; SomeHidden = true; } else { CompletelyVisible++; } } n++; } if (LastVisible >= Items.Length()) { LastVisible = (int)Items.Length() - 1; } SetScrollBars(false, SomeHidden); UpdateScrollBars(); } else if (d->Mode == LListColumns) { ColumnHeader.ZOff(-1, -1); ItemsPos = Client; FirstVisible = 0; int CurX = 0; int CurY = 0; int MaxX = 16; LArray Col; d->Columns = 1; d->VisibleColumns = 0; int64 ScrollX = HScroll ? HScroll->Value() : 0; int64 OffsetY = HScroll ? 0 : LScrollBar::GetScrollSize(); FirstVisible = -1; int n = 0; #if LList_POUR_PROFILE Prof.Add("List cols"); #endif ForAllItems(i) { LPoint Info; i->OnMeasure(&Info); if (d->Columns <= ScrollX || CurX > ItemsPos.X()) { i->Pos.ZOff(-1, -1); i->d->LayoutColumn = d->Columns; if (ItemsPos.y1 + CurY + Info.y > ItemsPos.y2 - OffsetY) { CurY = 0; d->Columns++; if (d->Columns > ScrollX && CurX < ItemsPos.X()) { goto FlowItem; } } } else { FlowItem: if (ItemsPos.y1 + CurY + Info.y > ItemsPos.y2 - OffsetY) { // wrap to next column for (int n=0; nPos.x2 = CurX + MaxX - 1; } Col.Length(0); CurX += MaxX; CurY = 0; d->Columns++; if (CurX < ItemsPos.X()) { d->VisibleColumns++; } } if (FirstVisible < 0) FirstVisible = n; LastVisible = n; i->d->LayoutColumn = d->Columns; i->Pos.ZOff(Info.x-1, Info.y-1); i->Pos.Offset(ItemsPos.x1 + CurX, ItemsPos.y1 + CurY); Col[Col.Length()] = i; MaxX = MAX(MaxX, Info.x); CompletelyVisible++; } CurY += Info.y; n++; } d->VisibleColumns = MAX(1, d->VisibleColumns); // pour remaining items... for (n=0; nPos.x2 = CurX + MaxX - 1; } Col.Length(0); if (CurX + MaxX < ItemsPos.X()) { d->VisibleColumns++; } // printf("%u - ScrollX=%i VisCol=%i Cols=%i\n", (uint32)LCurrentTime(), ScrollX, d->VisibleColumns, d->Columns); SetScrollBars(d->VisibleColumns < d->Columns, false); UpdateScrollBars(); } } static LColour Tint(LColour back, double amt) { bool Darken = back.GetGray() >= 128; LColour Mixer = Darken ? LColour::Black : LColour::White; return back.Mix(Mixer, (float)(1.0f - amt)); } void LList::OnPaint(LSurface *pDC) { #if LList_ONPAINT_PROFILE int Start = LCurrentTime(), t1, t2, t3, t4, t5; #endif if (!Lock(_FL)) return; LCssTools Tools(this); LColour DisabledTint(L_MED); LColour Workspace(L_WORKSPACE); LColour NonFocusBack(L_NON_FOCUS_SEL_BACK); LColour Fore = Enabled() ? Tools.GetFore() : Tools.GetFore().Mix(DisabledTint); LColour Back = Tools.GetBack(&Workspace, 0); double NonFocusBackAmt = (double)NonFocusBack.GetGray() / Workspace.GetGray(); if (!Enabled()) Back = Back.Mix(DisabledTint); LColour SelFore(Focus() ? L_FOCUS_SEL_FORE : L_NON_FOCUS_SEL_FORE); LColour SelBack(Focus() ? L_FOCUS_SEL_BACK : (Enabled() ? Tint(Back, NonFocusBackAmt) : DisabledTint)); PourAll(); // printf("ListPaint SelFore=%s SelBack=%s Back=%s %f NonFocusBack=%s\n", SelFore.GetStr(), SelBack.GetStr(), Back.GetStr(), NonFocusBackAmt, NonFocusBack.GetStr()); #if LList_ONPAINT_PROFILE t1 = LCurrentTime(); #endif // Check icon column status then draw if (AskImage() && !IconCol) { IconCol.Reset(new LItemColumn(this, 0, 18)); if (IconCol) { IconCol->Resizable(false); IconCol->HasImage(true); } } else if (!AskImage()) IconCol.Reset(); PaintColumnHeadings(pDC); #if LList_ONPAINT_PROFILE t2 = LCurrentTime(); #endif // Draw items if (!Buf) Buf = new LMemDC; LRect r = ItemsPos; int n = FirstVisible; int LastY = r.y1; LCss::ColorDef Fill; int LastSelected = -1; LItem::ItemPaintCtx Ctx; Ctx.pDC = pDC; LRegion Rgn(ItemsPos); if (Items.Length()) { for (auto It = Items.begin(n); It != Items.end(); ++It, n++) { LListItem *i = *It; if (i->Pos.Valid()) { // Setup painting colours in the context if (LastSelected ^ (int)i->Select()) { if ((LastSelected = i->Select())) { Ctx.Fore = SelFore; Ctx.Back = SelBack; } else { Ctx.Fore = Fore; Ctx.Back = Back; } } // tell the item what colour to use #if DOUBLE_BUFFER_PAINT if (Buf->X() < i->Pos.X() || Buf->Y() < i->Pos.Y()) { Buf->Create(i->Pos.X(), i->Pos.Y(), GdcD->GetBits()); } Ctx = i->Pos; Ctx.r.Offset(-Ctx.r.x1, -Ctx.r.y1); i->OnPaint(Ctx); pDC->Blt(i->Pos.x1, i->Pos.y1, Buf, &Ctx.r); #else (LRect&)Ctx = i->Pos; i->OnPaint(Ctx); #endif Rgn.Subtract(&i->Pos); LastY = i->Pos.y2 + 1; } } } pDC->Colour(Back); for (LRect *w=Rgn.First(); w; w=Rgn.Next()) { pDC->Rectangle(w); } Unlock(); #if LList_ONPAINT_PROFILE int64 End = LCurrentTime(); printf("LList::OnPaint() pour=%i headers=%i items=%i\n", (int) (t1-Start), (int) (t2-t1), (int) (End-t2)); #endif } void LList::OnFocus(bool b) { LListItem *s = GetSelected(); if (Items.Length()) { if (!s) { s = Items[0]; if (s) s->Select(true); } for (auto It = Items.begin(FirstVisible); It != Items.end(); ++It) { auto i = *It; if (i->Pos.Valid() && i->d->Selected) { Invalidate(&i->Pos); } } } LLayout::OnFocus(b); if (!b && IsCapturing()) { Capture(false); } } void LList::UpdateAllItems() { if (Lock(_FL)) { bool needsRepour = false; ForAllItems(i) { auto css = i->GetCss(); bool vis = !css || css->Display() != LCss::DispNone; if (i->d->Visible != vis) needsRepour = true; i->d->EmptyDisplay(); } Unlock(); if (needsRepour) PourAll(); Invalidate(); } } int LList::GetContentSize(int Index) { int Max = 0; for (auto It = Items.begin(); It.In(); It++) { LListItem *i = *It; LDisplayString *s = i->d->Display[Index]; LDisplayString *Mem = 0; // If no cached string, create it for the list item if (!s || s->IsTruncated()) { LFont *f = i->GetFont(); if (!f) f = GetFont(); if (!f) f = LSysFont; const char *Text = i->d->Str[Index] ? i->d->Str[Index] : i->GetText(Index); if (s && s->IsTruncated()) { s = Mem = new LDisplayString(f, Text?Text:(char*)""); } else { s = i->d->Display[Index] = new LDisplayString(f, Text?Text:(char*)""); } } // Measure it if (s) { Max = MAX(Max, s->X()); } DeleteObj(Mem); } // Measure the heading too LItemColumn *Col = Columns[Index]; LFont *f = GetFont(); LAssert(f != 0); if (f) { LDisplayString h(f, Col->Name()); int Hx = h.X() + (Col->HasSort() ? 10 : 0); Max = MAX(Max, Hx); } return Max; } diff --git a/src/mac/cocoa/General.mm b/src/mac/cocoa/General.mm --- a/src/mac/cocoa/General.mm +++ b/src/mac/cocoa/General.mm @@ -1,603 +1,603 @@ // Mac Implementation of General LGI functions #include #include #include #include #include // #define _POSIX_TIMERS #include #include "lgi/common/Lgi.h" #include "lgi/common/Process.h" #include "lgi/common/TextLabel.h" #include "lgi/common/Button.h" #include "lgi/common/Net.h" #include "lgi/common/Uri.h" #include #include #include //////////////////////////////////////////////////////////////// // Local helper functions CFStringRef Utf8ToCFString(const char *s, ssize_t len = -1) { if (s && len < 0) len = strlen(s); return CFStringCreateWithBytes(kCFAllocatorDefault, (const UInt8*)s, len, kCFStringEncodingUTF8, false); } char *CFStringToUtf8(CFStringRef r) { if (r == NULL) return 0; char *Buffer = 0; CFRange g = { 0, CFStringGetLength(r) }; CFIndex Used; if (CFStringGetBytes(r, g, kCFStringEncodingUTF8, 0, false, 0, 0, &Used)) { if ((Buffer = new char[Used+1])) { CFStringGetBytes(r, g, kCFStringEncodingUTF8, 0, false, (UInt8*)Buffer, Used, &Used); Buffer[Used] = 0; } } return Buffer; } bool _lgi_check_file(char *Path) { if (Path) { if (LFileExists(Path)) { // file is there return true; } else { // shortcut? char *e = Path + strlen(Path); strcpy(e, ".lnk"); if (LFileExists(Path)) { // resolve shortcut char Link[256]; if (LResolveShortcut(Path, Link, sizeof(Link))) { // check destination of link if (LFileExists(Link)) { strcpy(Path, Link); return true; } } } *e = 0; } } return false; } void LSleep(uint32 i) { struct timespec request, remain; ZeroObj(request); ZeroObj(remain); request.tv_sec = i / 1000; request.tv_nsec = (i % 1000) * 1000000; while (nanosleep(&request, &remain) == -1) { request = remain; } } char *p2c(unsigned char *s) { if (s) { s[1+s[0]] = 0; return (char*)s + 1; } return 0; } void c2p255(Str255 &d, char *s) { if (s) { size_t Len = strlen(s); if (Len > 255) Len = 255; d[0] = Len; for (int i=0; iHandle(); [hnd.p performSelectorOnMainThread:@selector(assert:) withObject:ca waitUntilDone:true]; switch (ca.result) { case NSAlertFirstButtonReturn: // Debug/Break Result = 2; break; case NSAlertSecondButtonReturn: // Ingore/Continue Result = 3; break; case NSAlertThirdButtonReturn: // Exit/Abort Result = 1; break; } [ca release]; } #else - GAlert a(0, "Assert Failed", Assert.Msg, "Abort", "Debug", "Ignore"); + LAlert a(0, "Assert Failed", Assert.Msg, "Abort", "Debug", "Ignore"); Result = a.DoModal(); #endif switch (Result) { default: { exit(-1); break; } case 2: { // Crash here to bring up the debugger... int *p = 0; *p = 0; break; } case 3: { break; } } #endif Asserting = false; } } //////////////////////////////////////////////////////////////////////// // Implementations LMessage CreateMsg(int m, LMessage::Param a, LMessage::Param b) { static class LMessage Msg(0); Msg.Set(m, a, b); return Msg; } OsView DefaultOsView(LView *v) { return NULL; } LString LGetFileMimeType(const char *File) { return LAppInst ? LAppInst->GetFileMimeType(File) : NULL; } bool _GetIniField(char *Grp, char *Field, char *In, char *Out, int OutSize) { if (ValidStr(In)) { bool InGroup = false; auto t = LString(In).SplitDelimit("\r\n"); for (int i=0; i Ver; LgiGetOs(Ver); if (Ver.Length() > 1) { if (Ver[0] < 10 || Ver[1] < 6) { IsAppBundle = false; } } } */ } struct stat s; int st = stat(File, &s); if (IsAppBundle) { char cmd[512]; if (ValidStr((char*)Args)) snprintf(cmd, sizeof(cmd), "open -a \"%s\" %s", File, Args); else snprintf(cmd, sizeof(cmd), "open -a \"%s\"", File); system(cmd); } else if (st == 0 && S_ISREG(s.st_mode) && (s.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) { // This is an executable file if (!fork()) { if (Dir) chdir(Dir); LArray a; a.Add(File); char *p; while ((p = LTokStr(Args))) { a.Add(p); } a.Add(0); char *env[] = {0}; execve(File, (char*const*)&a[0], env); } return true; } else { // Document #if LGI_CARBON e = FinderLaunch(1, &r); if (e) printf("%s:%i - FinderLaunch faied with %i\n", _FL, (int)e); else Status = true; #elif LGI_COCOA LString file = File; auto url = [[NSURL alloc] initFileURLWithPath:file.NsStr()]; Status = [[NSWorkspace sharedWorkspace] openURL:url]; #endif } } } } return Status; } bool LGetMimeTypeExtensions(const char *Mime, LArray &Ext) { size_t Start = Ext.Length(); #define HardCodeExtention(Mime, Ext1, Ext2) \ else if (!stricmp(Mime, Mime)) \ { if (Ext1) Ext.Add(Ext1); \ if (Ext2) Ext.Add(Ext2); } if (!Mime); HardCodeExtention("text/calendar", "ics", (const char*)NULL) HardCodeExtention("text/x-vcard", "vcf", (const char*)NULL) HardCodeExtention("text/mbox", "mbx", "mbox"); return Ext.Length() > Start; } LString LCurrentUserName() { struct passwd *pw = getpwuid(geteuid()); if (pw) return pw->pw_name; return ""; } diff --git a/src/mac/cocoa/LgiCocoa.xcodeproj/project.pbxproj b/src/mac/cocoa/LgiCocoa.xcodeproj/project.pbxproj --- a/src/mac/cocoa/LgiCocoa.xcodeproj/project.pbxproj +++ b/src/mac/cocoa/LgiCocoa.xcodeproj/project.pbxproj @@ -1,1204 +1,1210 @@ // !$*UTF8*$! { archiveVersion = 1; classes = { }; objectVersion = 54; objects = { /* Begin PBXBuildFile section */ 340833152698F8FF0028012F /* FontPriv.h in Headers */ = {isa = PBXBuildFile; fileRef = 340833122698F8FE0028012F /* FontPriv.h */; }; 340833162698F8FF0028012F /* FontType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 340833132698F8FE0028012F /* FontType.cpp */; }; 340833172698F8FF0028012F /* TypeFace.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 340833142698F8FE0028012F /* TypeFace.cpp */; }; 3409C0CA27580ED60050302A /* ListItemRadioBtn.h in Headers */ = {isa = PBXBuildFile; fileRef = 3409C0C727580ED60050302A /* ListItemRadioBtn.h */; }; 3409C0CB27580ED60050302A /* List.h in Headers */ = {isa = PBXBuildFile; fileRef = 3409C0C827580ED60050302A /* List.h */; }; 3409C0CC27580ED60050302A /* ListItemCheckBox.h in Headers */ = {isa = PBXBuildFile; fileRef = 3409C0C927580ED60050302A /* ListItemCheckBox.h */; }; 3409C0D0275812CB0050302A /* Profile.h in Headers */ = {isa = PBXBuildFile; fileRef = 3409C0CF275812CB0050302A /* Profile.h */; }; 34109857217A9805007020CE /* LCocoaView.h in Sources */ = {isa = PBXBuildFile; fileRef = 34109856217A9805007020CE /* LCocoaView.h */; }; 34114C8B23091E6E00F342B1 /* LgiClasses.h in Headers */ = {isa = PBXBuildFile; fileRef = 34114C8A23091E6E00F342B1 /* LgiClasses.h */; }; 3413170E23068FFE008CE982 /* FileSelect.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3413170D23068FFE008CE982 /* FileSelect.cpp */; }; 34131710230694D1008CE982 /* Gel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3413170F230694D1008CE982 /* Gel.cpp */; }; 3415168F26EC32E7007EE35F /* TextView4.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3415168E26EC32E7007EE35F /* TextView4.cpp */; }; 3415169326EC32FF007EE35F /* TextView3.h in Headers */ = {isa = PBXBuildFile; fileRef = 3415169126EC32FF007EE35F /* TextView3.h */; }; 3415169426EC32FF007EE35F /* TextView4.h in Headers */ = {isa = PBXBuildFile; fileRef = 3415169226EC32FF007EE35F /* TextView4.h */; }; 3418EBCF25D9FEA600EA168A /* Progress.h in Headers */ = {isa = PBXBuildFile; fileRef = 3418EBCE25D9FEA600EA168A /* Progress.h */; }; 3418EBD125D9FEF500EA168A /* ProgressDlg.h in Headers */ = {isa = PBXBuildFile; fileRef = 3418EBD025D9FEF500EA168A /* ProgressDlg.h */; }; 3427064727A0E20C0043F733 /* CocoaView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3427064627A0E20C0043F733 /* CocoaView.mm */; }; 343874B5230F46B200CF96B4 /* Window.h in Headers */ = {isa = PBXBuildFile; fileRef = 343874B1230F46B200CF96B4 /* Window.h */; }; 343874B6230F46B200CF96B4 /* View.h in Headers */ = {isa = PBXBuildFile; fileRef = 343874B2230F46B200CF96B4 /* View.h */; }; 343874B7230F46B200CF96B4 /* App.h in Headers */ = {isa = PBXBuildFile; fileRef = 343874B3230F46B200CF96B4 /* App.h */; }; 343874B8230F46B200CF96B4 /* Layout.h in Headers */ = {isa = PBXBuildFile; fileRef = 343874B4230F46B200CF96B4 /* Layout.h */; }; 343BE8C72355D0CE00742E21 /* PopupList.h in Headers */ = {isa = PBXBuildFile; fileRef = 343BE8C62355D0CE00742E21 /* PopupList.h */; }; 3449B8CE26BBF6B10022A9B8 /* Notifications.h in Headers */ = {isa = PBXBuildFile; fileRef = 3449B8CD26BBF6B10022A9B8 /* Notifications.h */; }; 344CFBC8237365B800AE6B35 /* ClipBoard.h in Headers */ = {isa = PBXBuildFile; fileRef = 344CFBC7237365B800AE6B35 /* ClipBoard.h */; }; 345920FF1F25649000098DFD /* Font.h in Headers */ = {isa = PBXBuildFile; fileRef = 345920FC1F25649000098DFD /* Font.h */; }; 345921001F25649000098DFD /* FontCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 345920FD1F25649000098DFD /* FontCache.h */; }; 345921011F25649000098DFD /* FontSelect.h in Headers */ = {isa = PBXBuildFile; fileRef = 345920FE1F25649000098DFD /* FontSelect.h */; }; 345EB84E235C6C01007D05DB /* Popup.h in Headers */ = {isa = PBXBuildFile; fileRef = 345EB84D235C6C01007D05DB /* Popup.h */; }; 346DDEC1240C882900751380 /* RadioGroup.h in Headers */ = {isa = PBXBuildFile; fileRef = 346DDEC0240C882900751380 /* RadioGroup.h */; }; 346FACE71D3C720B00FFEBCE /* Message.h in Headers */ = {isa = PBXBuildFile; fileRef = 346FACE61D3C720B00FFEBCE /* Message.h */; }; 346FACEB1D3C75AE00FFEBCE /* Uri.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 346FACE91D3C75AE00FFEBCE /* Uri.cpp */; }; 346FACEC1D3C75AE00FFEBCE /* MDStringToDigest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 346FACEA1D3C75AE00FFEBCE /* MDStringToDigest.cpp */; }; 3471868823A9AF8900F8C952 /* SubProcess.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3471868723A9AF8900F8C952 /* SubProcess.cpp */; }; 3477C2751CBF07DD0028B84B /* App.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3477C2741CBF07DD0028B84B /* App.mm */; }; 3477C2781CBF08050028B84B /* ClipBoard.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3477C2761CBF08050028B84B /* ClipBoard.mm */; }; 3477C2821CBF086A0028B84B /* General.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3477C27A1CBF086A0028B84B /* General.mm */; }; 3477C2831CBF086A0028B84B /* Layout.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3477C27B1CBF086A0028B84B /* Layout.mm */; }; 3477C2841CBF086A0028B84B /* Menu.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3477C27C1CBF086A0028B84B /* Menu.mm */; }; 3477C2851CBF086A0028B84B /* Printer.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3477C27D1CBF086A0028B84B /* Printer.mm */; }; 3477C2861CBF086A0028B84B /* Thread.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3477C27E1CBF086A0028B84B /* Thread.mm */; }; 3477C2871CBF086A0028B84B /* View.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3477C27F1CBF086A0028B84B /* View.mm */; }; 3477C2881CBF086A0028B84B /* Widgets.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3477C2801CBF086A0028B84B /* Widgets.mm */; }; 3477C2891CBF086A0028B84B /* Window.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3477C2811CBF086A0028B84B /* Window.mm */; }; 3477C28F1CBF08C10028B84B /* Gdc2.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3477C28B1CBF08C10028B84B /* Gdc2.mm */; }; 3477C2901CBF08C10028B84B /* MemDC.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C28C1CBF08C10028B84B /* MemDC.cpp */; }; 3477C2911CBF08C10028B84B /* PrintDC.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C28D1CBF08C10028B84B /* PrintDC.cpp */; }; 3477C2921CBF08C10028B84B /* ScreenDC.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C28E1CBF08C10028B84B /* ScreenDC.cpp */; }; 3477C2971CBF09320028B84B /* File.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3477C2941CBF09320028B84B /* File.mm */; }; 3477C2981CBF09320028B84B /* Mem.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3477C2951CBF09320028B84B /* Mem.mm */; }; 3477C2991CBF09320028B84B /* ShowFileProp_Mac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3477C2961CBF09320028B84B /* ShowFileProp_Mac.mm */; }; 3477C2A11CBF0A920028B84B /* Mem.h in Headers */ = {isa = PBXBuildFile; fileRef = 3477C29B1CBF0A920028B84B /* Mem.h */; }; 3477C2A21CBF0A920028B84B /* SymLookup.h in Headers */ = {isa = PBXBuildFile; fileRef = 3477C29C1CBF0A920028B84B /* SymLookup.h */; }; 3477C2A31CBF0A920028B84B /* LgiMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 3477C29D1CBF0A920028B84B /* LgiMac.h */; }; 3477C2A41CBF0A920028B84B /* LgiOs.h in Headers */ = {isa = PBXBuildFile; fileRef = 3477C29E1CBF0A920028B84B /* LgiOs.h */; }; 3477C2A51CBF0A920028B84B /* LgiOsClasses.h in Headers */ = {isa = PBXBuildFile; fileRef = 3477C29F1CBF0A920028B84B /* LgiOsClasses.h */; }; 3477C2A61CBF0A920028B84B /* LgiOsDefs.h in Headers */ = {isa = PBXBuildFile; fileRef = 3477C2A01CBF0A920028B84B /* LgiOsDefs.h */; }; 3477C2A81CBF0AAF0028B84B /* Lgi.h in Headers */ = {isa = PBXBuildFile; fileRef = 3477C2A71CBF0AAF0028B84B /* Lgi.h */; }; 3477C2AA1CBF22A00028B84B /* File.h in Headers */ = {isa = PBXBuildFile; fileRef = 3477C2A91CBF22A00028B84B /* File.h */; }; 3477C2AC1CBF72170028B84B /* ViewPriv.h in Headers */ = {isa = PBXBuildFile; fileRef = 3477C2AB1CBF72170028B84B /* ViewPriv.h */; }; 3477C2AF1CBF96B90028B84B /* LgiRes.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C2AE1CBF96B90028B84B /* LgiRes.cpp */; }; 3477C2B11CBF96C40028B84B /* Res.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C2B01CBF96C40028B84B /* Res.cpp */; }; 3477C2B41CBF96F20028B84B /* LMsg.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C2B31CBF96F20028B84B /* LMsg.cpp */; }; 3477C2B71CBF973F0028B84B /* GuiUtils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C2B61CBF973F0028B84B /* GuiUtils.cpp */; }; 3477C2B91CBF977F0028B84B /* LgiCommon.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C2B81CBF977F0028B84B /* LgiCommon.cpp */; }; 3477C2BB1CBF97C80028B84B /* GdcCommon.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C2BA1CBF97C80028B84B /* GdcCommon.cpp */; }; 3477C2C11CBF9A040028B84B /* String.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C2C01CBF9A040028B84B /* String.cpp */; }; 3477C2C81CC046310028B84B /* TextView3.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C2C41CC046310028B84B /* TextView3.cpp */; }; 3477C2C91CC046310028B84B /* Unicode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C2C51CC046310028B84B /* Unicode.cpp */; }; 3477C2CA1CC046310028B84B /* Utf8.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C2C61CC046310028B84B /* Utf8.cpp */; }; 3477C2CB1CC046310028B84B /* XmlTree.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C2C71CC046310028B84B /* XmlTree.cpp */; }; 3477C2CE1CC047BE0028B84B /* Charset.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C2CD1CC047BE0028B84B /* Charset.cpp */; }; 3477C2D01CC047F50028B84B /* ToolBar.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C2CF1CC047F50028B84B /* ToolBar.cpp */; }; 3477C2D31CC048100028B84B /* Containers.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C2D21CC048100028B84B /* Containers.cpp */; }; 3477C2D51CC0481B0028B84B /* Array.h in Headers */ = {isa = PBXBuildFile; fileRef = 3477C2D41CC0481B0028B84B /* Array.h */; }; 3477C2D71CC048390028B84B /* Popup.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C2D61CC048390028B84B /* Popup.cpp */; }; 3477C2DB1CC048F90028B84B /* DisplayString.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C2D81CC048F90028B84B /* DisplayString.cpp */; }; 3477C2DC1CC048F90028B84B /* Font.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C2D91CC048F90028B84B /* Font.cpp */; }; 3477C2DD1CC048F90028B84B /* FontSystem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C2DA1CC048F90028B84B /* FontSystem.cpp */; }; 3477C2DF1CC04A030028B84B /* ScrollBar.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C2DE1CC04A030028B84B /* ScrollBar.cpp */; }; 3477C2E11CC04A3C0028B84B /* FontSelect.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C2E01CC04A3C0028B84B /* FontSelect.cpp */; }; 3477C2E31CC04A5C0028B84B /* Stream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C2E21CC04A5C0028B84B /* Stream.cpp */; }; 3477C2E51CC04A7F0028B84B /* ViewCommon.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C2E41CC04A7F0028B84B /* ViewCommon.cpp */; }; 3477C2E71CC04B1E0028B84B /* Surface.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C2E61CC04B1E0028B84B /* Surface.cpp */; }; 3477C2E91CC04B5D0028B84B /* Rand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C2E81CC04B5D0028B84B /* Rand.cpp */; }; 3477C2EB1CC04B890028B84B /* Filter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C2EA1CC04B890028B84B /* Filter.cpp */; }; 3477C2EF1CC04BBB0028B84B /* ItemContainer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C2EC1CC04BBB0028B84B /* ItemContainer.cpp */; }; 3477C2F01CC04BBB0028B84B /* List.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C2ED1CC04BBB0028B84B /* List.cpp */; }; 3477C2F11CC04BBB0028B84B /* Tree.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C2EE1CC04BBB0028B84B /* Tree.cpp */; }; 3477C2FF1CC04BF00028B84B /* Bitmap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C2F21CC04BF00028B84B /* Bitmap.cpp */; }; 3477C3001CC04BF00028B84B /* Box.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C2F31CC04BF00028B84B /* Box.cpp */; }; 3477C3011CC04BF00028B84B /* Button.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C2F41CC04BF00028B84B /* Button.cpp */; }; 3477C3021CC04BF00028B84B /* CheckBox.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C2F51CC04BF00028B84B /* CheckBox.cpp */; }; 3477C3031CC04BF00028B84B /* Combo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C2F61CC04BF00028B84B /* Combo.cpp */; }; 3477C3041CC04BF00028B84B /* Edit.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C2F71CC04BF00028B84B /* Edit.cpp */; }; 3477C3051CC04BF00028B84B /* Panel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C2F81CC04BF00028B84B /* Panel.cpp */; }; 3477C3061CC04BF00028B84B /* Progress.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C2F91CC04BF00028B84B /* Progress.cpp */; }; 3477C3071CC04BF00028B84B /* RadioGroup.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C2FA1CC04BF00028B84B /* RadioGroup.cpp */; }; 3477C3081CC04BF00028B84B /* Splitter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C2FB1CC04BF00028B84B /* Splitter.cpp */; }; 3477C3091CC04BF00028B84B /* TableLayout.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C2FC1CC04BF00028B84B /* TableLayout.cpp */; }; 3477C30A1CC04BF00028B84B /* TabView.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C2FD1CC04BF00028B84B /* TabView.cpp */; }; 3477C30B1CC04BF00028B84B /* TextLabel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C2FE1CC04BF00028B84B /* TextLabel.cpp */; }; 3477C30D1CC04C560028B84B /* FindReplace.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C30C1CC04C560028B84B /* FindReplace.cpp */; }; 3477C3101CC04C790028B84B /* Css.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C30E1CC04C790028B84B /* Css.cpp */; }; 3477C3111CC04C790028B84B /* CssTools.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C30F1CC04C790028B84B /* CssTools.cpp */; }; 3477C3131CC04CB10028B84B /* Rect.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C3121CC04CB10028B84B /* Rect.cpp */; }; 3477C3161CC04CCB0028B84B /* Library.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C3151CC04CCB0028B84B /* Library.cpp */; }; 3477C3191CC04CF10028B84B /* ThreadCommon.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C3181CC04CF10028B84B /* ThreadCommon.cpp */; }; 3477C31D1CC04D3F0028B84B /* Net.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C31B1CC04D3F0028B84B /* Net.cpp */; }; 3477C3201CC04D630028B84B /* ThreadEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C31F1CC04D630028B84B /* ThreadEvent.cpp */; }; 3477C3221CC04DA00028B84B /* Colour.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C3211CC04DA00028B84B /* Colour.cpp */; }; 3477C3241CC04DD70028B84B /* Object.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C3231CC04DD70028B84B /* Object.cpp */; }; 3477C3261CC04DE20028B84B /* Mutex.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C3251CC04DE20028B84B /* Mutex.cpp */; }; 3477C3281CC04E020028B84B /* Variant.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C3271CC04E020028B84B /* Variant.cpp */; }; 3477C3311CC04E120028B84B /* 8Bit.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C3291CC04E120028B84B /* 8Bit.cpp */; }; 3477C3321CC04E120028B84B /* 64Bit.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C32A1CC04E120028B84B /* 64Bit.cpp */; }; 3477C3331CC04E120028B84B /* 16Bit.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C32B1CC04E120028B84B /* 16Bit.cpp */; }; 3477C3341CC04E120028B84B /* 24Bit.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C32C1CC04E120028B84B /* 24Bit.cpp */; }; 3477C3351CC04E120028B84B /* 32Bit.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C32D1CC04E120028B84B /* 32Bit.cpp */; }; 3477C3361CC04E120028B84B /* 48Bit.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C32E1CC04E120028B84B /* 48Bit.cpp */; }; 3477C3381CC04E120028B84B /* Alpha.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C3301CC04E120028B84B /* Alpha.cpp */; }; 3477C33A1CC04ED90028B84B /* DragAndDrop.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3477C3391CC04ED90028B84B /* DragAndDrop.mm */; }; 3477C33D1CC088590028B84B /* FileCommon.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C33C1CC088590028B84B /* FileCommon.cpp */; }; 3477C33F1CC0A6780028B84B /* Token.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C33E1CC0A6780028B84B /* Token.cpp */; }; 3477C3411CC0A68E0028B84B /* DateTime.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C3401CC0A68E0028B84B /* DateTime.cpp */; }; 3477C3431CC0A6B90028B84B /* DocView.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C3421CC0A6B90028B84B /* DocView.cpp */; }; 3477C3451CC0A9DE0028B84B /* Input.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C3441CC0A9DE0028B84B /* Input.cpp */; }; 3477C3471CC0AA220028B84B /* WindowCommon.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C3461CC0AA220028B84B /* WindowCommon.cpp */; }; 3477C3491CC0AA7E0028B84B /* ProgressDlg.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C3481CC0AA7E0028B84B /* ProgressDlg.cpp */; }; 3477C34B1CC0AB0B0028B84B /* ToolTip.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C34A1CC0AB0B0028B84B /* ToolTip.cpp */; }; 3477C34D1CC0ACED0028B84B /* md5.c in Sources */ = {isa = PBXBuildFile; fileRef = 3477C34C1CC0ACED0028B84B /* md5.c */; }; 3477C3501CC0C3D60028B84B /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3477C34F1CC0C3D60028B84B /* Cocoa.framework */; }; 3477C35B1CC1AEEA0028B84B /* LgiInc.h in Headers */ = {isa = PBXBuildFile; fileRef = 3477C35A1CC1AEEA0028B84B /* LgiInc.h */; }; 3477C35D1CC2253E0028B84B /* LgiInterfaces.h in Headers */ = {isa = PBXBuildFile; fileRef = 3477C35C1CC2253E0028B84B /* LgiInterfaces.h */; }; 3477C43A1CC234750028B84B /* MemStream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C4391CC234750028B84B /* MemStream.cpp */; }; 3477C46D1CC26DEB0028B84B /* Alert.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C46C1CC26DEB0028B84B /* Alert.cpp */; }; 3477C4ED1CC27F1C0028B84B /* TrayIcon.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C4EC1CC27F1C0028B84B /* TrayIcon.cpp */; }; 3477C5171CC303B70028B84B /* LgiUiBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 3477C5161CC303B70028B84B /* LgiUiBase.h */; }; 347AFB9827A0DC5E00BE4ABE /* 15Bit.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 347AFB9727A0DC5E00BE4ABE /* 15Bit.cpp */; }; 348362421F233A77003B2A6D /* Stream.h in Headers */ = {isa = PBXBuildFile; fileRef = 348362411F233A77003B2A6D /* Stream.h */; }; 34837C4925C677ED00D103B4 /* AppPriv.h in Headers */ = {isa = PBXBuildFile; fileRef = 34837C4825C677ED00D103B4 /* AppPriv.h */; }; 348CD46A25C63E56001AA32B /* AppCommon.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 348CD46925C63E56001AA32B /* AppCommon.cpp */; }; 348E99CE2876850F0067E92A /* ObjCWrapper.h in Headers */ = {isa = PBXBuildFile; fileRef = 348E99CD2876850F0067E92A /* ObjCWrapper.h */; }; 3491A28523678DB800604C29 /* DropFiles.h in Headers */ = {isa = PBXBuildFile; fileRef = 3491A28423678DB700604C29 /* DropFiles.h */; }; + 349F939E2B92CBAD002410A2 /* TextConvert.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 349F939D2B92CBAD002410A2 /* TextConvert.cpp */; }; 34A3ACE820568D5800B1D62A /* StringLayout.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 34A3ACE720568D5800B1D62A /* StringLayout.cpp */; }; 34A3ACEA20568D9700B1D62A /* MenuCommon.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 34A3ACE920568D9700B1D62A /* MenuCommon.cpp */; }; 34B14E3426951C6E004C22CC /* Slider.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 34B14E3326951C6E004C22CC /* Slider.cpp */; }; 34B531D822F65734002B50F7 /* Menu.h in Headers */ = {isa = PBXBuildFile; fileRef = 34B531D722F65734002B50F7 /* Menu.h */; }; 34B6B19123CFD0F100C24906 /* DragAndDropCommon.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 34B6B19023CFD0F100C24906 /* DragAndDropCommon.cpp */; }; 34BF15072871503B001B4CA5 /* DrawListSurface.h in Headers */ = {isa = PBXBuildFile; fileRef = 34BF15062871503B001B4CA5 /* DrawListSurface.h */; }; 34C072C12369878100E1E222 /* DropFiles.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 34C072C02369878100E1E222 /* DropFiles.cpp */; }; 34C81A5A25DA0AA10053F93A /* Base64.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 34C81A5925DA0AA10053F93A /* Base64.cpp */; }; 34CD9F7223D5768B0039F259 /* Unicode.h in Headers */ = {isa = PBXBuildFile; fileRef = 34CD9F7123D5768B0039F259 /* Unicode.h */; }; 34D1B3C121748A2800BC6B58 /* Path.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 34D1B3C021748A2800BC6B58 /* Path.cpp */; }; 34D21CEC217981AE003D1EA6 /* EventTargetThread.h in Headers */ = {isa = PBXBuildFile; fileRef = 34D21CEB217981AE003D1EA6 /* EventTargetThread.h */; }; 34D28926275B3D9F005961A8 /* DateTime.h in Headers */ = {isa = PBXBuildFile; fileRef = 34D28925275B3D9F005961A8 /* DateTime.h */; }; 34D28929275B3DB0005961A8 /* Variant.h in Headers */ = {isa = PBXBuildFile; fileRef = 34D28928275B3DB0005961A8 /* Variant.h */; }; 34D6AA1722D3749A005D739E /* Gdc2.h in Headers */ = {isa = PBXBuildFile; fileRef = 34D6AA1622D3749A005D739E /* Gdc2.h */; }; 34EE8BB12748A55600F12915 /* TextFile.h in Headers */ = {isa = PBXBuildFile; fileRef = 34EE8BB02748A55600F12915 /* TextFile.h */; }; 34F3EC4329BD374E00BB9B58 /* Rect.h in Headers */ = {isa = PBXBuildFile; fileRef = 34F3EC4229BD374E00BB9B58 /* Rect.h */; }; 34F6151F27E55C5D00FE5B0C /* Thread.h in Headers */ = {isa = PBXBuildFile; fileRef = 34F6151D27E55C5D00FE5B0C /* Thread.h */; }; 34F6152027E55C5D00FE5B0C /* ThreadEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 34F6151E27E55C5D00FE5B0C /* ThreadEvent.h */; }; 34F6153E27E5628600FE5B0C /* Token.h in Headers */ = {isa = PBXBuildFile; fileRef = 34F6153D27E5628600FE5B0C /* Token.h */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ 340833122698F8FE0028012F /* FontPriv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FontPriv.h; path = ../../../private/common/FontPriv.h; sourceTree = SOURCE_ROOT; }; 340833132698F8FE0028012F /* FontType.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FontType.cpp; path = ../../common/Gdc2/Font/FontType.cpp; sourceTree = SOURCE_ROOT; }; 340833142698F8FE0028012F /* TypeFace.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = TypeFace.cpp; path = ../../common/Gdc2/Font/TypeFace.cpp; sourceTree = SOURCE_ROOT; }; 3409C0C727580ED60050302A /* ListItemRadioBtn.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ListItemRadioBtn.h; path = ../../../include/lgi/common/ListItemRadioBtn.h; sourceTree = SOURCE_ROOT; }; 3409C0C827580ED60050302A /* List.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = List.h; path = ../../../include/lgi/common/List.h; sourceTree = SOURCE_ROOT; }; 3409C0C927580ED60050302A /* ListItemCheckBox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ListItemCheckBox.h; path = ../../../include/lgi/common/ListItemCheckBox.h; sourceTree = SOURCE_ROOT; }; 3409C0CF275812CB0050302A /* Profile.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = Profile.h; path = ../../../include/lgi/common/Profile.h; sourceTree = ""; }; 34109853217A975E007020CE /* View.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = View.h; path = ../../../include/lgi/common/View.h; sourceTree = SOURCE_ROOT; }; 34109856217A9805007020CE /* LCocoaView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LCocoaView.h; path = ../../../include/lgi/mac/cocoa/LCocoaView.h; sourceTree = SOURCE_ROOT; }; 34114C8A23091E6E00F342B1 /* LgiClasses.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LgiClasses.h; path = ../../../include/lgi/common/LgiClasses.h; sourceTree = ""; }; 3413170D23068FFE008CE982 /* FileSelect.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FileSelect.cpp; path = ../../common/Lgi/FileSelect.cpp; sourceTree = SOURCE_ROOT; }; 3413170F230694D1008CE982 /* Gel.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Gel.cpp; path = ../../common/Skins/Gel/Gel.cpp; sourceTree = SOURCE_ROOT; }; 3415168E26EC32E7007EE35F /* TextView4.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = TextView4.cpp; path = ../../common/Text/TextView4.cpp; sourceTree = SOURCE_ROOT; }; 3415169126EC32FF007EE35F /* TextView3.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TextView3.h; path = ../../../include/lgi/common/TextView3.h; sourceTree = SOURCE_ROOT; }; 3415169226EC32FF007EE35F /* TextView4.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TextView4.h; path = ../../../include/lgi/common/TextView4.h; sourceTree = SOURCE_ROOT; }; 3418EBCE25D9FEA600EA168A /* Progress.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Progress.h; path = ../../../include/lgi/common/Progress.h; sourceTree = ""; }; 3418EBD025D9FEF500EA168A /* ProgressDlg.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ProgressDlg.h; path = ../../../include/lgi/common/ProgressDlg.h; sourceTree = ""; }; 3427064627A0E20C0043F733 /* CocoaView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CocoaView.mm; sourceTree = SOURCE_ROOT; }; 343874B1230F46B200CF96B4 /* Window.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Window.h; path = ../../../include/lgi/common/Window.h; sourceTree = SOURCE_ROOT; }; 343874B2230F46B200CF96B4 /* View.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = View.h; path = ../../../include/lgi/common/View.h; sourceTree = ""; }; 343874B3230F46B200CF96B4 /* App.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = App.h; path = ../../../include/lgi/common/App.h; sourceTree = SOURCE_ROOT; }; 343874B4230F46B200CF96B4 /* Layout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Layout.h; path = ../../../include/lgi/common/Layout.h; sourceTree = ""; }; 343BE8C62355D0CE00742E21 /* PopupList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PopupList.h; path = ../../../include/lgi/common/PopupList.h; sourceTree = ""; }; 3449B8CD26BBF6B10022A9B8 /* Notifications.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Notifications.h; path = ../../../include/lgi/common/Notifications.h; sourceTree = ""; }; 344CFBC7237365B800AE6B35 /* ClipBoard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ClipBoard.h; path = ../../../include/lgi/common/ClipBoard.h; sourceTree = ""; }; 345920FC1F25649000098DFD /* Font.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Font.h; path = ../../../include/lgi/common/Font.h; sourceTree = SOURCE_ROOT; }; 345920FD1F25649000098DFD /* FontCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FontCache.h; path = ../../../include/lgi/common/FontCache.h; sourceTree = SOURCE_ROOT; }; 345920FE1F25649000098DFD /* FontSelect.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FontSelect.h; path = ../../../include/lgi/common/FontSelect.h; sourceTree = SOURCE_ROOT; }; 345EB84D235C6C01007D05DB /* Popup.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Popup.h; path = ../../../include/lgi/common/Popup.h; sourceTree = SOURCE_ROOT; }; 346DDEC0240C882900751380 /* RadioGroup.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RadioGroup.h; path = ../../../include/lgi/common/RadioGroup.h; sourceTree = SOURCE_ROOT; }; 346FACE61D3C720B00FFEBCE /* Message.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Message.h; path = ../../../include/lgi/common/Message.h; sourceTree = ""; }; 346FACE91D3C75AE00FFEBCE /* Uri.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Uri.cpp; path = ../../common/Net/Uri.cpp; sourceTree = SOURCE_ROOT; }; 346FACEA1D3C75AE00FFEBCE /* MDStringToDigest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = MDStringToDigest.cpp; path = ../../common/Net/MDStringToDigest.cpp; sourceTree = SOURCE_ROOT; }; 3471868723A9AF8900F8C952 /* SubProcess.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; name = SubProcess.cpp; path = ../../posix/SubProcess.cpp; sourceTree = SOURCE_ROOT; }; 3477C2681CBF020F0028B84B /* LgiCocoa.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = LgiCocoa.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 3477C26D1CBF020F0028B84B /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = SOURCE_ROOT; }; 3477C2741CBF07DD0028B84B /* App.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = App.mm; sourceTree = SOURCE_ROOT; }; 3477C2761CBF08050028B84B /* ClipBoard.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ClipBoard.mm; sourceTree = SOURCE_ROOT; }; 3477C27A1CBF086A0028B84B /* General.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = General.mm; sourceTree = SOURCE_ROOT; }; 3477C27B1CBF086A0028B84B /* Layout.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = Layout.mm; sourceTree = SOURCE_ROOT; }; 3477C27C1CBF086A0028B84B /* Menu.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = Menu.mm; sourceTree = SOURCE_ROOT; }; 3477C27D1CBF086A0028B84B /* Printer.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = Printer.mm; sourceTree = SOURCE_ROOT; }; 3477C27E1CBF086A0028B84B /* Thread.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = Thread.mm; sourceTree = SOURCE_ROOT; }; 3477C27F1CBF086A0028B84B /* View.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = View.mm; sourceTree = SOURCE_ROOT; }; 3477C2801CBF086A0028B84B /* Widgets.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = Widgets.mm; sourceTree = SOURCE_ROOT; }; 3477C2811CBF086A0028B84B /* Window.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = Window.mm; sourceTree = SOURCE_ROOT; }; 3477C28B1CBF08C10028B84B /* Gdc2.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = Gdc2.mm; sourceTree = SOURCE_ROOT; }; 3477C28C1CBF08C10028B84B /* MemDC.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; name = MemDC.cpp; path = ../common/MemDC.cpp; sourceTree = SOURCE_ROOT; }; 3477C28D1CBF08C10028B84B /* PrintDC.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; name = PrintDC.cpp; path = ../common/PrintDC.cpp; sourceTree = SOURCE_ROOT; }; 3477C28E1CBF08C10028B84B /* ScreenDC.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; name = ScreenDC.cpp; path = ../common/ScreenDC.cpp; sourceTree = SOURCE_ROOT; }; 3477C2941CBF09320028B84B /* File.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = File.mm; sourceTree = SOURCE_ROOT; }; 3477C2951CBF09320028B84B /* Mem.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = Mem.mm; sourceTree = SOURCE_ROOT; }; 3477C2961CBF09320028B84B /* ShowFileProp_Mac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ShowFileProp_Mac.mm; sourceTree = SOURCE_ROOT; }; 3477C29B1CBF0A920028B84B /* Mem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Mem.h; path = ../../../include/lgi/common/Mem.h; sourceTree = ""; }; 3477C29C1CBF0A920028B84B /* SymLookup.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SymLookup.h; path = ../../../include/lgi/mac/cocoa/SymLookup.h; sourceTree = ""; }; 3477C29D1CBF0A920028B84B /* LgiMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LgiMac.h; path = ../../../include/lgi/mac/cocoa/LgiMac.h; sourceTree = ""; }; 3477C29E1CBF0A920028B84B /* LgiOs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LgiOs.h; path = ../../../include/lgi/mac/cocoa/LgiOs.h; sourceTree = ""; }; 3477C29F1CBF0A920028B84B /* LgiOsClasses.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LgiOsClasses.h; path = ../../../include/lgi/mac/cocoa/LgiOsClasses.h; sourceTree = ""; }; 3477C2A01CBF0A920028B84B /* LgiOsDefs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LgiOsDefs.h; path = ../../../include/lgi/mac/cocoa/LgiOsDefs.h; sourceTree = ""; }; 3477C2A71CBF0AAF0028B84B /* Lgi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Lgi.h; path = ../../../include/lgi/common/Lgi.h; sourceTree = ""; }; 3477C2A91CBF22A00028B84B /* File.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = File.h; path = ../../../include/lgi/common/File.h; sourceTree = SOURCE_ROOT; }; 3477C2AB1CBF72170028B84B /* ViewPriv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ViewPriv.h; path = ../../../private/common/ViewPriv.h; sourceTree = SOURCE_ROOT; }; 3477C2AE1CBF96B90028B84B /* LgiRes.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LgiRes.cpp; path = ../../common/Resource/LgiRes.cpp; sourceTree = SOURCE_ROOT; }; 3477C2B01CBF96C40028B84B /* Res.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Res.cpp; path = ../../common/Resource/Res.cpp; sourceTree = SOURCE_ROOT; }; 3477C2B31CBF96F20028B84B /* LMsg.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; name = LMsg.cpp; path = ../../common/Lgi/LMsg.cpp; sourceTree = SOURCE_ROOT; }; 3477C2B61CBF973F0028B84B /* GuiUtils.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; name = GuiUtils.cpp; path = ../../common/Lgi/GuiUtils.cpp; sourceTree = SOURCE_ROOT; }; 3477C2B81CBF977F0028B84B /* LgiCommon.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; name = LgiCommon.cpp; path = ../../common/Lgi/LgiCommon.cpp; sourceTree = SOURCE_ROOT; }; 3477C2BA1CBF97C80028B84B /* GdcCommon.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; name = GdcCommon.cpp; path = ../../common/Gdc2/GdcCommon.cpp; sourceTree = SOURCE_ROOT; }; 3477C2C01CBF9A040028B84B /* String.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = String.cpp; path = ../../common/Text/String.cpp; sourceTree = SOURCE_ROOT; }; 3477C2C41CC046310028B84B /* TextView3.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = TextView3.cpp; path = ../../common/Text/TextView3.cpp; sourceTree = SOURCE_ROOT; }; 3477C2C51CC046310028B84B /* Unicode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Unicode.cpp; path = ../../common/Text/Unicode.cpp; sourceTree = SOURCE_ROOT; }; 3477C2C61CC046310028B84B /* Utf8.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Utf8.cpp; path = ../../common/Text/Utf8.cpp; sourceTree = SOURCE_ROOT; }; 3477C2C71CC046310028B84B /* XmlTree.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = XmlTree.cpp; path = ../../common/Text/XmlTree.cpp; sourceTree = SOURCE_ROOT; }; 3477C2CD1CC047BE0028B84B /* Charset.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Charset.cpp; path = ../../common/Gdc2/Font/Charset.cpp; sourceTree = SOURCE_ROOT; }; 3477C2CF1CC047F50028B84B /* ToolBar.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ToolBar.cpp; path = ../../common/Widgets/ToolBar.cpp; sourceTree = SOURCE_ROOT; }; 3477C2D21CC048100028B84B /* Containers.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Containers.cpp; path = ../../common/General/Containers.cpp; sourceTree = SOURCE_ROOT; }; 3477C2D41CC0481B0028B84B /* Array.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Array.h; path = ../../../include/lgi/common/Array.h; sourceTree = SOURCE_ROOT; }; 3477C2D61CC048390028B84B /* Popup.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp.preprocessed; fileEncoding = 4; name = Popup.cpp; path = ../../common/Widgets/Popup.cpp; sourceTree = SOURCE_ROOT; }; 3477C2D81CC048F90028B84B /* DisplayString.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DisplayString.cpp; path = ../../common/Gdc2/Font/DisplayString.cpp; sourceTree = SOURCE_ROOT; }; 3477C2D91CC048F90028B84B /* Font.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Font.cpp; path = ../../common/Gdc2/Font/Font.cpp; sourceTree = SOURCE_ROOT; }; 3477C2DA1CC048F90028B84B /* FontSystem.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; name = FontSystem.cpp; path = ../../common/Gdc2/Font/FontSystem.cpp; sourceTree = SOURCE_ROOT; }; 3477C2DE1CC04A030028B84B /* ScrollBar.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ScrollBar.cpp; path = ../../common/Widgets/ScrollBar.cpp; sourceTree = SOURCE_ROOT; }; 3477C2E01CC04A3C0028B84B /* FontSelect.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FontSelect.cpp; path = ../../common/Lgi/FontSelect.cpp; sourceTree = SOURCE_ROOT; }; 3477C2E21CC04A5C0028B84B /* Stream.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Stream.cpp; path = ../../common/Lgi/Stream.cpp; sourceTree = SOURCE_ROOT; }; 3477C2E41CC04A7F0028B84B /* ViewCommon.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; name = ViewCommon.cpp; path = ../../common/Lgi/ViewCommon.cpp; sourceTree = SOURCE_ROOT; }; 3477C2E61CC04B1E0028B84B /* Surface.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Surface.cpp; path = ../../common/Gdc2/Surface.cpp; sourceTree = SOURCE_ROOT; }; 3477C2E81CC04B5D0028B84B /* Rand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Rand.cpp; path = ../../common/Lgi/Rand.cpp; sourceTree = SOURCE_ROOT; }; 3477C2EA1CC04B890028B84B /* Filter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Filter.cpp; path = ../../common/Gdc2/Filters/Filter.cpp; sourceTree = SOURCE_ROOT; }; 3477C2EC1CC04BBB0028B84B /* ItemContainer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ItemContainer.cpp; path = ../../common/Widgets/ItemContainer.cpp; sourceTree = SOURCE_ROOT; }; 3477C2ED1CC04BBB0028B84B /* List.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = List.cpp; path = ../../common/Widgets/List.cpp; sourceTree = SOURCE_ROOT; }; 3477C2EE1CC04BBB0028B84B /* Tree.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Tree.cpp; path = ../../common/Widgets/Tree.cpp; sourceTree = SOURCE_ROOT; }; 3477C2F21CC04BF00028B84B /* Bitmap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Bitmap.cpp; path = ../../common/Widgets/Bitmap.cpp; sourceTree = SOURCE_ROOT; }; 3477C2F31CC04BF00028B84B /* Box.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Box.cpp; path = ../../common/Widgets/Box.cpp; sourceTree = SOURCE_ROOT; }; 3477C2F41CC04BF00028B84B /* Button.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Button.cpp; path = ../../common/Widgets/Button.cpp; sourceTree = SOURCE_ROOT; }; 3477C2F51CC04BF00028B84B /* CheckBox.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CheckBox.cpp; path = ../../common/Widgets/CheckBox.cpp; sourceTree = SOURCE_ROOT; }; 3477C2F61CC04BF00028B84B /* Combo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Combo.cpp; path = ../../common/Widgets/Combo.cpp; sourceTree = SOURCE_ROOT; }; 3477C2F71CC04BF00028B84B /* Edit.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Edit.cpp; path = ../../common/Widgets/Edit.cpp; sourceTree = SOURCE_ROOT; }; 3477C2F81CC04BF00028B84B /* Panel.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Panel.cpp; path = ../../common/Widgets/Panel.cpp; sourceTree = SOURCE_ROOT; }; 3477C2F91CC04BF00028B84B /* Progress.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Progress.cpp; path = ../../common/Widgets/Progress.cpp; sourceTree = SOURCE_ROOT; }; 3477C2FA1CC04BF00028B84B /* RadioGroup.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RadioGroup.cpp; path = ../../common/Widgets/RadioGroup.cpp; sourceTree = SOURCE_ROOT; }; 3477C2FB1CC04BF00028B84B /* Splitter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Splitter.cpp; path = ../../common/Widgets/Splitter.cpp; sourceTree = SOURCE_ROOT; }; 3477C2FC1CC04BF00028B84B /* TableLayout.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = TableLayout.cpp; path = ../../common/Widgets/TableLayout.cpp; sourceTree = SOURCE_ROOT; }; 3477C2FD1CC04BF00028B84B /* TabView.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = TabView.cpp; path = ../../common/Widgets/TabView.cpp; sourceTree = SOURCE_ROOT; }; 3477C2FE1CC04BF00028B84B /* TextLabel.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = TextLabel.cpp; path = ../../common/Widgets/TextLabel.cpp; sourceTree = SOURCE_ROOT; }; 3477C30C1CC04C560028B84B /* FindReplace.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FindReplace.cpp; path = ../../common/Lgi/FindReplace.cpp; sourceTree = SOURCE_ROOT; }; 3477C30E1CC04C790028B84B /* Css.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Css.cpp; path = ../../common/Lgi/Css.cpp; sourceTree = SOURCE_ROOT; }; 3477C30F1CC04C790028B84B /* CssTools.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CssTools.cpp; path = ../../common/Lgi/CssTools.cpp; sourceTree = SOURCE_ROOT; }; 3477C3121CC04CB10028B84B /* Rect.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Rect.cpp; path = ../../common/Gdc2/Rect.cpp; sourceTree = SOURCE_ROOT; }; 3477C3151CC04CCB0028B84B /* Library.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Library.cpp; path = ../../common/Lgi/Library.cpp; sourceTree = SOURCE_ROOT; }; 3477C3181CC04CF10028B84B /* ThreadCommon.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ThreadCommon.cpp; path = ../../common/Lgi/ThreadCommon.cpp; sourceTree = SOURCE_ROOT; }; 3477C31B1CC04D3F0028B84B /* Net.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Net.cpp; path = ../../common/Net/Net.cpp; sourceTree = SOURCE_ROOT; }; 3477C31F1CC04D630028B84B /* ThreadEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ThreadEvent.cpp; path = ../../common/Lgi/ThreadEvent.cpp; sourceTree = SOURCE_ROOT; }; 3477C3211CC04DA00028B84B /* Colour.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Colour.cpp; path = ../../common/Gdc2/Colour.cpp; sourceTree = SOURCE_ROOT; }; 3477C3231CC04DD70028B84B /* Object.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Object.cpp; path = ../../common/Lgi/Object.cpp; sourceTree = SOURCE_ROOT; }; 3477C3251CC04DE20028B84B /* Mutex.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Mutex.cpp; path = ../../common/Lgi/Mutex.cpp; sourceTree = SOURCE_ROOT; }; 3477C3271CC04E020028B84B /* Variant.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Variant.cpp; path = ../../common/Lgi/Variant.cpp; sourceTree = SOURCE_ROOT; }; 3477C3291CC04E120028B84B /* 8Bit.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = 8Bit.cpp; path = ../../common/Gdc2/8Bit.cpp; sourceTree = SOURCE_ROOT; }; 3477C32A1CC04E120028B84B /* 64Bit.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = 64Bit.cpp; path = ../../common/Gdc2/64Bit.cpp; sourceTree = SOURCE_ROOT; }; 3477C32B1CC04E120028B84B /* 16Bit.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = 16Bit.cpp; path = ../../common/Gdc2/16Bit.cpp; sourceTree = SOURCE_ROOT; }; 3477C32C1CC04E120028B84B /* 24Bit.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = 24Bit.cpp; path = ../../common/Gdc2/24Bit.cpp; sourceTree = SOURCE_ROOT; }; 3477C32D1CC04E120028B84B /* 32Bit.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = 32Bit.cpp; path = ../../common/Gdc2/32Bit.cpp; sourceTree = SOURCE_ROOT; }; 3477C32E1CC04E120028B84B /* 48Bit.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = 48Bit.cpp; path = ../../common/Gdc2/48Bit.cpp; sourceTree = SOURCE_ROOT; }; 3477C3301CC04E120028B84B /* Alpha.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Alpha.cpp; path = ../../common/Gdc2/Alpha.cpp; sourceTree = SOURCE_ROOT; }; 3477C3391CC04ED90028B84B /* DragAndDrop.mm */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; path = DragAndDrop.mm; sourceTree = SOURCE_ROOT; }; 3477C33C1CC088590028B84B /* FileCommon.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FileCommon.cpp; path = ../../common/General/FileCommon.cpp; sourceTree = SOURCE_ROOT; }; 3477C33E1CC0A6780028B84B /* Token.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Token.cpp; path = ../../common/Text/Token.cpp; sourceTree = SOURCE_ROOT; }; 3477C3401CC0A68E0028B84B /* DateTime.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; name = DateTime.cpp; path = ../../common/General/DateTime.cpp; sourceTree = SOURCE_ROOT; }; 3477C3421CC0A6B90028B84B /* DocView.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DocView.cpp; path = ../../common/Text/DocView.cpp; sourceTree = SOURCE_ROOT; }; 3477C3441CC0A9DE0028B84B /* Input.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Input.cpp; path = ../../common/Lgi/Input.cpp; sourceTree = SOURCE_ROOT; }; 3477C3461CC0AA220028B84B /* WindowCommon.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; name = WindowCommon.cpp; path = ../../common/Lgi/WindowCommon.cpp; sourceTree = SOURCE_ROOT; }; 3477C3481CC0AA7E0028B84B /* ProgressDlg.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ProgressDlg.cpp; path = ../../common/Widgets/ProgressDlg.cpp; sourceTree = SOURCE_ROOT; }; 3477C34A1CC0AB0B0028B84B /* ToolTip.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ToolTip.cpp; path = ../../common/Lgi/ToolTip.cpp; sourceTree = SOURCE_ROOT; }; 3477C34C1CC0ACED0028B84B /* md5.c */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.cpp; fileEncoding = 4; name = md5.c; path = ../../common/Hash/md5/md5.c; sourceTree = SOURCE_ROOT; }; 3477C34F1CC0C3D60028B84B /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = ../../../../../../../../System/Library/Frameworks/Cocoa.framework; sourceTree = ""; }; 3477C35A1CC1AEEA0028B84B /* LgiInc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LgiInc.h; path = ../../../include/lgi/common/LgiInc.h; sourceTree = ""; }; 3477C35C1CC2253E0028B84B /* LgiInterfaces.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LgiInterfaces.h; path = ../../../include/lgi/common/LgiInterfaces.h; sourceTree = ""; }; 3477C4391CC234750028B84B /* MemStream.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = MemStream.cpp; path = ../../common/Lgi/MemStream.cpp; sourceTree = SOURCE_ROOT; }; 3477C46C1CC26DEB0028B84B /* Alert.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Alert.cpp; path = ../../common/Lgi/Alert.cpp; sourceTree = SOURCE_ROOT; }; 3477C4EC1CC27F1C0028B84B /* TrayIcon.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; name = TrayIcon.cpp; path = ../../common/Lgi/TrayIcon.cpp; sourceTree = SOURCE_ROOT; }; 3477C5161CC303B70028B84B /* LgiUiBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LgiUiBase.h; path = ../../../include/lgi/common/LgiUiBase.h; sourceTree = ""; }; 347AFB9727A0DC5E00BE4ABE /* 15Bit.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = 15Bit.cpp; path = ../../common/Gdc2/15Bit.cpp; sourceTree = SOURCE_ROOT; }; 348362411F233A77003B2A6D /* Stream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Stream.h; path = ../../../include/lgi/common/Stream.h; sourceTree = SOURCE_ROOT; }; 34837C4825C677ED00D103B4 /* AppPriv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppPriv.h; path = ../../../private/mac/AppPriv.h; sourceTree = SOURCE_ROOT; }; 348CD46925C63E56001AA32B /* AppCommon.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; name = AppCommon.cpp; path = ../../common/Lgi/AppCommon.cpp; sourceTree = SOURCE_ROOT; }; 348E99CD2876850F0067E92A /* ObjCWrapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ObjCWrapper.h; path = ../../../include/lgi/mac/cocoa/ObjCWrapper.h; sourceTree = ""; }; 3491A28423678DB700604C29 /* DropFiles.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; name = DropFiles.h; path = ../../../include/lgi/common/DropFiles.h; sourceTree = SOURCE_ROOT; }; + 349F939D2B92CBAD002410A2 /* TextConvert.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = TextConvert.cpp; path = ../../../common/Text/TextConvert.cpp; sourceTree = ""; }; 34A3ACE720568D5800B1D62A /* StringLayout.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = StringLayout.cpp; path = ../../common/Gdc2/Font/StringLayout.cpp; sourceTree = SOURCE_ROOT; }; 34A3ACE920568D9700B1D62A /* MenuCommon.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = MenuCommon.cpp; path = ../../common/Lgi/MenuCommon.cpp; sourceTree = SOURCE_ROOT; }; 34B14E3326951C6E004C22CC /* Slider.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Slider.cpp; path = ../../common/Widgets/Slider.cpp; sourceTree = SOURCE_ROOT; }; 34B531D722F65734002B50F7 /* Menu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Menu.h; path = ../../../include/lgi/common/Menu.h; sourceTree = ""; }; 34B6B19023CFD0F100C24906 /* DragAndDropCommon.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DragAndDropCommon.cpp; path = ../../common/Lgi/DragAndDropCommon.cpp; sourceTree = SOURCE_ROOT; }; 34BF15062871503B001B4CA5 /* DrawListSurface.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DrawListSurface.h; path = ../../../../../lgi/trunk/include/lgi/common/DrawListSurface.h; sourceTree = ""; }; 34C072C02369878100E1E222 /* DropFiles.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; name = DropFiles.cpp; path = ../../common/Lgi/DropFiles.cpp; sourceTree = SOURCE_ROOT; }; 34C81A5925DA0AA10053F93A /* Base64.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Base64.cpp; path = ../../common/Net/Base64.cpp; sourceTree = SOURCE_ROOT; }; 34CD9F7123D5768B0039F259 /* Unicode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Unicode.h; path = ../../../include/lgi/common/Unicode.h; sourceTree = SOURCE_ROOT; }; 34D1B3C021748A2800BC6B58 /* Path.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Path.cpp; path = ../../common/Gdc2/Path/Path.cpp; sourceTree = SOURCE_ROOT; }; 34D21CEB217981AE003D1EA6 /* EventTargetThread.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = EventTargetThread.h; path = ../../../include/lgi/common/EventTargetThread.h; sourceTree = SOURCE_ROOT; }; 34D28925275B3D9F005961A8 /* DateTime.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DateTime.h; path = ../../../include/lgi/common/DateTime.h; sourceTree = SOURCE_ROOT; }; 34D28928275B3DB0005961A8 /* Variant.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Variant.h; path = ../../../include/lgi/common/Variant.h; sourceTree = SOURCE_ROOT; }; 34D6AA1622D3749A005D739E /* Gdc2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Gdc2.h; path = ../../../include/lgi/common/Gdc2.h; sourceTree = SOURCE_ROOT; }; 34EE8BB02748A55600F12915 /* TextFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TextFile.h; path = ../../../include/lgi/common/TextFile.h; sourceTree = ""; }; 34F3EC4229BD374E00BB9B58 /* Rect.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Rect.h; path = ../../../include/lgi/common/Rect.h; sourceTree = SOURCE_ROOT; }; 34F6151D27E55C5D00FE5B0C /* Thread.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Thread.h; path = ../../../../../lgi/trunk/include/lgi/common/Thread.h; sourceTree = ""; }; 34F6151E27E55C5D00FE5B0C /* ThreadEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ThreadEvent.h; path = ../../../../../lgi/trunk/include/lgi/common/ThreadEvent.h; sourceTree = ""; }; 34F6153D27E5628600FE5B0C /* Token.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Token.h; path = ../../../../../lgi/trunk/include/lgi/common/Token.h; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ 3477C2641CBF020F0028B84B /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( 3477C3501CC0C3D60028B84B /* Cocoa.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ 3415168D26EC32C8007EE35F /* TextCtrls */ = { isa = PBXGroup; children = ( 3415169126EC32FF007EE35F /* TextView3.h */, 3415169226EC32FF007EE35F /* TextView4.h */, 3415168E26EC32E7007EE35F /* TextView4.cpp */, 3477C2C41CC046310028B84B /* TextView3.cpp */, ); name = TextCtrls; sourceTree = ""; }; 345BABCE2B78952D005795A0 /* Frameworks */ = { isa = PBXGroup; children = ( ); name = Frameworks; sourceTree = ""; }; 346FACE81D3C723700FFEBCE /* Resources */ = { isa = PBXGroup; children = ( 3477C26D1CBF020F0028B84B /* Info.plist */, ); name = Resources; sourceTree = ""; }; 3477C25E1CBF020F0028B84B = { isa = PBXGroup; children = ( 346FACE81D3C723700FFEBCE /* Resources */, 3477C26A1CBF020F0028B84B /* Classes */, 3477C29A1CBF0A700028B84B /* Headers */, 3477C34E1CC0C3A30028B84B /* Link */, 3477C2691CBF020F0028B84B /* Products */, 345BABCE2B78952D005795A0 /* Frameworks */, ); sourceTree = ""; }; 3477C2691CBF020F0028B84B /* Products */ = { isa = PBXGroup; children = ( 3477C2681CBF020F0028B84B /* LgiCocoa.framework */, ); name = Products; sourceTree = ""; }; 3477C26A1CBF020F0028B84B /* Classes */ = { isa = PBXGroup; children = ( 3477C2B21CBF96E60028B84B /* Dialogs */, 3477C33B1CC0881E0028B84B /* Files */, 3477C2931CBF09240028B84B /* General */, 3477C28A1CBF08760028B84B /* Graphics */, 3477C2731CBF07410028B84B /* Interface_Cocoa */, 3477C2B51CBF972B0028B84B /* Interface_XP */, 3477C3141CC04CC00028B84B /* Libraries */, 3477C2D11CC048000028B84B /* Memory */, 3477C31A1CC04D290028B84B /* Network */, 3477C4051CC22F920028B84B /* Process */, 3477C2AD1CBF96AA0028B84B /* Resources */, 3477C2BF1CBF99F00028B84B /* Text */, 3477C3171CC04CDE0028B84B /* Threads */, 3477C2CC1CC046370028B84B /* Widgets */, ); name = Classes; path = Lgi; sourceTree = SOURCE_ROOT; usesTabs = 1; }; 3477C2731CBF07410028B84B /* Interface_Cocoa */ = { isa = PBXGroup; children = ( 343874B3230F46B200CF96B4 /* App.h */, 3477C2741CBF07DD0028B84B /* App.mm */, 344CFBC7237365B800AE6B35 /* ClipBoard.h */, 3477C2761CBF08050028B84B /* ClipBoard.mm */, 3427064627A0E20C0043F733 /* CocoaView.mm */, 3477C3391CC04ED90028B84B /* DragAndDrop.mm */, 3477C27A1CBF086A0028B84B /* General.mm */, 343874B4230F46B200CF96B4 /* Layout.h */, 3477C27B1CBF086A0028B84B /* Layout.mm */, 34109856217A9805007020CE /* LCocoaView.h */, 3477C27C1CBF086A0028B84B /* Menu.mm */, 3477C27D1CBF086A0028B84B /* Printer.mm */, 343874B2230F46B200CF96B4 /* View.h */, 3477C27F1CBF086A0028B84B /* View.mm */, 3477C2AB1CBF72170028B84B /* ViewPriv.h */, 3477C2801CBF086A0028B84B /* Widgets.mm */, 343874B1230F46B200CF96B4 /* Window.h */, 3477C2811CBF086A0028B84B /* Window.mm */, 34109853217A975E007020CE /* View.h */, ); name = Interface_Cocoa; sourceTree = ""; }; 3477C28A1CBF08760028B84B /* Graphics */ = { isa = PBXGroup; children = ( 34F3EC4229BD374E00BB9B58 /* Rect.h */, 3413170F230694D1008CE982 /* Gel.cpp */, 34D6AA1622D3749A005D739E /* Gdc2.h */, 34D1B3C021748A2800BC6B58 /* Path.cpp */, 3477C3211CC04DA00028B84B /* Colour.cpp */, 3477C2BA1CBF97C80028B84B /* GdcCommon.cpp */, 3477C2EA1CC04B890028B84B /* Filter.cpp */, 3477C3121CC04CB10028B84B /* Rect.cpp */, 3477C28B1CBF08C10028B84B /* Gdc2.mm */, 3477C2BE1CBF97E20028B84B /* Applicators */, 3477C2BD1CBF97DA0028B84B /* Fonts */, 3477C2BC1CBF97D10028B84B /* Surfaces */, ); name = Graphics; sourceTree = ""; }; 3477C2931CBF09240028B84B /* General */ = { isa = PBXGroup; children = ( 34C81A5925DA0AA10053F93A /* Base64.cpp */, 3477C3401CC0A68E0028B84B /* DateTime.cpp */, 34D28925275B3D9F005961A8 /* DateTime.h */, 3477C3421CC0A6B90028B84B /* DocView.cpp */, 3477C2951CBF09320028B84B /* Mem.mm */, 3477C34C1CC0ACED0028B84B /* md5.c */, 3477C3231CC04DD70028B84B /* Object.cpp */, 3477C2E81CC04B5D0028B84B /* Rand.cpp */, 3477C2961CBF09320028B84B /* ShowFileProp_Mac.mm */, 3477C3271CC04E020028B84B /* Variant.cpp */, 34D28928275B3DB0005961A8 /* Variant.h */, ); name = General; sourceTree = ""; }; 3477C29A1CBF0A700028B84B /* Headers */ = { isa = PBXGroup; children = ( 348E99CD2876850F0067E92A /* ObjCWrapper.h */, 34BF15062871503B001B4CA5 /* DrawListSurface.h */, 3477C2A71CBF0AAF0028B84B /* Lgi.h */, 34114C8A23091E6E00F342B1 /* LgiClasses.h */, 3477C35A1CC1AEEA0028B84B /* LgiInc.h */, 3477C35C1CC2253E0028B84B /* LgiInterfaces.h */, 3477C29D1CBF0A920028B84B /* LgiMac.h */, 3477C29E1CBF0A920028B84B /* LgiOs.h */, 3477C29F1CBF0A920028B84B /* LgiOsClasses.h */, 3477C2A01CBF0A920028B84B /* LgiOsDefs.h */, 3477C5161CC303B70028B84B /* LgiUiBase.h */, 3477C29B1CBF0A920028B84B /* Mem.h */, 3449B8CD26BBF6B10022A9B8 /* Notifications.h */, 3409C0CF275812CB0050302A /* Profile.h */, 3477C29C1CBF0A920028B84B /* SymLookup.h */, 34EE8BB02748A55600F12915 /* TextFile.h */, 34F6151D27E55C5D00FE5B0C /* Thread.h */, 34F6151E27E55C5D00FE5B0C /* ThreadEvent.h */, 34F6153D27E5628600FE5B0C /* Token.h */, ); name = Headers; sourceTree = ""; }; 3477C2AD1CBF96AA0028B84B /* Resources */ = { isa = PBXGroup; children = ( 3477C2B01CBF96C40028B84B /* Res.cpp */, 3477C2AE1CBF96B90028B84B /* LgiRes.cpp */, ); name = Resources; path = ../../common/Gdc2/Rect.cpp; sourceTree = SOURCE_ROOT; }; 3477C2B21CBF96E60028B84B /* Dialogs */ = { isa = PBXGroup; children = ( 3413170D23068FFE008CE982 /* FileSelect.cpp */, 3477C46C1CC26DEB0028B84B /* Alert.cpp */, 3477C3481CC0AA7E0028B84B /* ProgressDlg.cpp */, 3477C3441CC0A9DE0028B84B /* Input.cpp */, 3477C30C1CC04C560028B84B /* FindReplace.cpp */, 3477C2E01CC04A3C0028B84B /* FontSelect.cpp */, 3477C2B31CBF96F20028B84B /* LMsg.cpp */, ); name = Dialogs; sourceTree = ""; }; 3477C2B51CBF972B0028B84B /* Interface_XP */ = { isa = PBXGroup; children = ( 34837C4825C677ED00D103B4 /* AppPriv.h */, 348CD46925C63E56001AA32B /* AppCommon.cpp */, 34B6B19023CFD0F100C24906 /* DragAndDropCommon.cpp */, 3491A28423678DB700604C29 /* DropFiles.h */, 34C072C02369878100E1E222 /* DropFiles.cpp */, 34B531D722F65734002B50F7 /* Menu.h */, 34A3ACE920568D9700B1D62A /* MenuCommon.cpp */, 346FACE61D3C720B00FFEBCE /* Message.h */, 3477C4EC1CC27F1C0028B84B /* TrayIcon.cpp */, 3477C34A1CC0AB0B0028B84B /* ToolTip.cpp */, 3477C3461CC0AA220028B84B /* WindowCommon.cpp */, 3477C2E41CC04A7F0028B84B /* ViewCommon.cpp */, 3477C2B81CBF977F0028B84B /* LgiCommon.cpp */, 3477C2B61CBF973F0028B84B /* GuiUtils.cpp */, ); name = Interface_XP; sourceTree = ""; }; 3477C2BC1CBF97D10028B84B /* Surfaces */ = { isa = PBXGroup; children = ( 3477C2E61CC04B1E0028B84B /* Surface.cpp */, 3477C28E1CBF08C10028B84B /* ScreenDC.cpp */, 3477C28C1CBF08C10028B84B /* MemDC.cpp */, 3477C28D1CBF08C10028B84B /* PrintDC.cpp */, ); name = Surfaces; sourceTree = ""; }; 3477C2BD1CBF97DA0028B84B /* Fonts */ = { isa = PBXGroup; children = ( 3477C2CD1CC047BE0028B84B /* Charset.cpp */, 3477C2D81CC048F90028B84B /* DisplayString.cpp */, 3477C2D91CC048F90028B84B /* Font.cpp */, 345920FC1F25649000098DFD /* Font.h */, 345920FD1F25649000098DFD /* FontCache.h */, 340833122698F8FE0028012F /* FontPriv.h */, 345920FE1F25649000098DFD /* FontSelect.h */, 3477C2DA1CC048F90028B84B /* FontSystem.cpp */, 340833132698F8FE0028012F /* FontType.cpp */, 34A3ACE720568D5800B1D62A /* StringLayout.cpp */, 340833142698F8FE0028012F /* TypeFace.cpp */, ); name = Fonts; sourceTree = ""; }; 3477C2BE1CBF97E20028B84B /* Applicators */ = { isa = PBXGroup; children = ( 3477C3291CC04E120028B84B /* 8Bit.cpp */, 347AFB9727A0DC5E00BE4ABE /* 15Bit.cpp */, 3477C32B1CC04E120028B84B /* 16Bit.cpp */, 3477C32C1CC04E120028B84B /* 24Bit.cpp */, 3477C32D1CC04E120028B84B /* 32Bit.cpp */, 3477C32E1CC04E120028B84B /* 48Bit.cpp */, 3477C32A1CC04E120028B84B /* 64Bit.cpp */, 3477C3301CC04E120028B84B /* Alpha.cpp */, ); name = Applicators; sourceTree = ""; }; 3477C2BF1CBF99F00028B84B /* Text */ = { isa = PBXGroup; children = ( + 349F939D2B92CBAD002410A2 /* TextConvert.cpp */, 3477C30E1CC04C790028B84B /* Css.cpp */, 3477C30F1CC04C790028B84B /* CssTools.cpp */, 3477C2C01CBF9A040028B84B /* String.cpp */, 3477C33E1CC0A6780028B84B /* Token.cpp */, 3477C2C51CC046310028B84B /* Unicode.cpp */, 34CD9F7123D5768B0039F259 /* Unicode.h */, 3477C2C61CC046310028B84B /* Utf8.cpp */, 3477C2C71CC046310028B84B /* XmlTree.cpp */, ); name = Text; sourceTree = ""; }; 3477C2CC1CC046370028B84B /* Widgets */ = { isa = PBXGroup; children = ( 3477C2F21CC04BF00028B84B /* Bitmap.cpp */, 3477C2F31CC04BF00028B84B /* Box.cpp */, 3477C2F41CC04BF00028B84B /* Button.cpp */, 3477C2F51CC04BF00028B84B /* CheckBox.cpp */, 3477C2F61CC04BF00028B84B /* Combo.cpp */, 3477C2F71CC04BF00028B84B /* Edit.cpp */, 3477C2EC1CC04BBB0028B84B /* ItemContainer.cpp */, 3477C2ED1CC04BBB0028B84B /* List.cpp */, 3409C0C827580ED60050302A /* List.h */, 3409C0C927580ED60050302A /* ListItemCheckBox.h */, 3409C0C727580ED60050302A /* ListItemRadioBtn.h */, 3477C2F81CC04BF00028B84B /* Panel.cpp */, 3477C2D61CC048390028B84B /* Popup.cpp */, 345EB84D235C6C01007D05DB /* Popup.h */, 343BE8C62355D0CE00742E21 /* PopupList.h */, 3477C2F91CC04BF00028B84B /* Progress.cpp */, 3418EBCE25D9FEA600EA168A /* Progress.h */, 3418EBD025D9FEF500EA168A /* ProgressDlg.h */, 3477C2FA1CC04BF00028B84B /* RadioGroup.cpp */, 346DDEC0240C882900751380 /* RadioGroup.h */, 3477C2DE1CC04A030028B84B /* ScrollBar.cpp */, 34B14E3326951C6E004C22CC /* Slider.cpp */, 3477C2FB1CC04BF00028B84B /* Splitter.cpp */, 3477C2FC1CC04BF00028B84B /* TableLayout.cpp */, 3477C2FD1CC04BF00028B84B /* TabView.cpp */, 3415168D26EC32C8007EE35F /* TextCtrls */, 3477C2FE1CC04BF00028B84B /* TextLabel.cpp */, 3477C2CF1CC047F50028B84B /* ToolBar.cpp */, 3477C2EE1CC04BBB0028B84B /* Tree.cpp */, ); name = Widgets; sourceTree = ""; }; 3477C2D11CC048000028B84B /* Memory */ = { isa = PBXGroup; children = ( 3477C2D41CC0481B0028B84B /* Array.h */, 3477C2D21CC048100028B84B /* Containers.cpp */, 3477C4391CC234750028B84B /* MemStream.cpp */, 3477C2E21CC04A5C0028B84B /* Stream.cpp */, 348362411F233A77003B2A6D /* Stream.h */, ); name = Memory; sourceTree = ""; }; 3477C3141CC04CC00028B84B /* Libraries */ = { isa = PBXGroup; children = ( 3477C3151CC04CCB0028B84B /* Library.cpp */, ); name = Libraries; sourceTree = ""; }; 3477C3171CC04CDE0028B84B /* Threads */ = { isa = PBXGroup; children = ( 34D21CEB217981AE003D1EA6 /* EventTargetThread.h */, 3477C27E1CBF086A0028B84B /* Thread.mm */, 3477C3251CC04DE20028B84B /* Mutex.cpp */, 3477C31F1CC04D630028B84B /* ThreadEvent.cpp */, 3477C3181CC04CF10028B84B /* ThreadCommon.cpp */, ); name = Threads; sourceTree = ""; }; 3477C31A1CC04D290028B84B /* Network */ = { isa = PBXGroup; children = ( 346FACE91D3C75AE00FFEBCE /* Uri.cpp */, 346FACEA1D3C75AE00FFEBCE /* MDStringToDigest.cpp */, 3477C31B1CC04D3F0028B84B /* Net.cpp */, ); name = Network; sourceTree = ""; }; 3477C33B1CC0881E0028B84B /* Files */ = { isa = PBXGroup; children = ( 3477C33C1CC088590028B84B /* FileCommon.cpp */, 3477C2A91CBF22A00028B84B /* File.h */, 3477C2941CBF09320028B84B /* File.mm */, ); name = Files; sourceTree = ""; }; 3477C34E1CC0C3A30028B84B /* Link */ = { isa = PBXGroup; children = ( 3477C34F1CC0C3D60028B84B /* Cocoa.framework */, ); name = Link; sourceTree = ""; }; 3477C4051CC22F920028B84B /* Process */ = { isa = PBXGroup; children = ( 3471868723A9AF8900F8C952 /* SubProcess.cpp */, ); name = Process; sourceTree = ""; }; /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ 3477C2651CBF020F0028B84B /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( 344CFBC8237365B800AE6B35 /* ClipBoard.h in Headers */, 3449B8CE26BBF6B10022A9B8 /* Notifications.h in Headers */, 343874B8230F46B200CF96B4 /* Layout.h in Headers */, 3477C2AC1CBF72170028B84B /* ViewPriv.h in Headers */, 3409C0CA27580ED60050302A /* ListItemRadioBtn.h in Headers */, 3477C35D1CC2253E0028B84B /* LgiInterfaces.h in Headers */, 34F6153E27E5628600FE5B0C /* Token.h in Headers */, 3477C2A51CBF0A920028B84B /* LgiOsClasses.h in Headers */, 3491A28523678DB800604C29 /* DropFiles.h in Headers */, 3415169326EC32FF007EE35F /* TextView3.h in Headers */, 34B531D822F65734002B50F7 /* Menu.h in Headers */, 34114C8B23091E6E00F342B1 /* LgiClasses.h in Headers */, 34D28926275B3D9F005961A8 /* DateTime.h in Headers */, 3477C35B1CC1AEEA0028B84B /* LgiInc.h in Headers */, 34F6152027E55C5D00FE5B0C /* ThreadEvent.h in Headers */, 348362421F233A77003B2A6D /* Stream.h in Headers */, 3477C2A61CBF0A920028B84B /* LgiOsDefs.h in Headers */, 3409C0CC27580ED60050302A /* ListItemCheckBox.h in Headers */, 345EB84E235C6C01007D05DB /* Popup.h in Headers */, 34BF15072871503B001B4CA5 /* DrawListSurface.h in Headers */, 34F6151F27E55C5D00FE5B0C /* Thread.h in Headers */, 34D21CEC217981AE003D1EA6 /* EventTargetThread.h in Headers */, 343BE8C72355D0CE00742E21 /* PopupList.h in Headers */, 34EE8BB12748A55600F12915 /* TextFile.h in Headers */, 34CD9F7223D5768B0039F259 /* Unicode.h in Headers */, 34837C4925C677ED00D103B4 /* AppPriv.h in Headers */, 34F3EC4329BD374E00BB9B58 /* Rect.h in Headers */, 3409C0D0275812CB0050302A /* Profile.h in Headers */, 3477C2A11CBF0A920028B84B /* Mem.h in Headers */, 3477C2D51CC0481B0028B84B /* Array.h in Headers */, 3477C5171CC303B70028B84B /* LgiUiBase.h in Headers */, 3477C2AA1CBF22A00028B84B /* File.h in Headers */, 343874B5230F46B200CF96B4 /* Window.h in Headers */, 34D28929275B3DB0005961A8 /* Variant.h in Headers */, 348E99CE2876850F0067E92A /* ObjCWrapper.h in Headers */, 3477C2A21CBF0A920028B84B /* SymLookup.h in Headers */, 34D6AA1722D3749A005D739E /* Gdc2.h in Headers */, 3477C2A41CBF0A920028B84B /* LgiOs.h in Headers */, 340833152698F8FF0028012F /* FontPriv.h in Headers */, 343874B7230F46B200CF96B4 /* App.h in Headers */, 3418EBCF25D9FEA600EA168A /* Progress.h in Headers */, 346DDEC1240C882900751380 /* RadioGroup.h in Headers */, 345921011F25649000098DFD /* FontSelect.h in Headers */, 346FACE71D3C720B00FFEBCE /* Message.h in Headers */, 3477C2A31CBF0A920028B84B /* LgiMac.h in Headers */, 3418EBD125D9FEF500EA168A /* ProgressDlg.h in Headers */, 343874B6230F46B200CF96B4 /* View.h in Headers */, 345920FF1F25649000098DFD /* Font.h in Headers */, 3415169426EC32FF007EE35F /* TextView4.h in Headers */, 3477C2A81CBF0AAF0028B84B /* Lgi.h in Headers */, 345921001F25649000098DFD /* FontCache.h in Headers */, 3409C0CB27580ED60050302A /* List.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXHeadersBuildPhase section */ /* Begin PBXNativeTarget section */ 3477C2671CBF020F0028B84B /* LgiCocoa */ = { isa = PBXNativeTarget; buildConfigurationList = 3477C2701CBF020F0028B84B /* Build configuration list for PBXNativeTarget "LgiCocoa" */; buildPhases = ( 3477C2631CBF020F0028B84B /* Sources */, 3477C2641CBF020F0028B84B /* Frameworks */, 3477C2651CBF020F0028B84B /* Headers */, 3477C2661CBF020F0028B84B /* Resources */, ); buildRules = ( ); dependencies = ( ); name = LgiCocoa; productName = Lgi; productReference = 3477C2681CBF020F0028B84B /* LgiCocoa.framework */; productType = "com.apple.product-type.framework"; }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ 3477C25F1CBF020F0028B84B /* Project object */ = { isa = PBXProject; attributes = { LastUpgradeCheck = 1420; ORGANIZATIONNAME = Memecode; TargetAttributes = { 3477C2671CBF020F0028B84B = { CreatedOnToolsVersion = 7.3; }; }; }; buildConfigurationList = 3477C2621CBF020F0028B84B /* Build configuration list for PBXProject "LgiCocoa" */; compatibilityVersion = "Xcode 12.0"; developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( en, Base, ); mainGroup = 3477C25E1CBF020F0028B84B; productRefGroup = 3477C2691CBF020F0028B84B /* Products */; projectDirPath = ""; projectRoot = ""; targets = ( 3477C2671CBF020F0028B84B /* LgiCocoa */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ 3477C2661CBF020F0028B84B /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ 3477C2631CBF020F0028B84B /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 349F939E2B92CBAD002410A2 /* TextConvert.cpp in Sources */, 3477C2CE1CC047BE0028B84B /* Charset.cpp in Sources */, 3477C3111CC04C790028B84B /* CssTools.cpp in Sources */, 34A3ACE820568D5800B1D62A /* StringLayout.cpp in Sources */, 3477C2DB1CC048F90028B84B /* DisplayString.cpp in Sources */, 34B14E3426951C6E004C22CC /* Slider.cpp in Sources */, 3477C33A1CC04ED90028B84B /* DragAndDrop.mm in Sources */, 3477C2DC1CC048F90028B84B /* Font.cpp in Sources */, 3477C2831CBF086A0028B84B /* Layout.mm in Sources */, 3477C34D1CC0ACED0028B84B /* md5.c in Sources */, 3477C2C81CC046310028B84B /* TextView3.cpp in Sources */, 3477C2861CBF086A0028B84B /* Thread.mm in Sources */, 3477C2821CBF086A0028B84B /* General.mm in Sources */, 3477C3131CC04CB10028B84B /* Rect.cpp in Sources */, 3477C3451CC0A9DE0028B84B /* Input.cpp in Sources */, 34B6B19123CFD0F100C24906 /* DragAndDropCommon.cpp in Sources */, 3477C31D1CC04D3F0028B84B /* Net.cpp in Sources */, 3477C28F1CBF08C10028B84B /* Gdc2.mm in Sources */, 3477C30A1CC04BF00028B84B /* TabView.cpp in Sources */, 3427064727A0E20C0043F733 /* CocoaView.mm in Sources */, 3477C33F1CC0A6780028B84B /* Token.cpp in Sources */, 3477C2D01CC047F50028B84B /* ToolBar.cpp in Sources */, 3477C3011CC04BF00028B84B /* Button.cpp in Sources */, 3477C3061CC04BF00028B84B /* Progress.cpp in Sources */, 3477C3001CC04BF00028B84B /* Box.cpp in Sources */, 3477C2871CBF086A0028B84B /* View.mm in Sources */, 3477C3021CC04BF00028B84B /* CheckBox.cpp in Sources */, 3477C2BB1CBF97C80028B84B /* GdcCommon.cpp in Sources */, 3477C2E51CC04A7F0028B84B /* ViewCommon.cpp in Sources */, 347AFB9827A0DC5E00BE4ABE /* 15Bit.cpp in Sources */, 34131710230694D1008CE982 /* Gel.cpp in Sources */, 3477C2D71CC048390028B84B /* Popup.cpp in Sources */, 3477C3091CC04BF00028B84B /* TableLayout.cpp in Sources */, 3477C2E11CC04A3C0028B84B /* FontSelect.cpp in Sources */, 3477C2DF1CC04A030028B84B /* ScrollBar.cpp in Sources */, 3477C2F11CC04BBB0028B84B /* Tree.cpp in Sources */, 3413170E23068FFE008CE982 /* FileSelect.cpp in Sources */, 3477C3281CC04E020028B84B /* Variant.cpp in Sources */, 3477C2AF1CBF96B90028B84B /* LgiRes.cpp in Sources */, 3471868823A9AF8900F8C952 /* SubProcess.cpp in Sources */, 3477C3161CC04CCB0028B84B /* Library.cpp in Sources */, 3477C3051CC04BF00028B84B /* Panel.cpp in Sources */, 3477C2901CBF08C10028B84B /* MemDC.cpp in Sources */, 34C072C12369878100E1E222 /* DropFiles.cpp in Sources */, 3477C30D1CC04C560028B84B /* FindReplace.cpp in Sources */, 3477C34B1CC0AB0B0028B84B /* ToolTip.cpp in Sources */, 3415168F26EC32E7007EE35F /* TextView4.cpp in Sources */, 3477C3201CC04D630028B84B /* ThreadEvent.cpp in Sources */, 3477C3031CC04BF00028B84B /* Combo.cpp in Sources */, 3477C30B1CC04BF00028B84B /* TextLabel.cpp in Sources */, 3477C2B71CBF973F0028B84B /* GuiUtils.cpp in Sources */, 3477C2911CBF08C10028B84B /* PrintDC.cpp in Sources */, 3477C2B91CBF977F0028B84B /* LgiCommon.cpp in Sources */, 34D1B3C121748A2800BC6B58 /* Path.cpp in Sources */, 3477C2CA1CC046310028B84B /* Utf8.cpp in Sources */, 3477C2971CBF09320028B84B /* File.mm in Sources */, 3477C43A1CC234750028B84B /* MemStream.cpp in Sources */, 3477C3191CC04CF10028B84B /* ThreadCommon.cpp in Sources */, 3477C2781CBF08050028B84B /* ClipBoard.mm in Sources */, 346FACEC1D3C75AE00FFEBCE /* MDStringToDigest.cpp in Sources */, 3477C3491CC0AA7E0028B84B /* ProgressDlg.cpp in Sources */, 346FACEB1D3C75AE00FFEBCE /* Uri.cpp in Sources */, 3477C2B11CBF96C40028B84B /* Res.cpp in Sources */, 340833162698F8FF0028012F /* FontType.cpp in Sources */, 3477C4ED1CC27F1C0028B84B /* TrayIcon.cpp in Sources */, 3477C2991CBF09320028B84B /* ShowFileProp_Mac.mm in Sources */, 3477C2921CBF08C10028B84B /* ScreenDC.cpp in Sources */, 3477C2981CBF09320028B84B /* Mem.mm in Sources */, 3477C2CB1CC046310028B84B /* XmlTree.cpp in Sources */, 3477C2EF1CC04BBB0028B84B /* ItemContainer.cpp in Sources */, 3477C3081CC04BF00028B84B /* Splitter.cpp in Sources */, 34109857217A9805007020CE /* LCocoaView.h in Sources */, 3477C46D1CC26DEB0028B84B /* Alert.cpp in Sources */, 3477C3381CC04E120028B84B /* Alpha.cpp in Sources */, 3477C2EB1CC04B890028B84B /* Filter.cpp in Sources */, 3477C3321CC04E120028B84B /* 64Bit.cpp in Sources */, 3477C3041CC04BF00028B84B /* Edit.cpp in Sources */, 3477C3361CC04E120028B84B /* 48Bit.cpp in Sources */, 3477C3261CC04DE20028B84B /* Mutex.cpp in Sources */, 3477C2851CBF086A0028B84B /* Printer.mm in Sources */, 3477C33D1CC088590028B84B /* FileCommon.cpp in Sources */, 3477C3471CC0AA220028B84B /* WindowCommon.cpp in Sources */, 3477C3071CC04BF00028B84B /* RadioGroup.cpp in Sources */, 3477C2FF1CC04BF00028B84B /* Bitmap.cpp in Sources */, 3477C2E91CC04B5D0028B84B /* Rand.cpp in Sources */, 3477C2E71CC04B1E0028B84B /* Surface.cpp in Sources */, 3477C3241CC04DD70028B84B /* Object.cpp in Sources */, 3477C2E31CC04A5C0028B84B /* Stream.cpp in Sources */, 34A3ACEA20568D9700B1D62A /* MenuCommon.cpp in Sources */, 3477C3341CC04E120028B84B /* 24Bit.cpp in Sources */, 3477C3351CC04E120028B84B /* 32Bit.cpp in Sources */, 3477C2881CBF086A0028B84B /* Widgets.mm in Sources */, 340833172698F8FF0028012F /* TypeFace.cpp in Sources */, 3477C2891CBF086A0028B84B /* Window.mm in Sources */, 3477C3431CC0A6B90028B84B /* DocView.cpp in Sources */, 3477C2841CBF086A0028B84B /* Menu.mm in Sources */, 3477C2B41CBF96F20028B84B /* LMsg.cpp in Sources */, 3477C3311CC04E120028B84B /* 8Bit.cpp in Sources */, 3477C2DD1CC048F90028B84B /* FontSystem.cpp in Sources */, 3477C3101CC04C790028B84B /* Css.cpp in Sources */, 3477C2C91CC046310028B84B /* Unicode.cpp in Sources */, 3477C3221CC04DA00028B84B /* Colour.cpp in Sources */, 3477C2D31CC048100028B84B /* Containers.cpp in Sources */, 3477C2F01CC04BBB0028B84B /* List.cpp in Sources */, 3477C3331CC04E120028B84B /* 16Bit.cpp in Sources */, 3477C2751CBF07DD0028B84B /* App.mm in Sources */, 348CD46A25C63E56001AA32B /* AppCommon.cpp in Sources */, 3477C3411CC0A68E0028B84B /* DateTime.cpp in Sources */, 34C81A5A25DA0AA10053F93A /* Base64.cpp in Sources */, 3477C2C11CBF9A040028B84B /* String.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin XCBuildConfiguration section */ 3477C26E1CBF020F0028B84B /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_NONNULL = YES; CLANG_CXX_LANGUAGE_STANDARD = "c++14"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = NO; CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CODE_SIGN_IDENTITY = "-"; CODE_SIGN_INJECT_BASE_ENTITLEMENTS = NO; CODE_SIGN_STYLE = Manual; COPY_PHASE_STRIP = NO; CURRENT_PROJECT_VERSION = 1; DEAD_CODE_STRIPPING = YES; DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; GCC_NO_COMMON_BLOCKS = YES; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", "$(inherited)", ); GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; MACOSX_DEPLOYMENT_TARGET = 10.15; MODULEMAP_FILE = module.modulemap; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = macosx; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; name = Debug; }; 3477C26F1CBF020F0028B84B /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_NONNULL = YES; CLANG_CXX_LANGUAGE_STANDARD = "c++14"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = NO; CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CODE_SIGN_IDENTITY = "-"; CODE_SIGN_INJECT_BASE_ENTITLEMENTS = NO; CODE_SIGN_STYLE = Manual; COPY_PHASE_STRIP = NO; CURRENT_PROJECT_VERSION = 1; DEAD_CODE_STRIPPING = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_NO_COMMON_BLOCKS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; MACOSX_DEPLOYMENT_TARGET = 10.15; MODULEMAP_FILE = module.modulemap; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = macosx; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; name = Release; }; 3477C2711CBF020F0028B84B /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { CLANG_ANALYZER_NONNULL = YES_NONAGGRESSIVE; CLANG_ENABLE_OBJC_WEAK = YES; CODE_SIGN_IDENTITY = "-"; COMBINE_HIDPI_IMAGES = YES; DEAD_CODE_STRIPPING = YES; DEFINES_MODULE = YES; DEVELOPMENT_TEAM = 2AV9WN2LD8; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; FRAMEWORK_VERSION = A; GCC_C_LANGUAGE_STANDARD = c11; HEADER_SEARCH_PATHS = ( ../../../include, ../../../include/lgi/mac/cocoa, ../../../private/mac, ../../../private/common, ); INFOPLIST_FILE = Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/../Frameworks", "@loader_path/Frameworks", ); OTHER_CFLAGS = ( "-DMAC", "-DLGI_COCOA=1", "-DLGI_LIBRARY", "-D_DEBUG", + "-DLGI_UNIT_TESTS", ); OTHER_CODE_SIGN_FLAGS = "--timestamp --deep"; OTHER_CPLUSPLUSFLAGS = ( "-DMAC", "-DLGI_COCOA=1", "-DLGI_LIBRARY", "-D_DEBUG", + "-DLGI_UNIT_TESTS", ); PRODUCT_BUNDLE_IDENTIFIER = com.memecode.Lgi; PRODUCT_NAME = LgiCocoa; SDKROOT = macosx; SKIP_INSTALL = YES; STRIP_INSTALLED_PRODUCT = NO; WARNING_CFLAGS = "-Wno-nullability-completeness"; }; name = Debug; }; 3477C2721CBF020F0028B84B /* Release */ = { isa = XCBuildConfiguration; buildSettings = { CLANG_ANALYZER_NONNULL = YES_NONAGGRESSIVE; CLANG_ENABLE_OBJC_WEAK = YES; CODE_SIGN_IDENTITY = "-"; COMBINE_HIDPI_IMAGES = YES; DEAD_CODE_STRIPPING = YES; DEFINES_MODULE = YES; DEVELOPMENT_TEAM = 2AV9WN2LD8; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; FRAMEWORK_VERSION = A; GCC_C_LANGUAGE_STANDARD = c11; HEADER_SEARCH_PATHS = ( ../../../include, ../../../include/lgi/mac/cocoa, ../../../private/mac, ../../../private/common, ); INFOPLIST_FILE = Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/../Frameworks", "@loader_path/Frameworks", ); OTHER_CFLAGS = ( "-DMAC", "-DLGI_COCOA=1", "-DLGI_LIBRARY", ); OTHER_CODE_SIGN_FLAGS = "--timestamp --deep"; OTHER_CPLUSPLUSFLAGS = ( "-DMAC", "-DLGI_COCOA=1", "-DLGI_LIBRARY", ); PRODUCT_BUNDLE_IDENTIFIER = com.memecode.Lgi; PRODUCT_NAME = LgiCocoa; SDKROOT = macosx; SKIP_INSTALL = YES; STRIP_INSTALLED_PRODUCT = NO; WARNING_CFLAGS = "-Wno-nullability-completeness"; }; name = Release; }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ 3477C2621CBF020F0028B84B /* Build configuration list for PBXProject "LgiCocoa" */ = { isa = XCConfigurationList; buildConfigurations = ( 3477C26E1CBF020F0028B84B /* Debug */, 3477C26F1CBF020F0028B84B /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; 3477C2701CBF020F0028B84B /* Build configuration list for PBXNativeTarget "LgiCocoa" */ = { isa = XCConfigurationList; buildConfigurations = ( 3477C2711CBF020F0028B84B /* Debug */, 3477C2721CBF020F0028B84B /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; rootObject = 3477C25F1CBF020F0028B84B /* Project object */; } diff --git a/src/mac/cocoa/Window.mm b/src/mac/cocoa/Window.mm --- a/src/mac/cocoa/Window.mm +++ b/src/mac/cocoa/Window.mm @@ -1,1476 +1,1476 @@ #include #include "lgi/common/Lgi.h" #include "lgi/common/DragAndDrop.h" #include "lgi/common/Popup.h" #include "lgi/common/DisplayString.h" #include "lgi/common/Menu.h" #include "LCocoaView.h" extern void NextTabStop(LViewI *v, int dir); extern void SetDefaultFocus(LViewI *v); extern void BuildTabStops(LArray &Stops, LViewI *v); #define DEBUG_KEYS 0 #define DEBUG_SETFOCUS 0 #define DEBUG_LOGGING 0 #if DEBUG_LOGGING #define LOG(...) printf(__VA_ARGS__) #else #define LOG(...) #endif /* Deleting a LWindow senarios: Users clicks close: NSWindowDelegate::windowWillClose GWindowPrivate::OnClose(CloseUser) LNsWindow::onDelete Something deletes the LWindow programmatically: LWindow::~LWindow GWindowPriv::OnClose(CloseDestructor) LNsWindow::onDelete self.close windowWillClose -> block Something calls LWindow::Quit() LNsWindow::onQuit (async) self.close NSWindowDelegate::windowWillClose GWindowPrivate::OnClose(CloseUser) LNsWindow::onDelete */ #if DEBUG_SETFOCUS || DEBUG_KEYS static LString DescribeView(LViewI *v) { if (!v) return GString(); char s[512]; int ch = 0; LArray p; for (LViewI *i = v; i; i = i->GetParent()) { p.Add(i); } for (int n=MIN(3, (int)p.Length()-1); n>=0; n--) { char Buf[256] = ""; if (!stricmp(v->GetClass(), "LMdiChild")) sprintf(Buf, "'%s'", v->Name()); v = p[n]; ch += sprintf_s(s + ch, sizeof(s) - ch, "%s>%s", Buf, v->GetClass()); } return s; } #endif LRect LScreenFlip(LRect r) { LRect screen(0, 0, -1, -1); for (NSScreen *s in [NSScreen screens]) { LRect pos = s.frame; if (r.Overlap(&pos)) { screen = pos; break; } } if (screen.Valid()) { LRect rc = r; rc.Offset(0, (screen.Y() - r.y1 - r.Y()) - r.y1); // printf("%s:%i - Flip %s -> %s (%s)\n", _FL, r.GetStr(), rc.GetStr(), screen.GetStr()); return rc; } else { // printf("%s:%i - No Screen?\n", _FL); r.ZOff(-1, -1); } return r; } /////////////////////////////////////////////////////////////////////// class HookInfo { public: int Flags; LView *Target; }; @interface LWindowDelegate : NSObject { } - (id)init; - (void)dealloc; - (void)windowDidResize:(NSNotification*)aNotification; - (void)windowDidMove:(NSNotification*)aNotification; - (void)windowWillClose:(NSNotification*)aNotification; - (BOOL)windowShouldClose:(id)sender; - (void)windowDidBecomeMain:(NSNotification*)notification; - (void)windowDidResignMain:(NSNotification*)notification; @end LWindowDelegate *Delegate = nil; class LWindowPrivate { public: LWindow *Wnd = NULL; LWindow *ChildDlg = NULL; LMenu *EmptyMenu = NULL; LViewI *Focus = NULL; NSView *ContentCache = NULL; int Sx = -1, Sy = -1; LKey LastKey; LArray Hooks; uint64 LastMinimize = 0; uint64 LastDragDrop = 0; bool DeleteOnClose = true; bool SnapToEdge = false; bool InitVisible = false; LWindowPrivate(LWindow *wnd) { Wnd = wnd; } ~LWindowPrivate() { DeleteObj(EmptyMenu); } void OnClose(LCloseContext Ctx) { LOG("LWindowPrivate::OnClose %p/%s\n", Wnd, Wnd?Wnd->GetClass():NULL); auto &osw = Wnd->Wnd; if (!osw) return; LCocoaView *cv = objc_dynamic_cast(LCocoaView, osw.p.contentView); if (cv) cv.w = NULL; LNsWindow *w = objc_dynamic_cast(LNsWindow, osw.p); if (w) [w onDelete:Ctx]; osw.p.delegate = nil; [osw.p autorelease]; osw = nil; if (DeleteOnClose) delete Wnd; } ssize_t GetHookIndex(LView *Target, bool Create = false) { for (int i=0; iTarget = Target; n->Flags = 0; return Hooks.Length() - 1; } } return -1; } void OnResize() { NSWindow *wnd = Wnd->WindowHandle().p; Wnd->Pos = wnd.frame; Wnd->OnPosChange(); wnd.contentView.needsLayout = YES; } }; #define DefaultStyleMask NSWindowStyleMaskTitled | \ NSWindowStyleMaskResizable | \ NSWindowStyleMaskClosable | \ NSWindowStyleMaskMiniaturizable @implementation LNsWindow - (id)init:(LWindowPrivate*)priv Frame:(NSRect)rc { NSUInteger windowStyleMask = DefaultStyleMask; if ((self = [super initWithContentRect:rc styleMask:windowStyleMask backing:NSBackingStoreBuffered defer:NO ]) != nil) { self.d = priv; self->ReqClose = CSNone; self.contentView = [[LCocoaView alloc] init:priv->Wnd]; [self makeFirstResponder:self.contentView]; self.acceptsMouseMovedEvents = true; self.ignoresMouseEvents = false; self.canFocus = true; // printf("LNsWindow.init\n"); } return self; } - (void)dealloc { if (self.d) self.d->Wnd->OnDealloc(); LCocoaView *cv = objc_dynamic_cast(LCocoaView, self.contentView); cv.w = NULL; [cv release]; self.contentView = NULL; self.canFocus = true; [super dealloc]; // printf("LNsWindow.dealloc.\n"); } - (LWindow*)getWindow { return self.d ? self.d->Wnd : nil; } - (BOOL)canBecomeKeyWindow { return self.canFocus; } - (void)onQuit { #if DEBUG_LOGGING LWindow *wnd = self.d ? self.d->Wnd : NULL; auto cls = wnd ? wnd->GetClass() : NULL; #endif LOG("LNsWindow::onQuit %p/%s %i\n", wnd, cls, self->ReqClose); if (self->ReqClose == CSNone) { self->ReqClose = CSInRequest; if (!self.d) LOG("%s:%i - No priv pointer?\n", _FL); if (!self.d || !self.d->Wnd || !self.d->Wnd->OnRequestClose(false)) { LOG(" ::onQuit %p/%s no 'd' or OnReqClose failed\n", wnd, cls); self->ReqClose = CSNone; return; } } else return; LOG(" ::onQuit %p/%s self.close\n", wnd, cls); self->ReqClose = CSClosed; self.d->Wnd->SetPulse(); [self close]; } - (void)onDelete:(LCloseContext)ctx { LOG("LNsWindow::onDelete %p/%s\n", self.d->Wnd, self.d->Wnd->GetClass()); if (ctx == CloseDestructor && self->ReqClose != CSClosed) { // This is called during the ~LWindow destructor to make sure we // closed the window self->ReqClose = CSClosed; LOG(" ::onDelete %p self.close\n", self.d->Wnd); [self close]; } self.d = NULL; } @end @implementation LWindowDelegate - (id)init { if ((self = [super init]) != nil) { } return self; } - (void)dealloc { [super dealloc]; } - (void)windowDidResize:(NSNotification*)event { LNsWindow *w = event.object; if (w && w.d) w.d->OnResize(); } - (void)windowDidMove:(NSNotification*)event { // LNsWindow *w = event.object; // GRect r = LScreenFlip(w.frame); // printf("windowDidMove: %s\n", r.GetStr()); } - (BOOL)windowShouldClose:(NSWindow*)sender { LNsWindow *w = objc_dynamic_cast(LNsWindow, sender); if (w && w.d && w.d->Wnd) return w.d->Wnd->OnRequestClose(false); return YES; } - (void)windowWillClose:(NSNotification*)event { LNsWindow *w = event.object; if (w && w.d) w.d->OnClose(CloseUser); } - (void)windowDidBecomeMain:(NSNotification*)event { LNsWindow *w = event.object; if (w && w.d) w.d->Wnd->OnFrontSwitch(true); } - (void)windowDidResignMain:(NSNotification*)event { LNsWindow *w = event.object; if (w && w.d) w.d->Wnd->OnFrontSwitch(false); } @end /////////////////////////////////////////////////////////////////////// #define GWND_CREATE 0x0010000 #if __has_feature(objc_arc) #error "NO ARC!" #endif LWindow::LWindow(OsWindow wnd) : LView(NULL) { d = new LWindowPrivate(this); _QuitOnClose = false; Wnd = NULL; Menu = 0; _Default = 0; _Window = this; WndFlags |= GWND_CREATE; LView::Visible(false); _Lock = new LMutex("LWindow"); LRect pos(200, 200, 200, 200); NSRect frame = pos; if (wnd) Wnd = wnd; else Wnd.p = [[LNsWindow alloc] init:d Frame:frame]; if (Wnd) { [Wnd.p retain]; if (!Delegate) Delegate = [[LWindowDelegate alloc] init]; //[Wnd.p makeKeyAndOrderFront:NSApp]; Wnd.p.delegate = Delegate; d->ContentCache = Wnd.p.contentView; } } LWindow::~LWindow() { LOG("LWindow::~LWindow %p\n", this); if (LAppInst->AppWnd == this) LAppInst->AppWnd = 0; _Delete(); d->DeleteOnClose = false; // We're already in the destructor, don't redelete. d->OnClose(CloseDestructor); DeleteObj(Menu); DeleteObj(d); DeleteObj(_Lock); } int LWindow::WaitThread() { return 0; } NSView *LWindow::Handle() { if (!InThread()) return d->ContentCache; if (Wnd.p != nil) return Wnd.p.contentView; return NULL; } bool LWindow::SetTitleBar(bool ShowTitleBar) { if (!Wnd.p) return false; if (ShowTitleBar) { Wnd.p.titlebarAppearsTransparent = false; Wnd.p.titleVisibility = NSWindowTitleVisible; Wnd.p.styleMask = DefaultStyleMask; } else { Wnd.p.titlebarAppearsTransparent = true; Wnd.p.titleVisibility = NSWindowTitleHidden; Wnd.p.styleMask = 0; } return true; } bool LWindow::SetIcon(const char *FileName) { #warning "Impl LWindow::SetIcon" return false; } bool LWindow::SetWillFocus(bool f) { if (!Wnd.p) return false; LNsWindow *w = objc_dynamic_cast(LNsWindow, Wnd.p); if (!w) return false; w.canFocus = f; return true; } LViewI *LWindow::GetFocus() { return d->Focus; } void LWindow::SetFocus(LViewI *ctrl, FocusType type) { const char *TypeName = NULL; switch (type) { case GainFocus: TypeName = "Gain"; break; case LoseFocus: TypeName = "Lose"; break; case ViewDelete: TypeName = "Delete"; break; } switch (type) { case GainFocus: { // Check if the control already has focus if (d->Focus == ctrl) return; if (d->Focus) { LView *v = d->Focus->GetGView(); if (v) v->WndFlags &= ~GWF_FOCUS; d->Focus->OnFocus(false); d->Focus->Invalidate(); #if DEBUG_SETFOCUS auto _foc = DescribeView(d->Focus); LgiTrace(".....defocus: %s\n", _foc.Get()); #endif } d->Focus = ctrl; if (d->Focus) { LView *v = d->Focus->GetGView(); if (v) v->WndFlags |= GWF_FOCUS; d->Focus->OnFocus(true); d->Focus->Invalidate(); #if DEBUG_SETFOCUS auto _set = DescribeView(d->Focus); LgiTrace("LWindow::SetFocus(%s, %s) focusing\n", _set.Get(), TypeName); #endif } break; } case LoseFocus: { if (ctrl == d->Focus) { LView *v = d->Focus->GetGView(); if (v) { if (v->WndFlags & GWF_FOCUS) { // View thinks it has focus v->WndFlags &= ~GWF_FOCUS; d->Focus->OnFocus(false); // keep d->Focus pointer, as we want to be able to re-focus the child // view when we get focus again #if DEBUG_SETFOCUS auto _ctrl = DescribeView(ctrl); auto _foc = DescribeView(d->Focus); LgiTrace("LWindow::SetFocus(%s, %s) keep_focus: %s\n", _ctrl.Get(), TypeName, _foc.Get()); #endif } // else view doesn't think it has focus anyway... } else { // Non GView handler d->Focus->OnFocus(false); d->Focus->Invalidate(); d->Focus = NULL; } } else { /* LgiTrace("LWindow::SetFocus(%p.%s, %s) error on losefocus: %p(%s)\n", ctrl, ctrl ? ctrl->GetClass() : NULL, TypeName, d->Focus, d->Focus ? d->Focus->GetClass() : NULL); */ } break; } case ViewDelete: { if (ctrl == d->Focus) { #if DEBUG_SETFOCUS LgiTrace("LWindow::SetFocus(%p.%s, %s) delete_focus: %p(%s)\n", ctrl, ctrl ? ctrl->GetClass() : NULL, TypeName, d->Focus, d->Focus ? d->Focus->GetClass() : NULL); #endif d->Focus = NULL; } break; } } } void LWindow::SetDragHandlers(bool On) { #if 0 if (Wnd && _View) SetAutomaticControlDragTrackingEnabledForWindow(Wnd, On); #endif } void LWindow::Quit(bool DontDelete) { // LAutoPool Pool; if (_QuitOnClose) { _QuitOnClose = false; LCloseApp(); } if (Wnd) SetDragHandlers(false); if (d && DontDelete) { // If DontDelete is true, we should be already in the destructor of the LWindow. // Which means we DON'T call onQuit, as it's too late to ask the user if they don't // want to close the window. The window IS closed come what may, and the object is // going away. Futhermore we can't access the window's memory after it's deleted and // that may happen if the onQuit is processed after ~LWindow. d->DeleteOnClose = false; if (Wnd) [Wnd.p close]; } else if (Wnd) { [Wnd.p performSelectorOnMainThread:@selector(onQuit) withObject:nil waitUntilDone:false]; } } LWindow *LWindow::GetModalChild() { return d->ChildDlg; } bool LWindow::SetModalChild(LWindow *Dlg) { d->ChildDlg = Dlg; return true; } bool LWindow::GetSnapToEdge() { return d->SnapToEdge; } void LWindow::SetSnapToEdge(bool s) { d->SnapToEdge = s; } void LWindow::OnFrontSwitch(bool b) { if (b && Menu) { [NSApplication sharedApplication].mainMenu = Menu->Handle().p; } else { auto m = LAppInst->Default.Get(); [NSApplication sharedApplication].mainMenu = m ? m->Handle() : nil; } // printf("%s:%i - menu for %s is %p\n", _FL, Name(), [NSApplication sharedApplication].mainMenu); } bool LWindow::Visible() { // LAutoPool Pool; if (!Wnd) return false; return [Wnd.p isVisible]; } void LWindow::Visible(bool i) { // LAutoPool Pool; if (!Wnd) return; if (i) { d->InitVisible = true; PourAll(); [Wnd.p makeKeyAndOrderFront:NULL]; [NSApp activateIgnoringOtherApps:YES]; SetDefaultFocus(this); OnPosChange(); } else { [Wnd.p orderOut:Wnd.p]; } } bool LWindow::IsActive() { return Wnd ? [Wnd.p isKeyWindow] : false; } bool LWindow::SetActive() { [[NSApplication sharedApplication] activateIgnoringOtherApps : YES]; return false; } void LWindow::SetDeleteOnClose(bool i) { d->DeleteOnClose = i; } void LWindow::SetAlwaysOnTop(bool b) { if (!Wnd) { LgiTrace("%s:%i - No window.\n", _FL); return; } if (b) [Wnd.p setLevel:NSFloatingWindowLevel]; else [Wnd.p setLevel:NSNormalWindowLevel]; } bool LWindow::PostEvent(int Event, LMessage::Param a, LMessage::Param b, int64_t TimeoutMs) { return LAppInst->PostEvent(this, Event, a, b); } bool LWindow::Attach(LViewI *p) { bool Status = false; if (Wnd) { if (LBase::Name()) Name(LBase::Name()); Status = true; // Setup default button... if (!_Default) { _Default = FindControl(IDOK); if (_Default) _Default->Invalidate(); } OnCreate(); OnAttach(); OnPosChange(); // Set the first control as the focus... NextTabStop(this, 0); } return Status; } bool LWindow::OnRequestClose(bool OsShuttingDown) { if (GetQuitOnClose()) { LCloseApp(); } return LView::OnRequestClose(OsShuttingDown); } bool LWindow::HandleViewMouse(LView *v, LMouse &m) { if (m.Down()) { bool ParentPopup = false; LViewI *p = m.Target; while (p && p->GetParent()) { if (dynamic_cast(p)) { ParentPopup = true; break; } p = p->GetParent(); } if (!ParentPopup) { for (int i=0; iVisible()) { // printf("Hiding popup %s\n", pu->GetClass()); pu->Visible(false); } } } if (!m.IsMove() && LAppInst) { auto mh = LAppInst->GetMouseHook(); if (mh) mh->TrackClick(v); } } for (int i=0; iHooks.Length(); i++) { if (d->Hooks[i].Flags & LMouseEvents) { if (!d->Hooks[i].Target->OnViewMouse(v, m)) { return false; } } } return true; } bool LWindow::HandleViewKey(LView *v, LKey &k) { bool Status = false; LViewI *Ctrl = NULL; if (!v && d->Focus) v = d->Focus->GetGView(); if (!v) { #if DEBUG_KEYS k.Trace("No focus view to handle key."); #endif return false; } // Give key to popups if (LAppInst && LAppInst->GetMouseHook() && LAppInst->GetMouseHook()->OnViewKey(v, k)) { goto AllDone; } // Allow any hooks to see the key... for (int i=0; iHooks.Length(); i++) { if (d->Hooks[i].Flags & LKeyEvents) { if (d->Hooks[i].Target->OnViewKey(v, k)) { Status = true; #if DEBUG_KEYS printf("Hook ate '%c'(%i) down=%i alt=%i ctrl=%i sh=%i\n", k.c16, k.c16, k.Down(), k.Alt(), k.Ctrl(), k.Shift()); #endif goto AllDone; } } } // Give the key to the window... if (v->OnKey(k)) { #if DEBUG_KEYS GString vv = DescribeView(v); printf("%s ate '%c'(%i) down=%i alt=%i ctrl=%i sh=%i\n", vv.Get(), k.c16, k.c16, k.Down(), k.Alt(), k.Ctrl(), k.Shift()); #endif Status = true; goto AllDone; } // Window didn't want the key... switch (k.vkey) { case LK_RETURN: case LK_KEYPADENTER: { Ctrl = _Default; break; } case LK_ESCAPE: { Ctrl = FindControl(IDCANCEL); break; } case LK_TAB: { // Go to the next control? if (k.Down()) { LArray Stops; BuildTabStops(Stops, v->GetWindow()); ssize_t Idx = Stops.IndexOf(v); if (Idx >= 0) { if (k.Shift()) { Idx--; if (Idx < 0) Idx = Stops.Length() - 1; } else { Idx++; if (Idx >= Stops.Length()) Idx = 0; } Stops[Idx]->Focus(true); } } return true; } } if (Ctrl && Ctrl->Enabled()) { if (Ctrl->OnKey(k)) { Status = true; #if DEBUG_KEYS printf("Default Button ate '%c'(%i) down=%i alt=%i ctrl=%i sh=%i\n", k.c16, k.c16, k.Down(), k.Alt(), k.Ctrl(), k.Shift()); #endif goto AllDone; } } if (Menu) { Status = Menu->OnKey(v, k); if (Status) { #if DEBUG_KEYS printf("Menu ate '%c' down=%i alt=%i ctrl=%i sh=%i\n", k.c16, k.Down(), k.Alt(), k.Ctrl(), k.Shift()); #endif } } // Command+W closes the window... if it doesn't get nabbed earlier. if (k.Down() && k.System() && tolower(k.c16) == 'w') { // Close Quit(); return true; } AllDone: if (d) d->LastKey = k; else LAssert(!"Window was deleted and we are accessing unallocated mem."); return Status; } void LWindow::Raise() { if (Wnd) { // BringToFront(Wnd); } } LWindowZoom LWindow::GetZoom() { if (Wnd) { #if 0 bool c = IsWindowCollapsed(Wnd); // printf("IsWindowCollapsed=%i\n", c); if (c) return LZoomMin; c = IsWindowInStandardState(Wnd, NULL, NULL); // printf("IsWindowInStandardState=%i\n", c); if (!c) return LZoomMax; #endif } return LZoomNormal; } void LWindow::SetZoom(LWindowZoom i) { #if 0 OSStatus e = 0; switch (i) { case LZoomMin: { e = CollapseWindow(Wnd, true); if (e) printf("%s:%i - CollapseWindow failed with %i\n", _FL, (int)e); // else printf("LZoomMin ok.\n"); break; } default: case LZoomNormal: { e = CollapseWindow(Wnd, false); if (e) printf("%s:%i - [Un]CollapseWindow failed with %i\n", _FL, (int)e); // else printf("LZoomNormal ok.\n"); break; } } #endif } LViewI *LWindow::GetDefault() { return _Default; } void LWindow::SetDefault(LViewI *v) { if (v && v->GetWindow() == (LViewI*)this) { if (_Default != v) { auto Old = _Default; _Default = v; if (Old) Old->Invalidate(); if (_Default) _Default->Invalidate(); } } else { _Default = 0; } } bool LWindow::Name(const char *n) { // LAutoPool Pool; bool Status = LBase::Name(n); if (Wnd) { NSString *ns = [NSString stringWithCString:n encoding:NSUTF8StringEncoding]; Wnd.p.title = ns; //[ns release]; } return Status; } const char *LWindow::Name() { return LBase::Name(); } LRect &LWindow::GetClient(bool ClientSpace) { // LAutoPool Pool; static LRect r; if (Wnd) { r = Wnd.p.contentView.frame; if (ClientSpace) r.Offset(-r.x1, -r.y1); } else { r.ZOff(-1, -1); } return r; } bool LWindow::SerializeState(LDom *Store, const char *FieldName, bool Load) { if (!Store || !FieldName) return false; if (Load) { LVariant v; if (Store->GetValue(FieldName, v) && v.Str()) { LRect Position(0, 0, -1, -1); LWindowZoom State = LZoomNormal; auto t = LString(v.Str()).SplitDelimit(";"); for (auto s: t) { auto v = s.SplitDelimit("=", 1); if (v.Length() == 2) { if (v[0].Equals("State")) State = (LWindowZoom)v[1].Int(); else if (v[0].Equals("Pos")) Position.SetStr(v[1]); } else return false; } if (Position.Valid()) { if (Position.X() < 64) Position.x2 = Position.x1 + 63; if (Position.Y() < 64) Position.y2 = Position.y1 + 63; SetPos(Position); } SetZoom(State); } else return false; } else { char s[256]; LWindowZoom State = GetZoom(); snprintf(s, sizeof(s), "State=%i;Pos=%s", State, GetPos().GetStr()); LVariant v = s; if (!Store->SetValue(FieldName, v)) return false; } return true; } -LPoint LWindow::GetDpi() +LPoint LWindow::GetDpi() const { return LScreenDpi(); } LPointF LWindow::GetDpiScale() { auto Dpi = GetDpi(); return LPointF(Dpi.x / 100.0, Dpi.y / 100.0); } LRect &LWindow::GetPos() { // LAutoPool Pool; if (Wnd) { Pos = LScreenFlip(Wnd.p.frame); // printf("%s::GetPos %s\n", GetClass(), Pos.GetStr()); } return Pos; } bool LWindow::SetPos(LRect &p, bool Repaint) { // LAutoPool Pool; Pos = p; if (Wnd) { LRect r = LScreenFlip(p); [Wnd.p setFrame:r display:YES]; // printf("%s::SetPos %s\n", GetClass(), Pos.GetStr()); } return true; } void LWindow::OnChildrenChanged(LViewI *Wnd, bool Attaching) { if (dynamic_cast(Wnd)) { printf("%s:%i - Ignoring GPopup in OnChildrenChanged handler.\n", _FL); return; } PourAll(); } void LWindow::OnCreate() { } void LWindow::OnPaint(LSurface *pDC) { pDC->Colour(L_MED); pDC->Rectangle(); } void LWindow::OnPosChange() { LView::OnPosChange(); if (d->Sx != X() || d->Sy != Y()) { PourAll(); d->Sx = X(); d->Sy = Y(); } } #define IsTool(v) \ ( \ dynamic_cast(v) \ && \ dynamic_cast(v)->_IsToolBar \ ) void LWindow::PourAll() { LRect r = GetClient(); // printf("::Pour r=%s\n", r.GetStr()); LRegion Client(r); LRegion Update(Client); bool HasTools = false; LViewI *v; List::I Lst = Children.begin(); { LRegion Tools; for (v = *Lst; v; v = *++Lst) { if (IsTool(v)) { LRect OldPos = v->GetPos(); Update.Union(&OldPos); if (HasTools) { // 2nd and later toolbars if (v->Pour(Tools)) { if (!v->Visible()) { v->Visible(true); } if (OldPos != v->GetPos()) { // position has changed update... v->Invalidate(); } Tools.Subtract(&v->GetPos()); Update.Subtract(&v->GetPos()); } } else { // First toolbar if (v->Pour(Client)) { HasTools = true; if (!v->Visible()) { v->Visible(true); } if (OldPos != v->GetPos()) { v->Invalidate(); } LRect Bar(v->GetPos()); Bar.x2 = GetClient().x2; Tools = Bar; Tools.Subtract(&v->GetPos()); Client.Subtract(&Bar); Update.Subtract(&Bar); } } } } } Lst = Children.begin(); for (LViewI *v = *Lst; v; v = *++Lst) { if (!IsTool(v)) { LRect OldPos = v->GetPos(); Update.Union(&OldPos); if (v->Pour(Client)) { if (!v->Visible()) { v->Visible(true); } v->Invalidate(); Client.Subtract(&v->GetPos()); Update.Subtract(&v->GetPos()); } else { // non-pourable } } } for (int i=0; iMsg()) { case M_CLOSE: { if (Wnd) [Wnd.p performSelectorOnMainThread:@selector(onQuit) withObject:nil waitUntilDone:false]; else LAssert(!"No window?"); break; } case M_DESTROY: { delete this; return true; } } return LView::OnEvent(m); } bool LWindow::RegisterHook(LView *Target, LWindowHookType EventType, int Priority) { bool Status = false; if (Target && EventType) { ssize_t i = d->GetHookIndex(Target, true); if (i >= 0) { d->Hooks[i].Flags = EventType; Status = true; } } return Status; } bool LWindow::UnregisterHook(LView *Target) { ssize_t i = d->GetHookIndex(Target); if (i >= 0) { d->Hooks.DeleteAt(i); return true; } return false; } LViewI *LWindow::WindowFromPoint(int x, int y, int DebugDepth) { for (int i=0; iVisible()) { auto r = p->GetPos(); if (r.Overlap(x, y)) { // printf("WindowFromPoint got %s click (%i,%i)\n", p->GetClass(), x, y); return p->WindowFromPoint(x - r.x1, y - r.y1, DebugDepth ? DebugDepth + 1 : 0); } } } return LView::WindowFromPoint(x, y, DebugDepth ? DebugDepth + 1 : 0); } int LWindow::OnCommand(int Cmd, int Event, OsView SrcCtrl) { #if 0 OsView v; switch (Cmd) { case kHICommandCut: { OSErr e = GetKeyboardFocus(Wnd, (ControlRef*) &v); if (!e) LgiPostEvent(v, M_CUT); break; } case kHICommandCopy: { OSErr e = GetKeyboardFocus(Wnd, (ControlRef*) &v); if (!e) LgiPostEvent(v, M_COPY); break; } case kHICommandPaste: { OSErr e = GetKeyboardFocus(Wnd, (ControlRef*) &v); if (!e) LgiPostEvent(v, M_PASTE); break; } case 'dele': { OSErr e = GetKeyboardFocus(Wnd, (ControlRef*) &v); if (!e) LgiPostEvent(v, M_DELETE); break; } } #endif return 0; } void LWindow::OnTrayClick(LMouse &m) { if (m.Down() || m.IsContextMenu()) { LSubMenu RClick; OnTrayMenu(RClick); if (GetMouse(m, true)) { #if WINNATIVE SetForegroundWindow(Handle()); #endif int Result = RClick.Float(this, m.x, m.y); #if WINNATIVE PostMessage(Handle(), WM_NULL, 0, 0); #endif OnTrayMenuResult(Result); } } } bool LWindow::Obscured() { // LAutoPool Pool; if (!Wnd) return false; auto s = [Wnd.p occlusionState]; return !(s & NSWindowOcclusionStateVisible); } diff --git a/test/UnitTests/mac/Assets.xcassets/AppIcon.appiconset/Contents.json b/test/UnitTests/mac/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 --- /dev/null +++ b/test/UnitTests/mac/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,58 @@ +{ + "images" : [ + { + "idiom" : "mac", + "size" : "16x16", + "scale" : "1x" + }, + { + "idiom" : "mac", + "size" : "16x16", + "scale" : "2x" + }, + { + "idiom" : "mac", + "size" : "32x32", + "scale" : "1x" + }, + { + "idiom" : "mac", + "size" : "32x32", + "scale" : "2x" + }, + { + "idiom" : "mac", + "size" : "128x128", + "scale" : "1x" + }, + { + "idiom" : "mac", + "size" : "128x128", + "scale" : "2x" + }, + { + "idiom" : "mac", + "size" : "256x256", + "scale" : "1x" + }, + { + "idiom" : "mac", + "size" : "256x256", + "scale" : "2x" + }, + { + "idiom" : "mac", + "size" : "512x512", + "scale" : "1x" + }, + { + "idiom" : "mac", + "size" : "512x512", + "scale" : "2x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/test/UnitTests/mac/Assets.xcassets/Contents.json b/test/UnitTests/mac/Assets.xcassets/Contents.json new file mode 100644 --- /dev/null +++ b/test/UnitTests/mac/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/test/UnitTests/mac/Base.lproj/MainMenu.xib b/test/UnitTests/mac/Base.lproj/MainMenu.xib new file mode 100644 --- /dev/null +++ b/test/UnitTests/mac/Base.lproj/MainMenu.xib @@ -0,0 +1,692 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Default + + + + + + + Left to Right + + + + + + + Right to Left + + + + + + + + + + + Default + + + + + + + Left to Right + + + + + + + Right to Left + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/test/UnitTests/mac/Info.plist b/test/UnitTests/mac/Info.plist new file mode 100644 --- /dev/null +++ b/test/UnitTests/mac/Info.plist @@ -0,0 +1,30 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIconFile + mac-icon.icns + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + LSMinimumSystemVersion + $(MACOSX_DEPLOYMENT_TARGET) + NSHumanReadableCopyright + Copyright © 2019 Memecode. All rights reserved. + NSPrincipalClass + NSApplication + + diff --git a/test/UnitTests/mac/UnitTests.entitlements b/test/UnitTests/mac/UnitTests.entitlements new file mode 100644 --- /dev/null +++ b/test/UnitTests/mac/UnitTests.entitlements @@ -0,0 +1,5 @@ + + + + + diff --git a/test/UnitTests/mac/UnitTests.xcodeproj/project.pbxproj b/test/UnitTests/mac/UnitTests.xcodeproj/project.pbxproj new file mode 100644 --- /dev/null +++ b/test/UnitTests/mac/UnitTests.xcodeproj/project.pbxproj @@ -0,0 +1,478 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 50; + objects = { + +/* Begin PBXBuildFile section */ + 343FB8952386621600797ABC /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 343FB8942386621600797ABC /* Assets.xcassets */; }; + 343FB8C62386638C00797ABC /* LgiCocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 343FB8A92386627A00797ABC /* LgiCocoa.framework */; }; + 343FB8C82386639C00797ABC /* LgiCocoa.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 343FB8A92386627A00797ABC /* LgiCocoa.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 349F93902B92C590002410A2 /* XmlTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 349F93832B92C590002410A2 /* XmlTest.cpp */; }; + 349F93912B92C590002410A2 /* UnitTests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 349F93842B92C590002410A2 /* UnitTests.cpp */; }; + 349F93922B92C590002410A2 /* AutoPtrTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 349F93852B92C590002410A2 /* AutoPtrTest.cpp */; }; + 349F93932B92C590002410A2 /* NetworkTests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 349F93862B92C590002410A2 /* NetworkTests.cpp */; }; + 349F93942B92C590002410A2 /* StringClassTests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 349F93882B92C590002410A2 /* StringClassTests.cpp */; }; + 349F93952B92C590002410A2 /* StringTests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 349F93892B92C590002410A2 /* StringTests.cpp */; }; + 349F93962B92C590002410A2 /* RangeTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 349F938A2B92C590002410A2 /* RangeTest.cpp */; }; + 349F93972B92C590002410A2 /* ContainerTests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 349F938B2B92C590002410A2 /* ContainerTests.cpp */; }; + 349F93982B92C590002410A2 /* MatrixTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 349F938C2B92C590002410A2 /* MatrixTest.cpp */; }; + 349F93992B92C590002410A2 /* JsonTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 349F938D2B92C590002410A2 /* JsonTest.cpp */; }; + 349F939A2B92C590002410A2 /* CssTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 349F938E2B92C590002410A2 /* CssTest.cpp */; }; + 349F939B2B92C590002410A2 /* BitsTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 349F938F2B92C590002410A2 /* BitsTest.cpp */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 343FB8A82386627A00797ABC /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 343FB8A42386627A00797ABC /* LgiCocoa.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 3477C2681CBF020F0028B84B; + remoteInfo = LgiCocoa; + }; + 343FB8C32386638800797ABC /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 343FB8A42386627A00797ABC /* LgiCocoa.xcodeproj */; + proxyType = 1; + remoteGlobalIDString = 3477C2671CBF020F0028B84B; + remoteInfo = LgiCocoa; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 343FB8C72386639100797ABC /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + 343FB8C82386639C00797ABC /* LgiCocoa.framework in CopyFiles */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 343FB88E2386621400797ABC /* UnitTests.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = UnitTests.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 343FB8942386621600797ABC /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 343FB8992386621600797ABC /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 343FB89C2386621600797ABC /* UnitTests.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = UnitTests.entitlements; sourceTree = ""; }; + 343FB8A42386627A00797ABC /* LgiCocoa.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = LgiCocoa.xcodeproj; path = ../../../src/mac/cocoa/LgiCocoa.xcodeproj; sourceTree = ""; }; + 349F93832B92C590002410A2 /* XmlTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = XmlTest.cpp; path = ../src/XmlTest.cpp; sourceTree = ""; }; + 349F93842B92C590002410A2 /* UnitTests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = UnitTests.cpp; path = ../src/UnitTests.cpp; sourceTree = ""; }; + 349F93852B92C590002410A2 /* AutoPtrTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = AutoPtrTest.cpp; path = ../src/AutoPtrTest.cpp; sourceTree = ""; }; + 349F93862B92C590002410A2 /* NetworkTests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = NetworkTests.cpp; path = ../src/NetworkTests.cpp; sourceTree = ""; }; + 349F93872B92C590002410A2 /* UnitTests.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = UnitTests.h; path = ../src/UnitTests.h; sourceTree = ""; }; + 349F93882B92C590002410A2 /* StringClassTests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = StringClassTests.cpp; path = ../src/StringClassTests.cpp; sourceTree = ""; }; + 349F93892B92C590002410A2 /* StringTests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = StringTests.cpp; path = ../src/StringTests.cpp; sourceTree = ""; }; + 349F938A2B92C590002410A2 /* RangeTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RangeTest.cpp; path = ../src/RangeTest.cpp; sourceTree = ""; }; + 349F938B2B92C590002410A2 /* ContainerTests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ContainerTests.cpp; path = ../src/ContainerTests.cpp; sourceTree = ""; }; + 349F938C2B92C590002410A2 /* MatrixTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = MatrixTest.cpp; path = ../src/MatrixTest.cpp; sourceTree = ""; }; + 349F938D2B92C590002410A2 /* JsonTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JsonTest.cpp; path = ../src/JsonTest.cpp; sourceTree = ""; }; + 349F938E2B92C590002410A2 /* CssTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CssTest.cpp; path = ../src/CssTest.cpp; sourceTree = ""; }; + 349F938F2B92C590002410A2 /* BitsTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = BitsTest.cpp; path = ../src/BitsTest.cpp; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 343FB88B2386621400797ABC /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 343FB8C62386638C00797ABC /* LgiCocoa.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 343FB8852386621400797ABC = { + isa = PBXGroup; + children = ( + 343FB8A22386625100797ABC /* Cocoa */, + 343FB8B9238662DB00797ABC /* Code */, + 343FB8C52386638C00797ABC /* Frameworks */, + 343FB8A32386626700797ABC /* Lgi */, + 343FB88F2386621400797ABC /* Products */, + ); + sourceTree = ""; + }; + 343FB88F2386621400797ABC /* Products */ = { + isa = PBXGroup; + children = ( + 343FB88E2386621400797ABC /* UnitTests.app */, + ); + name = Products; + sourceTree = ""; + }; + 343FB8A22386625100797ABC /* Cocoa */ = { + isa = PBXGroup; + children = ( + 343FB8942386621600797ABC /* Assets.xcassets */, + 343FB8992386621600797ABC /* Info.plist */, + 343FB89C2386621600797ABC /* UnitTests.entitlements */, + ); + name = Cocoa; + sourceTree = ""; + }; + 343FB8A32386626700797ABC /* Lgi */ = { + isa = PBXGroup; + children = ( + ); + name = Lgi; + sourceTree = ""; + }; + 343FB8A52386627A00797ABC /* Products */ = { + isa = PBXGroup; + children = ( + 343FB8A92386627A00797ABC /* LgiCocoa.framework */, + ); + name = Products; + sourceTree = ""; + }; + 343FB8B9238662DB00797ABC /* Code */ = { + isa = PBXGroup; + children = ( + 349F93852B92C590002410A2 /* AutoPtrTest.cpp */, + 349F938F2B92C590002410A2 /* BitsTest.cpp */, + 349F938B2B92C590002410A2 /* ContainerTests.cpp */, + 349F938E2B92C590002410A2 /* CssTest.cpp */, + 349F938D2B92C590002410A2 /* JsonTest.cpp */, + 349F938C2B92C590002410A2 /* MatrixTest.cpp */, + 349F93862B92C590002410A2 /* NetworkTests.cpp */, + 349F938A2B92C590002410A2 /* RangeTest.cpp */, + 349F93882B92C590002410A2 /* StringClassTests.cpp */, + 349F93892B92C590002410A2 /* StringTests.cpp */, + 349F93842B92C590002410A2 /* UnitTests.cpp */, + 349F93872B92C590002410A2 /* UnitTests.h */, + 349F93832B92C590002410A2 /* XmlTest.cpp */, + ); + name = Code; + sourceTree = ""; + }; + 343FB8C52386638C00797ABC /* Frameworks */ = { + isa = PBXGroup; + children = ( + 343FB8A42386627A00797ABC /* LgiCocoa.xcodeproj */, + ); + name = Frameworks; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 343FB88D2386621400797ABC /* UnitTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 343FB89F2386621600797ABC /* Build configuration list for PBXNativeTarget "UnitTests" */; + buildPhases = ( + 343FB88A2386621400797ABC /* Sources */, + 343FB88B2386621400797ABC /* Frameworks */, + 343FB88C2386621400797ABC /* Resources */, + 343FB8C72386639100797ABC /* CopyFiles */, + ); + buildRules = ( + ); + dependencies = ( + 343FB8C42386638800797ABC /* PBXTargetDependency */, + ); + name = UnitTests; + productName = UnitTests; + productReference = 343FB88E2386621400797ABC /* UnitTests.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 343FB8862386621400797ABC /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 1010; + ORGANIZATIONNAME = Memecode; + TargetAttributes = { + 343FB88D2386621400797ABC = { + CreatedOnToolsVersion = 10.1; + }; + }; + }; + buildConfigurationList = 343FB8892386621400797ABC /* Build configuration list for PBXProject "UnitTests" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 343FB8852386621400797ABC; + productRefGroup = 343FB88F2386621400797ABC /* Products */; + projectDirPath = ""; + projectReferences = ( + { + ProductGroup = 343FB8A52386627A00797ABC /* Products */; + ProjectRef = 343FB8A42386627A00797ABC /* LgiCocoa.xcodeproj */; + }, + ); + projectRoot = ""; + targets = ( + 343FB88D2386621400797ABC /* UnitTests */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXReferenceProxy section */ + 343FB8A92386627A00797ABC /* LgiCocoa.framework */ = { + isa = PBXReferenceProxy; + fileType = wrapper.framework; + path = LgiCocoa.framework; + remoteRef = 343FB8A82386627A00797ABC /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; +/* End PBXReferenceProxy section */ + +/* Begin PBXResourcesBuildPhase section */ + 343FB88C2386621400797ABC /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 343FB8952386621600797ABC /* Assets.xcassets in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 343FB88A2386621400797ABC /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 349F939B2B92C590002410A2 /* BitsTest.cpp in Sources */, + 349F93922B92C590002410A2 /* AutoPtrTest.cpp in Sources */, + 349F93962B92C590002410A2 /* RangeTest.cpp in Sources */, + 349F93982B92C590002410A2 /* MatrixTest.cpp in Sources */, + 349F93952B92C590002410A2 /* StringTests.cpp in Sources */, + 349F93932B92C590002410A2 /* NetworkTests.cpp in Sources */, + 349F93912B92C590002410A2 /* UnitTests.cpp in Sources */, + 349F93992B92C590002410A2 /* JsonTest.cpp in Sources */, + 349F93942B92C590002410A2 /* StringClassTests.cpp in Sources */, + 349F93972B92C590002410A2 /* ContainerTests.cpp in Sources */, + 349F93902B92C590002410A2 /* XmlTest.cpp in Sources */, + 349F939A2B92C590002410A2 /* CssTest.cpp in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 343FB8C42386638800797ABC /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = LgiCocoa; + targetProxy = 343FB8C32386638800797ABC /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin XCBuildConfiguration section */ + 343FB89D2386621600797ABC /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "-"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.13; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx; + }; + name = Debug; + }; + 343FB89E2386621600797ABC /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "-"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.13; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = macosx; + }; + name = Release; + }; + 343FB8A02386621600797ABC /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + LGI_UNIT_TESTS, + ); + HEADER_SEARCH_PATHS = ( + ../../../include, + ../../../include/lgi/mac/cocoa, + ../Code, + ../Resources, + ); + INFOPLIST_FILE = Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + MACOSX_DEPLOYMENT_TARGET = 10.15; + OTHER_CFLAGS = ( + "-DMAC", + "-DLGI_COCOA", + "-D_DEBUG", + ); + OTHER_CPLUSPLUSFLAGS = ( + "$(OTHER_CFLAGS)", + "-Wno-nullability-completeness", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.memecode.UnitTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + 343FB8A12386621600797ABC /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + GCC_PREPROCESSOR_DEFINITIONS = LGI_UNIT_TESTS; + HEADER_SEARCH_PATHS = ( + ../../../include, + ../../../include/lgi/mac/cocoa, + ../Code, + ../Resources, + ); + INFOPLIST_FILE = Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + MACOSX_DEPLOYMENT_TARGET = 10.15; + OTHER_CFLAGS = ( + "-DMAC", + "-DLGI_COCOA", + ); + OTHER_CPLUSPLUSFLAGS = ( + "$(OTHER_CFLAGS)", + "-Wno-nullability-completeness", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.memecode.UnitTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 343FB8892386621400797ABC /* Build configuration list for PBXProject "UnitTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 343FB89D2386621600797ABC /* Debug */, + 343FB89E2386621600797ABC /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 343FB89F2386621600797ABC /* Build configuration list for PBXNativeTarget "UnitTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 343FB8A02386621600797ABC /* Debug */, + 343FB8A12386621600797ABC /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 343FB8862386621400797ABC /* Project object */; +} diff --git a/test/UnitTests/src/StringTests.cpp b/test/UnitTests/src/StringTests.cpp --- a/test/UnitTests/src/StringTests.cpp +++ b/test/UnitTests/src/StringTests.cpp @@ -1,91 +1,95 @@ -#include "lgi/common/Lgi.h" +#include "lgi/common/Lgi.h" #include "lgi/common/TextConvert.h" #include "UnitTests.h" class PrivLStringTests { public: }; LStringTests::LStringTests() : UnitTest("LStringTests") { d = new PrivLStringTests; } LStringTests::~LStringTests() { DeleteObj(d); } bool LStringTests::Run() { /* Things to test: bool Is8Bit(const char *Text); [[deprecated]] char *DecodeBase64Str(char *Str, ssize_t Len = -1); LString LDecodeBase64Str(LString Str); [[deprecated]] char *DecodeQuotedPrintableStr(char *Str, ssize_t Len = -1); LString LDecodeQuotedPrintableStr(LString Str); [[deprecated]] char *DecodeRfc2047(char *Str); LString LDecodeRfc2047(LString Str); LString LEncodeRfc2047(LString Str, const char *Charset, List *CharsetPrefs, ssize_t LineLength = 0); */ const char *EncodeResult1 = "=?iso-8859-1?Q?Beytullah_Gen=E7?="; const char *EncodeResult2 = "=?iso-8859-9?Q?Beytullah_Gen=E7?="; LString::Array CharsetPrefs; const char *Rfc2047Input = "Beytullah Genç"; const char *UtfInput = "Beytullah Genç"; const char *Charset = "windows-1252"; // No prefered charset testing: LAutoString result1( EncodeRfc2047(NewStr(Rfc2047Input), Charset) ); if (Stricmp(result1.Get(), EncodeResult1)) + { + printf("result1='%s'\n", result1.Get()); + printf("EncodeResult1='%s'\n", EncodeResult1); return FAIL(_FL, "EncodeRfc2047"); + } LAutoString decode1( DecodeRfc2047(NewStr(result1)) ); if (Strcmp(UtfInput, decode1.Get())) return FAIL(_FL, "DecodeRfc2047"); LString result2 = LEncodeRfc2047(Rfc2047Input, Charset); if (Stricmp(result2.Get(), EncodeResult1)) return FAIL(_FL, "LEncodeRfc2047"); LAutoString decode2( DecodeRfc2047(NewStr(result2)) ); if (Strcmp(UtfInput, decode2.Get())) return FAIL(_FL, "DecodeRfc2047"); // Redo tests with a charset preference set: CharsetPrefs.Add("iso-8859-9"); LAutoString result3( EncodeRfc2047(NewStr(Rfc2047Input), Charset, &CharsetPrefs)); if (Stricmp(result3.Get(), EncodeResult2)) return FAIL(_FL, "EncodeRfc2047"); LString result4 = LEncodeRfc2047(Rfc2047Input, Charset, &CharsetPrefs); if (Stricmp(result4.Get(), EncodeResult2)) return FAIL(_FL, "EncodeRfc2047"); // Quoted printable decode test: auto input5 = "=?UTF-8?q?=D0=92=D0=B0=D0=BC_=D0=BF=D1=80=D0=B8=D1=88=D0=BB=D0=BE_=D0=BD?= =?UTF-8?q?=D0=BE=D0=B2=D0=BE=D0=B5_=D1=81=D0=BE=D0=BE=D0=B1=D1=89=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5?="; auto result5 = LDecodeRfc2047(input5); auto encodeResult5 = L"Вам пришло новое сообщение"; LAutoWString decode5( Utf8ToWide(result5) ); if (Stricmp(encodeResult5, decode5.Get())) return FAIL(_FL, "LDecodeRfc2047"); // Mixing encoded and plain words: auto input6 = "test =?UTF-8?q?=D0=BE=D0=B2=D0=BE=D0=B5?= of words =?UTF-8?q?=D0=BE=D0=B2=D0=BE=D0=B5?="; auto result6 = LDecodeRfc2047(input6); auto encodeResult6 = L"test овое of words овое"; LAutoWString decode6( Utf8ToWide(result6) ); if (Stricmp(encodeResult6, decode6.Get())) return FAIL(_FL, "LDecodeRfc2047"); return true; } diff --git a/test/UnitTests/UnitTests.sln b/test/UnitTests/win/UnitTests.sln rename from test/UnitTests/UnitTests.sln rename to test/UnitTests/win/UnitTests.sln diff --git a/test/UnitTests/UnitTests.vcxproj b/test/UnitTests/win/UnitTests.vcxproj rename from test/UnitTests/UnitTests.vcxproj rename to test/UnitTests/win/UnitTests.vcxproj diff --git a/test/UnitTests/UnitTests.vcxproj.filters b/test/UnitTests/win/UnitTests.vcxproj.filters rename from test/UnitTests/UnitTests.vcxproj.filters rename to test/UnitTests/win/UnitTests.vcxproj.filters