diff --git a/include/mac/cocoa/LgiOsClasses.h b/include/mac/cocoa/LgiOsClasses.h --- a/include/mac/cocoa/LgiOsClasses.h +++ b/include/mac/cocoa/LgiOsClasses.h @@ -1,46 +1,47 @@ /// \file /// \author Matthew Allen #ifndef __OS_CLASS_H #define __OS_CLASS_H class LgiClass OsApplication { int Args; const char **Arg; public: OsApplication(int i, const char **a) { Args = i; Arg = a; } int GetArgs() { return Args; } const char **GetArg() { return Arg; } }; extern OsView DefaultOsView(class GView *v); #ifdef __OBJC__ +/* class LAutoPool { NSAutoreleasePool * pool; public: LAutoPool() { pool = [[NSAutoreleasePool alloc] init]; } ~LAutoPool() { [pool release]; } }; - +*/ #endif #endif diff --git a/include/mac/cocoa/LgiOsDefs.h b/include/mac/cocoa/LgiOsDefs.h --- a/include/mac/cocoa/LgiOsDefs.h +++ b/include/mac/cocoa/LgiOsDefs.h @@ -1,319 +1,319 @@ // // FILE: LgiOsDefs.h (Mac) // AUTHOR: Matthew Allen // DATE: 1/1/2013 // DESCRIPTION: Lgi cocoa header // // Copyright (C) 2013, Matthew Allen // fret@memecode.com // #ifndef __LGI_MAC_OS_DEFS_H #define __LGI_MAC_OS_DEFS_H #include #include #include #include "LgiInc.h" #include "LgiDefs.h" #include "GAutoPtr.h" #include "LgiClass.h" #include "pthread.h" ////////////////////////////////////////////////////////////////// // Includes #include "LgiInc.h" #ifdef __OBJC__ #import #endif #include #include ////////////////////////////////////////////////////////////////// // Typedefs #ifdef __OBJC__ #define ObjCWrapper(Type, Name) \ class Name \ { \ public: \ - Type * _Nullable p; \ - Name(Type * _Nullable i) { p = i; } \ + Type * __strong _Nullable p; \ + Name(Type * __strong _Nullable i) { p = i; } \ Name(long i = 0) { p = NULL; } \ - Name &operator=(Type * _Nullable i) { p = i; return *this; } \ + Name &operator=(Type * __strong _Nullable i) { p = i; return *this; } \ Name &operator=(long i) { p = NULL; return *this; } \ operator bool() { return p != NULL; } \ operator Type* _Nullable() { return p; } \ bool operator ==(const Name &obj) { return p == obj.p; } \ }; #else #define ObjCWrapper(Type, Name) \ class Name \ { \ void *p; \ public: \ Name(void *i) { p = i; } \ Name(long i = 0) { p = NULL; } \ Name &operator=(void *i) { p = i; return *this; } \ Name &operator=(long i) { p = NULL; return *this; } \ operator bool() { return p != NULL; } \ operator void*() { return p; } \ bool operator ==(const void *obj) { return p == obj; } \ }; #endif ObjCWrapper(NSWindow, OsWindow) ObjCWrapper(NSView, OsView) typedef pthread_t OsThread; typedef uint64_t OsThreadId; typedef pthread_mutex_t OsSemaphore; typedef uint16_t OsChar; typedef int OsProcessId; typedef int OsProcess; typedef CGContextRef OsPainter; typedef CGContextRef OsBitmap; typedef CTFontRef OsFont; #include "GMessage.h" class OsAppArguments { struct OsAppArgumentsPriv *d; public: int Args; const char **Arg; OsAppArguments(int args = 0, const char **arg = 0); ~OsAppArguments(); void Set(char *CmdLine); OsAppArguments &operator =(OsAppArguments &a); }; ////////////////////////////////////////////////////////////////// // Defines #define _stricmp strcasecmp #define _strnicmp strncasecmp // Text system #define USE_CORETEXT 1 // System defines #define POSIX 1 #define LGI_COCOA 1 #define LGI_64BIT 1 #define LGI_VIEW_HANDLE 0 // GViews DON'T have individual OsView handles #define LGI_VIEW_HASH 1 // GView DO have a hash table for validity // Process typedef int OsProcess; typedef int OsProcessId; #define LgiGetCurrentProcess() getpid() // Threads #define LgiGetCurrentThread() pthread_self() LgiFunc OsThreadId GetCurrentThreadId(); // Sockets #define ValidSocket(s) ((s)>=0) #define INVALID_SOCKET -1 typedef int OsSocket; // Sleep the current thread LgiFunc void LgiSleep(uint32_t i); // Run the message loop to process any pending messages #define LgiYield() GApp::ObjInstance()->Run(false) #define LGI_GViewMagic 0x14412662 #define LGI_FileDropFormat "furl" // typeFileURL #define LGI_StreamDropFormat "" // kPasteboardTypeFileURLPromise #define LGI_LgiDropFormat "lgi " #define LGI_WideCharset "utf-32" #define LPrintfInt64 "%lli" #define LPrintfHex64 "%llx" #define LPrintfSizeT "%zu" #define LPrintfSSizeT "%zi" #define atoi64 atoll #define sprintf_s snprintf #define vsprintf_s vsnprintf #define LGI_IllegalFileNameChars "/" // FIXME: what other characters should be in here? #define LGI_EXECUTABLE_EXT "" // Empty // Window flags #define GWF_VISIBLE 0x00000001 #define GWF_DISABLED 0x00000002 #define GWF_FOCUS 0x00000004 #define GWF_OVER 0x00000008 #define GWF_DROP_TARGET 0x00000010 #define GWF_SUNKEN 0x00000020 #define GWF_FLAT 0x00000040 #define GWF_RAISED 0x00000080 #define GWF_BORDER 0x00000100 #define GWF_DIALOG 0x00000200 #define GWF_DESTRUCTOR 0x00000400 #define GWF_QUIT_WND 0x00000800 // Menu flags #define ODS_SELECTED 0x1 #define ODS_DISABLED 0x2 #define ODS_CHECKED 0x4 /// Edge type: Sunken #define SUNKEN 1 /// Edge type: Raised #define RAISED 2 /// Edge type: Chiseled #define CHISEL 3 /// Edge type: Flat #define FLAT 4 /// The directory separator character on Linux as a char #define DIR_CHAR '/' /// The directory separator character on Linux as a string #define DIR_STR "/" /// The standard end of line string for Linux #define EOL_SEQUENCE "\n" /// Tests a char for being a slash #define IsSlash(c) (((c)=='/')||((c)=='\\')) /// Tests a char for being a quote #define IsQuote(c) (((c)=='\"')||((c)=='\'')) /// The path list separator character for Linux #define LGI_PATH_SEPARATOR ":" /// The pattern that matches all files in Linux #define LGI_ALL_FILES "*" /// The stardard extension for dynamically linked code #define LGI_LIBRARY_EXT "dylib" enum LDialogIds { /// Standard ID for an "Ok" button. /// \sa LgiMsg IDOK = 1, /// Standard ID for a "Cancel" button. /// \sa LgiMsg IDCANCEL, /// Standard ID for a "Yes" button. /// \sa LgiMsg IDYES, /// Standard ID for a "No" button. /// \sa LgiMsg IDNO, /// Standard message box with an Ok button. /// \sa LgiMsg MB_OK, /// Standard message box with Ok and Cancel buttons. /// \sa LgiMsg MB_OKCANCEL, /// Standard message box with Yes and No buttons. /// \sa LgiMsg MB_YESNO, /// Standard message box with Yes, No and Cancel buttons. /// \sa LgiMsg MB_YESNOCANCEL, }; #define MB_SYSTEMMODAL 0x1000 /// The CTRL key is pressed /// \sa GKey #define LGI_VKEY_CTRL 0x001 /// The ALT key is pressed /// \sa GKey #define LGI_VKEY_ALT 0x002 /// The SHIFT key is pressed /// \sa GKey #define LGI_VKEY_SHIFT 0x004 /// The left mouse button is pressed /// \sa GMouse #define LGI_VMOUSE_LEFT 0x008 /// The middle mouse button is pressed /// \sa GMouse #define LGI_VMOUSE_MIDDLE 0x010 /// The right mouse button is pressed /// \sa GMouse #define LGI_VMOUSE_RIGHT 0x020 /// The ctrl key is pressed /// \sa GMouse #define LGI_VMOUSE_CTRL 0x040 /// The alt key is pressed /// \sa GMouse #define LGI_VMOUSE_ALT 0x080 /// The shift key is pressed /// \sa GMouse #define LGI_VMOUSE_SHIFT 0x100 /// The mouse event is a down click /// \sa GMouse #define LGI_VMOUSE_DOWN 0x200 /// The mouse event is a double click /// \sa GMouse #define LGI_VMOUSE_DOUBLE 0x400 #ifdef __OBJC__ #define _KEY(sym,val) sym #else #define _KEY(sym,val) val #endif // Keys enum LVirtualKeys { LK_TAB = '\t', LK_RETURN = '\r', LK_ESCAPE = 27, LK_SPACE = ' ', LK_BACKSPACE = 0x7F, LK_PAGEUP = _KEY(NSPageUpFunctionKey, 0xF72C), LK_PAGEDOWN = _KEY(NSPageDownFunctionKey, 0xF72D), LK_DELETE = _KEY(NSDeleteFunctionKey, 0xF728), LK_HOME = _KEY(NSHomeFunctionKey, 0xF729), LK_END = _KEY(NSEndFunctionKey, 0xF72B), LK_UP = _KEY(NSUpArrowFunctionKey, 0xF700), LK_DOWN = _KEY(NSDownArrowFunctionKey, 0xF701), LK_LEFT = _KEY(NSLeftArrowFunctionKey, 0xF702), LK_RIGHT = _KEY(NSRightArrowFunctionKey, 0xF703), LK_F1 = _KEY(NSF1FunctionKey, 0xF704), LK_F2 = _KEY(NSF2FunctionKey, 0xF705), LK_F3 = _KEY(NSF3FunctionKey, 0xF706), LK_F4 = _KEY(NSF4FunctionKey, 0xF707), LK_F5 = _KEY(NSF5FunctionKey, 0xF708), LK_F6 = _KEY(NSF6FunctionKey, 0xF709), LK_F7 = _KEY(NSF7FunctionKey, 0xF70A), LK_F8 = _KEY(NSF8FunctionKey, 0xF70B), LK_F9 = _KEY(NSF9FunctionKey, 0xF70C), LK_F10 = _KEY(NSF10FunctionKey, 0xF70D), LK_F11 = _KEY(NSF11FunctionKey, 0xF70E), LK_F12 = _KEY(NSF12FunctionKey, 0xF70F), LK_INSERT = 0xF748, LK_APPS, LK_ENTER, LK_SHIFT, }; #undef _KEY ///////////////////////////////////////////////////////////////////////////////////// // Externs LgiFunc GView *GWindowFromHandle(OsView hWnd); LgiFunc int GetMouseWheelLines(); LgiFunc int WinPointToHeight(int Pt); LgiFunc int WinHeightToPoint(int Ht); LgiFunc int stricmp(const char *a, const char *b); LgiFunc char *strlwr(char *a); LgiFunc char *strupr(char *a); LgiFunc char *p2c(unsigned char *s); /// Convert a string d'n'd format to an OS dependant integer. LgiFunc int FormatToInt(char *s); /// Convert a Os dependant integer d'n'd format to a string. LgiFunc char *FormatToStr(int f); #endif diff --git a/src/common/Lgi/GTrayIcon.cpp b/src/common/Lgi/GTrayIcon.cpp --- a/src/common/Lgi/GTrayIcon.cpp +++ b/src/common/Lgi/GTrayIcon.cpp @@ -1,615 +1,613 @@ #include "Lgi.h" #define SYSTEM_TRAY_REQUEST_DOCK 0 #define SYSTEM_TRAY_BEGIN_MESSAGE 1 #define SYSTEM_TRAY_CANCEL_MESSAGE 2 #if LGI_COCOA #import @interface LStatusItem : NSObject { } @property GWindow *parent; - (id)init:(GWindow*)p; - (void)onClick; @end #elif defined __GTK_H__ namespace Gtk { #include #include } using namespace Gtk; class GTrayIconPrivate; static void tray_icon_on_click(GtkStatusIcon *status_icon, GTrayIconPrivate *d); static void tray_icon_on_menu(GtkStatusIcon *status_icon, guint button, guint activate_time, GTrayIconPrivate *d); #endif //////////////////////////////////////////////////////////////////////////// class GTrayIconPrivate { public: GWindow *Parent; // parent window int64 Val; // which icon is currently visible bool Visible; #if WINNATIVE int TrayCreateMsg; int MyId; NOTIFYICONDATAW TrayIcon; typedef HICON IconRef; ::GArray Icon; #elif LGI_COCOA typedef GSurface *IconRef; NSStatusItem *StatusItem; GArray Icon; LStatusItem *Handler; #elif defined(__GTK_H__) ::GArray Images; GlibWrapper tray_icon; typedef GdkPixbuf *IconRef; ::GArray Icon; uint64 LastClickTime; gint DoubleClickTime; void OnClick() { if (!tray_icon) return; uint64 Now = LgiCurrentTime(); GdkScreen *s = gtk_status_icon_get_screen(tray_icon); GdkDisplay *dsp = gdk_screen_get_display(s); gint x, y; GdkModifierType mask; gdk_display_get_pointer(dsp, &s, &x, &y, &mask); GMouse m; m.x = x; m.y = y; m.SetModifer(mask); m.Left(true); m.Down(true); m.Double(Now - LastClickTime < DoubleClickTime); Parent->OnTrayClick(m); LastClickTime = Now; } void OnMenu(guint button, guint activate_time) { GMouse m; m.Left(button == 1); m.Middle(button == 2); m.Right(button == 3); m.Down(true); Parent->OnTrayClick(m); } #else typedef GSurface *IconRef; ::GArray Icon; #endif GTrayIconPrivate(GWindow *p) { Parent = p; Val = 0; Visible = false; #if WINNATIVE ZeroObj(TrayIcon); MyId = 0; TrayCreateMsg = RegisterWindowMessage(TEXT("TaskbarCreated")); #elif LGI_COCOA Handler = NULL; StatusItem = [[NSStatusBar systemStatusBar] statusItemWithLength:24]; if (StatusItem) { StatusItem.visible = false; Handler = [[LStatusItem alloc] init:p]; if (Handler) { StatusItem.target = Handler; StatusItem.action = @selector(onClick); } } #elif defined(__GTK_H__) GtkSettings *settings = gtk_settings_get_default(); DoubleClickTime = 500; if (settings) g_object_get(G_OBJECT(settings), "gtk-double-click-time", &DoubleClickTime, NULL); LastClickTime = 0; tray_icon = Gtk::gtk_status_icon_new(); if (tray_icon) { tray_icon.Connect("activate", G_CALLBACK(tray_icon_on_click), this); tray_icon.Connect("popup-menu", G_CALLBACK(tray_icon_on_menu), this); } #endif } ~GTrayIconPrivate() { #if WINNATIVE for (int n=0; nOnClick(); } void tray_icon_on_menu(GtkStatusIcon *status_icon, guint button, guint activate_time, GTrayIconPrivate *d) { d->OnMenu(button, activate_time); } #elif LGI_COCOA @implementation LStatusItem - (id)init:(GWindow*)p { if ((self = [super init]) != nil) { self.parent = p; } return self; } - (void)onClick { GMouse m; m.Left(true); m.Down(true); self.parent->OnTrayClick(m); } @end #endif //////////////////////////////////////////////////////////////////////////// GTrayIcon::GTrayIcon(GWindow *p) { d = new GTrayIconPrivate(p); } GTrayIcon::~GTrayIcon() { Visible(false); DeleteObj(d); } bool GTrayIcon::Load(const TCHAR *Str) { #if WINNATIVE HICON i = ::LoadIcon(LgiProcessInst(), Str); if (i) { d->Icon.Add(i); return true; } else LgiAssert(0); #elif LGI_COCOA GString File = LFindFile(Str); if (!File) return false; NSString *nf = File.NsStr(); NSImage *img = [[NSImage alloc] initWithContentsOfFile:nf]; if (img) d->Icon.Add(img); - [nf release]; + // [nf release]; return img != NULL; #elif defined(__GTK_H__) if (!Str) return false; ::GString sStr = Str; GAutoString File(LgiFindFile(sStr)); if (!File) { LgiTrace("%s:%i - Can't find '%s'\n", _FL, sStr.Get()); return false; } GAutoPtr Ico(GdcD->Load(File)); if (!Ico) { LgiTrace("%s:%i - Failed to load '%s'\n", _FL, sStr.Get()); return false; } Gtk::GdkPixbuf *Pb = Ico->CreatePixBuf(); if (!Pb) { LgiTrace("%s:%i - Failed to CreatePixBuf '%s'\n", _FL, sStr.Get()); return false; } d->Icon.Add(Pb); d->Images.Add(Ico.Release()); #else GAutoString File(LgiFindFile(Str)); if (File) { GSurface *i = GdcD->Load(File); if (i) { if (GdcD->GetBits() != i->GetBits()) { GSurface *n = new GMemDC(i->X(), i->Y(), GdcD->GetColourSpace()); if (n) { n->Colour(0); n->Rectangle(); n->Blt(0, 0, i); DeleteObj(i); i = n; } } d->Icon.Add(i); } else LgiTrace("%s:%i - Couldn't load '%s'\n", _FL, Str); return i != 0; } else LgiTrace("%s:%i - Couldn't find '%s'\n", _FL, Str); #endif return false; } bool GTrayIcon::Visible() { #if WINNATIVE return d->TrayIcon.cbSize != 0; #elif LGI_COCOA if (d->StatusItem) d->Visible = [d->StatusItem isVisible]; return d->Visible; #else return d->Visible; #endif } void GTrayIcon::Visible(bool v) { if (Visible() != v) { if (v) { #if WINNATIVE static int Id = 1; HICON Cur = d->Icon[d->Val]; ZeroObj(d->TrayIcon); d->TrayIcon.cbSize = sizeof(d->TrayIcon); d->TrayIcon.hWnd = d->Parent ? d->Parent->Handle() : 0; d->TrayIcon.uID = d->MyId = Id++; d->TrayIcon.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP; d->TrayIcon.uCallbackMessage = M_TRAY_NOTIFY; d->TrayIcon.hIcon = Cur; StrncpyW(d->TrayIcon.szTip, (char16*)(NameW()?NameW():L""), CountOf(d->TrayIcon.szTip)); if (!Shell_NotifyIconW(NIM_ADD, &d->TrayIcon)) { int asd=0; } #elif defined(__GTK_H__) if (d->tray_icon) { if (d->Val < 0 || d->Val >= d->Icon.Length()) d->Val = 0; if (d->Val < d->Icon.Length()) { GTrayIconPrivate::IconRef Ref = d->Icon[d->Val]; if (Ref) { Gtk::gtk_status_icon_set_from_pixbuf(d->tray_icon, Ref); Gtk::gtk_status_icon_set_tooltip_text(d->tray_icon, GBase::Name()); Gtk::gtk_status_icon_set_visible(d->tray_icon, true); } } else LgiTrace("%s:%i - No icon to show in tray.\n", _FL); } else LgiTrace("%s:%i - No tray icon to hide.\n", _FL); #elif LGI_COCOA if (d->StatusItem) d->StatusItem.visible = true; #elif defined MAC if (!d->Visible) { int64 Ico = d->Val; d->Val = -1; Value(Ico); } #endif } else { #if WINNATIVE if (!Shell_NotifyIconW(NIM_DELETE, &d->TrayIcon)) { int asd=0; } ZeroObj(d->TrayIcon); #elif LGI_COCOA #elif LGI_CARBON RestoreApplicationDockTileImage(); #elif defined(__GTK_H__) if (d->tray_icon) gtk_status_icon_set_visible(d->tray_icon, false); else LgiTrace("%s:%i - No tray icon to hide.\n", _FL); #endif } } d->Visible = v; } int64 GTrayIcon::Value() { return d->Val; } void GTrayIcon::Value(int64 v) { if (d->Val != v) { d->Val = v; #if WINNATIVE if (Visible()) { HICON Cur = d->Icon[d->Val]; ZeroObj(d->TrayIcon); d->TrayIcon.cbSize = sizeof(d->TrayIcon); d->TrayIcon.hWnd = d->Parent ? d->Parent->Handle() : 0; d->TrayIcon.uID = d->MyId; d->TrayIcon.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP; d->TrayIcon.uCallbackMessage = M_TRAY_NOTIFY; d->TrayIcon.hIcon = Cur; StrncpyW(d->TrayIcon.szTip, (char16*)(NameW()?NameW():L""), sizeof(d->TrayIcon.szTip)); if (!Shell_NotifyIconW(NIM_MODIFY, &d->TrayIcon)) { int asd=0; } } #elif defined __GTK_H__ if (d->tray_icon) { if (d->Val < 0 || d->Val >= d->Icon.Length()) d->Val = 0; if (d->Val < d->Icon.Length()) { GTrayIconPrivate::IconRef Ref = d->Icon[d->Val]; if (Ref) Gtk::gtk_status_icon_set_from_pixbuf(d->tray_icon, Ref); } else LgiTrace("%s:%i - No icon to show in tray.\n", _FL); } else LgiTrace("%s:%i - No tray icon to hide.\n", _FL); #elif LGI_COCOA d->Val = limit(v, 0, d->Icon.Length()); if (d->StatusItem) { auto img = d->Icon[d->Val]; d->StatusItem.button.image = img; } Visible(true); #elif LGI_CARBON GSurface *t = d->Val >= 0 ? d->Icon[d->Val] : NULL; if (t) { CGContextRef c = BeginCGContextForApplicationDockTile(); if (c) { // CGContextTranslateCTM(c, 0, 128); // CGContextScaleCTM(c, 1.0, -1.0); GScreenDC Dc((GView*)0, c); GMemDC m; if (m.Create(t->X()*4, t->Y()*4, System32BitColourSpace)) { double Sx = (double) t->X() / m.X(); double Sy = (double) t->Y() / m.Y(); for (int y=0; yMsg() == M_TRAY_NOTIFY && Message->A() == d->MyId) { // got a notification from the icon GMouse m; ZeroObj(m); switch (Message->B()) { case WM_LBUTTONDBLCLK: case WM_RBUTTONDBLCLK: case WM_MBUTTONDBLCLK: { m.Down(true); m.Double(true); break; } case WM_LBUTTONDOWN: case WM_RBUTTONDOWN: case WM_MBUTTONDOWN: { m.Down(true); break; } } switch (Message->B()) { case WM_LBUTTONDBLCLK: case WM_LBUTTONDOWN: case WM_LBUTTONUP: { m.Left(true); break; } case WM_RBUTTONDBLCLK: case WM_RBUTTONDOWN: case WM_RBUTTONUP: { m.Right(true); break; } case WM_MBUTTONDBLCLK: case WM_MBUTTONDOWN: case WM_MBUTTONUP: { m.Middle(true); break; } } switch (Message->B()) { case WM_LBUTTONDBLCLK: case WM_RBUTTONDBLCLK: case WM_MBUTTONDBLCLK: { m.Double(true); break; } } if (d->Parent) { d->Parent->OnTrayClick(m); } } else if (Message->Msg() == d->TrayCreateMsg) { // explorer crashed... reinit the icon ZeroObj(d->TrayIcon); Visible(true); } #endif return 0; } diff --git a/src/common/Lgi/LgiMsg.cpp b/src/common/Lgi/LgiMsg.cpp --- a/src/common/Lgi/LgiMsg.cpp +++ b/src/common/Lgi/LgiMsg.cpp @@ -1,460 +1,460 @@ #include #include "Lgi.h" #include "GTextLog.h" #include "GTableLayout.h" #include "GButton.h" #if defined(__GTK_H__) #include "gtk/gtkdialog.h" void MsgCb(Gtk::GtkDialog *dialog, Gtk::gint response_id, Gtk::gpointer user_data) { *((int*)user_data) = response_id; } #endif #if defined(__GTK_H__) || defined(MAC) || defined(LGI_SDL) #include "GTextLabel.h" #include "GButton.h" #if LGI_COCOA #import #endif class GMsgDlg : public GDialog { public: GMsgDlg() { RegisterHook(this, GKeyEvents); } bool OnViewKey(GView *v, GKey &k) { if (k.Down()) { int Id = -1; switch (k.c16) { case 'y': case 'Y': { Id = IDYES; break; } case 'n': case 'N': { Id = IDNO; break; } case 'c': case 'C': { Id = IDCANCEL; break; } case 'o': case 'O': { Id = IDOK; break; } } if (Id >= 0) { GViewI *c = FindControl(Id); if (c) { EndModal(c->GetId()); } } } return GDialog::OnViewKey(v, k); } int OnNotify(GViewI *Ctrl, int f) { switch (Ctrl->GetId()) { case IDOK: case IDCANCEL: case IDYES: case IDNO: { EndModal(Ctrl->GetId()); break; } } return 0; } }; #endif int LgiMsg(GViewI *Parent, const char *Str, const char *Title, int Type, ...) { int Res = 0; va_list Arg; va_start(Arg, Type); GString Msg; Msg.Printf(Arg, Str); va_end(Arg); #if defined BEOS if (Str) { BAlert *Dlg = 0; switch (Type) { case MB_OK: { Dlg = new BAlert((Title) ? Title : "Message", Msg, "Ok"); break; } case MB_YESNO: { Dlg = new BAlert((Title) ? Title : "Message", Msg, "Yes", "No", NULL, B_WIDTH_AS_USUAL, B_IDEA_ALERT); break; } case MB_YESNOCANCEL: { Dlg = new BAlert((Title) ? Title : "Message", Msg, "Yes", "No", "Cancel", B_WIDTH_AS_USUAL, B_IDEA_ALERT); break; } default: { LgiAssert(0); break; } } if (Dlg) { Res = Dlg->Go(); } if (Res >= 0 && (Type == MB_YESNO || Type == MB_YESNOCANCEL)) { if (Res == 0) return IDYES; if (Res == 1) return IDNO; if (Res == 2) return IDCANCEL; } } #elif WINNATIVE if (Str) { if (LgiGetOs() == LGI_OS_WIN9X) { auto t = LToNativeCp(Title ? Title : (char*)"Message"); auto m = LToNativeCp(Msg); Res = MessageBoxA(Parent ? Parent->Handle() : 0, m?m:"", t?t:"", Type); if (Res == 0) { auto Err = GetLastError(); LgiAssert(!"MessageBoxA failed."); } } else { char16 *t = Utf8ToWide(Title ? Title : (char*)"Message"); char16 *m = Utf8ToWide(Msg); Res = MessageBoxW(Parent ? Parent->Handle() : 0, m?m:L"", t?t:L"", Type); if (Res == 0) { auto Err = GetLastError(); LgiAssert(!"MessageBoxW failed."); } DeleteArray(t); DeleteArray(m); } } #elif LGI_COCOA NSAlert *alert = [[NSAlert alloc] init]; auto msg = Msg.NsStr(); auto title = GString(Title).NsStr(); [alert setMessageText:msg]; [alert setInformativeText:title]; switch (Type & ~MB_SYSTEMMODAL) { default: case MB_OK: { [alert addButtonWithTitle:@"Ok"]; break; } case MB_OKCANCEL: { [alert addButtonWithTitle:@"Cancel"]; [alert addButtonWithTitle:@"Ok"]; break; } case MB_YESNO: { [alert addButtonWithTitle:@"No"]; [alert addButtonWithTitle:@"Yes"]; break; } case MB_YESNOCANCEL: { [alert addButtonWithTitle:@"Cancel"]; [alert addButtonWithTitle:@"No"]; [alert addButtonWithTitle:@"Yes"]; break; } } [alert runModal]; - [msg release]; - [title release]; + //[msg release]; + //[title release]; #elif defined(__GTK_H__) using namespace Gtk; GtkButtonsType GtkType; switch (Type & ~MB_SYSTEMMODAL) { default: case MB_OK: GtkType = GTK_BUTTONS_OK; break; case MB_OKCANCEL: GtkType = GTK_BUTTONS_OK_CANCEL; break; case MB_YESNO: case MB_YESNOCANCEL: // ugh, soz GtkType = GTK_BUTTONS_YES_NO; break; } GtkWidget *dlg = gtk_message_dialog_new( Parent ? Parent->WindowHandle() : NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_INFO, GtkType, "%s", Msg.Get()); if (dlg) { if (Type == MB_YESNOCANCEL) gtk_dialog_add_button(GTK_DIALOG(dlg), "Cancel", GTK_RESPONSE_CANCEL); int Response = 0; g_signal_connect(GTK_DIALOG(dlg), "response", G_CALLBACK(MsgCb), &Response); gtk_dialog_run(GTK_DIALOG(dlg)); gtk_widget_destroy(dlg); switch (Response) { case GTK_RESPONSE_NONE: case GTK_RESPONSE_REJECT: case GTK_RESPONSE_ACCEPT: case GTK_RESPONSE_DELETE_EVENT: case GTK_RESPONSE_CLOSE: case GTK_RESPONSE_APPLY: case GTK_RESPONSE_HELP: break; case GTK_RESPONSE_OK: Res = IDOK; break; case GTK_RESPONSE_CANCEL: Res = IDCANCEL; break; case GTK_RESPONSE_YES: Res = IDYES; break; case GTK_RESPONSE_NO: Res = IDNO; break; } } #else // Lgi only controls (used for Linux + Mac) if (Str && LgiApp) { GMsgDlg Dlg; Dlg.SetParent(Parent); Dlg.Name((char*)(Title ? Title : "Message")); GTextLabel *Text = new GTextLabel(-1, 10, 10, -1, -1, Msg); Dlg.AddView(Text); List Btns; #ifdef LGI_TOUCHSCREEN float Scale = 1.6f; #else float Scale = 1.0f; #endif int BtnY = (int) (Scale * 20.0f); int BtnX = (int) (Scale * 70.0f); switch (Type & ~MB_SYSTEMMODAL) { default: case MB_OK: { Btns.Insert(new GButton(IDOK, 10, 40, BtnX, BtnY, "Ok")); break; } case MB_OKCANCEL: { Btns.Insert(new GButton(IDOK, 10, 40, BtnX, BtnY, "Ok")); Btns.Insert(new GButton(IDCANCEL, 10, 40, BtnX, BtnY, "Cancel")); break; } case MB_YESNO: { Btns.Insert(new GButton(IDYES, 10, 40, BtnX, BtnY, "Yes")); Btns.Insert(new GButton(IDNO, 10, 40, BtnX, BtnY, "No")); break; } case MB_YESNOCANCEL: { Btns.Insert(new GButton(IDYES, 10, 40, BtnX, BtnY, "Yes")); Btns.Insert(new GButton(IDNO, 10, 40, BtnX, BtnY, "No")); Btns.Insert(new GButton(IDCANCEL, 10, 40, BtnX, BtnY, "Cancel")); break; } } int BtnsX = (int) ((Btns.Length() * BtnX) + ((Btns.Length()-1) * 10)); int MaxX = MAX(BtnsX, Text->X()); GRect p(0, 0, MaxX + 30, Text->Y() + 30 + BtnY + LgiApp->GetMetric(LGI_MET_DECOR_Y) ); Dlg.SetPos(p); Dlg.MoveToCenter(); int x = (p.X() - BtnsX) / 2; int y = Text->Y() + 20; for (auto b: Btns) { GRect r(x, y, x+BtnX-1, y+BtnY-1); b->SetPos(r); Dlg.AddView(b); x += r.X() + 10; } return Dlg.DoModal(); } #endif #if 0 // defined MAC (doesn't work reliably) if (Str) { SInt16 r; Str255 t; Str255 s; Str63 sYes = {3, 'Y', 'e', 's'}, sNo = {2, 'N', 'o'}; AlertStdAlertParamRec p; c2p255(t, Title); c2p255(s, Buffer); p.movable = true; p.helpButton = false; p.filterProc = 0; p.defaultText = (ConstStringPtr)kAlertDefaultOtherText; p.cancelText = 0; p.otherText = 0; p.position = kWindowDefaultPosition; switch (Type) { default: printf("%s:%i - unhandled LgiMsg type %i\n", __FILE__, __LINE__, Type); case MB_OK: p.defaultButton = kAlertStdAlertOKButton; p.cancelButton = kAlertStdAlertOtherButton; break; case MB_OKCANCEL: p.defaultButton = kAlertStdAlertOKButton; p.cancelButton = kAlertStdAlertCancelButton; p.cancelText = (ConstStringPtr)kAlertDefaultCancelText; break; case MB_YESNO: p.defaultButton = kAlertStdAlertOKButton; p.cancelButton = kAlertStdAlertOtherButton; /* p.defaultButton = kAlertStdAlertOKButton; p.cancelButton = kAlertStdAlertCancelButton; p.defaultText = sYes; p.cancelText = sNo; */ break; case MB_YESNOCANCEL: p.defaultButton = kAlertStdAlertOKButton; p.defaultText = sYes; p.cancelButton = kAlertStdAlertCancelButton; p.cancelText = (ConstStringPtr)kAlertDefaultCancelText; p.otherText = sNo; break; } OSErr e = StandardAlert(kAlertPlainAlert, t, s, &p, &r); switch (Type) { default: case MB_OK: Res = IDOK; break; case MB_OKCANCEL: Res = (r == kAlertStdAlertOKButton) ? IDOK : IDCANCEL; break; case MB_YESNO: Res = (r == kAlertStdAlertOKButton) ? IDYES : IDNO; break; case MB_YESNOCANCEL: if (r == kAlertStdAlertOKButton) Res = IDYES; else if (r == kAlertStdAlertOtherButton) Res = IDNO; else Res = IDCANCEL; break; } } #endif return Res; } #if !LGI_STATIC void LDialogTextMsg(GViewI *Parent, const char *Title, GString Txt) { GAutoPtr d(new GDialog); if (d) { GTextLog *Log = NULL; d->SetParent(Parent); d->Name(Title); GRect r(0, 0, 600, 500); d->SetPos(r); d->MoveSameScreen(Parent); GTableLayout *t = new GTableLayout(100); auto c = t->GetCell(0, 0); c->Add(Log = new GTextLog(101)); Log->Name(Txt); c = t->GetCell(0, 1); c->Add(new GButton(IDOK, 0, 0, -1, -1, "Ok")); c->TextAlign(GCss::AlignCenter); d->AddView(t); d->DoModal(); } } #endif diff --git a/src/mac/cocoa/General/GFile.mm b/src/mac/cocoa/General/GFile.mm --- a/src/mac/cocoa/General/GFile.mm +++ b/src/mac/cocoa/General/GFile.mm @@ -1,1800 +1,1801 @@ /*hdr ** FILE: File.cpp ** AUTHOR: Matthew Allen ** DATE: 8/10/2000 ** DESCRIPTION: The new file subsystem ** ** Copyright (C) 2000, Matthew Allen ** fret@memecode.com */ /****************************** Includes **********************************/ #include #include #include #include #include #include #include #include "GFile.h" #include "GContainers.h" #include "GToken.h" #include "Gdc2.h" #include "LgiCommon.h" #include "GString.h" #if LGI_COCOA #include #endif /****************************** Defines ***********************************/ #define stat64 stat #define lseek64 lseek #define ftrucate64 ftruncate #define O_LARGEFILE 0 /****************************** Globals ***********************************/ struct ErrorCodeType { const char *Name; int Code; const char *Desc; } ErrorCodes[] = { #if defined(WIN32) {"EPERM", 1, "Not owner"}, {"ENOENT", 2, "No such file"}, {"ESRCH", 3, "No such process"}, {"EINTR", 4, "Interrupted system"}, {"EIO", 5, "I/O error"}, {"ENXIO", 6, "No such device"}, {"E2BIG", 7, "Argument list too long"}, {"ENOEXEC", 8, "Exec format error"}, {"EBADF", 9, "Bad file number"}, {"ECHILD", 10, "No children"}, {"EAGAIN", 11, "No more processes"}, {"ENOMEM", 12, "Not enough core"}, {"EACCES", 13, "Permission denied"}, {"EFAULT", 14, "Bad address"}, {"ENOTBLK", 15, "Block device required"}, {"EBUSY", 16, "Mount device busy"}, {"EEXIST", 17, "File exists"}, {"EXDEV", 18, "Cross-device link"}, {"ENODEV", 19, "No such device"}, {"ENOTDIR", 20, "Not a directory"}, {"EISDIR", 21, "Is a directory"}, {"EINVAL", 22, "Invalid argument"}, {"ENFILE", 23, "File table overflow"}, {"EMFILE", 24, "Too many open file"}, {"ENOTTY", 25, "Not a typewriter"}, {"ETXTBSY", 26, "Text file busy"}, {"EFBIG", 27, "File too large"}, {"ENOSPC", 28, "No space left on"}, {"ESPIPE", 29, "Illegal seek"}, {"EROFS", 30, "Read-only file system"}, {"EMLINK", 31, "Too many links"}, {"EPIPE", 32, "Broken pipe"}, {"EWOULDBLOCK", 35, "Operation would block"}, {"EINPROGRESS", 36, "Operation now in progress"}, {"EALREADY", 37, "Operation already in progress"}, {"ENOTSOCK", 38, "Socket operation on"}, {"EDESTADDRREQ", 39, "Destination address required"}, {"EMSGSIZE", 40, "Message too long"}, {"EPROTOTYPE", 41, "Protocol wrong type"}, {"ENOPROTOOPT", 42, "Protocol not available"}, {"EPROTONOSUPPORT", 43, "Protocol not supported"}, {"ESOCKTNOSUPPORT", 44, "Socket type not supported"}, {"EOPNOTSUPP", 45, "Operation not supported"}, {"EPFNOSUPPORT", 46, "Protocol family not supported"}, {"EAFNOSUPPORT", 47, "Address family not supported"}, {"EADDRINUSE", 48, "Address already in use"}, {"EADDRNOTAVAIL", 49, "Can't assign requested address"}, {"ENETDOWN", 50, "Network is down"}, {"ENETUNREACH", 51, "Network is unreachable"}, {"ENETRESET", 52, "Network dropped connection"}, {"ECONNABORTED", 53, "Software caused connection"}, {"ECONNRESET", 54, "Connection reset by peer"}, {"ENOBUFS", 55, "No buffer space available"}, {"EISCONN", 56, "Socket is already connected"}, {"ENOTCONN", 57, "Socket is not connected" }, {"ESHUTDOWN", 58, "Can't send after shutdown"}, {"ETOOMANYREFS", 59, "Too many references"}, {"ETIMEDOUT", 60, "Connection timed out"}, {"ECONNREFUSED", 61, "Connection refused"}, {"ELOOP", 62, "Too many levels of nesting"}, {"ENAMETOOLONG", 63, "File name too long" }, {"EHOSTDOWN", 64, "Host is down"}, {"EHOSTUNREACH", 65, "No route to host"}, {"ENOTEMPTY", 66, "Directory not empty"}, {"EPROCLIM", 67, "Too many processes"}, {"EUSERS", 68, "Too many users"}, {"EDQUOT", 69, "Disc quota exceeded"}, {"ESTALE", 70, "Stale NFS file handle"}, {"EREMOTE", 71, "Too many levels of remote in the path"}, {"ENOSTR", 72, "Device is not a stream"}, {"ETIME", 73, "Timer expired"}, {"ENOSR", 74, "Out of streams resources"}, {"ENOMSG", 75, "No message"}, {"EBADMSG", 76, "Trying to read unreadable message"}, {"EIDRM", 77, "Identifier removed"}, {"EDEADLK", 78, "Deadlock condition"}, {"ENOLCK", 79, "No record locks available"}, {"ENONET", 80, "Machine is not on network"}, {"ERREMOTE", 81, "Object is remote"}, {"ENOLINK", 82, "The link has been severed"}, {"EADV", 83, "ADVERTISE error"}, {"ESRMNT", 84, "SRMOUNT error"}, {"ECOMM", 85, "Communication error"}, {"EPROTO", 86, "Protocol error"}, {"EMULTIHOP", 87, "Multihop attempted"}, {"EDOTDOT", 88, "Cross mount point"}, {"EREMCHG", 89, "Remote address change"}, #elif defined(MAC) {"EPERM", EPERM, "Operation not permitted"}, {"ENOENT", ENOENT, "No such file or directory"}, {"ESRCH", ESRCH, "No such process"}, {"EINTR", EINTR, "Interrupted system call"}, {"EIO", EIO, "I/O error"}, {"ENXIO", ENXIO, "No such device or address"}, {"E2BIG", E2BIG, "Argument list too long"}, {"ENOEXEC", ENOEXEC, "Exec format error"}, {"EBADF", EBADF, "Bad file number"}, {"ECHILD", ECHILD, "No child processes"}, {"EAGAIN", EAGAIN, "Try again"}, {"ENOMEM", ENOMEM, "Out of memory"}, {"EACCES", EACCES, "Permission denied"}, {"EFAULT", EFAULT, "Bad address"}, {"ENOTBLK", ENOTBLK, "Block device required"}, {"EBUSY", EBUSY, "Device or resource busy"}, {"EEXIST", EEXIST, "File exists"}, {"EXDEV", EXDEV, "Cross-device link"}, {"ENODEV", ENODEV, "No such device"}, {"ENOTDIR", ENOTDIR, "Not a directory"}, {"EISDIR", EISDIR, "Is a directory"}, {"EINVAL", EINVAL, "Invalid argument"}, {"ENFILE", ENFILE, "File table overflow"}, {"EMFILE", EMFILE, "Too many open files"}, {"ENOTTY", ENOTTY, "Not a typewriter"}, {"ETXTBSY", ETXTBSY, "Text file busy"}, {"EFBIG", EFBIG, "File too large"}, {"ENOSPC", ENOSPC, "No space left on device"}, {"ESPIPE", ESPIPE, "Illegal seek"}, {"EROFS", EROFS, "Read-only file system"}, {"EMLINK", EMLINK, "Too many links"}, {"EPIPE", EPIPE, "Broken pipe"}, {"EDOM", EDOM, "Math argument out of domain of func"}, {"ERANGE", ERANGE, "Math result not representable"}, {"EDEADLK", EDEADLK, "Resource deadlock would occur"}, {"ENAMETOOLONG", ENAMETOOLONG, "File name too long"}, {"ENOLCK", ENOLCK, "No record locks available"}, {"ENOSYS", ENOSYS, "Function not implemented"}, {"ENOTEMPTY", ENOTEMPTY, "Directory not empty"}, {"ELOOP", ELOOP, "Too many symbolic links encountered"}, {"EWOULDBLOCK", EWOULDBLOCK, "Operation would block"}, {"ENOMSG", ENOMSG, "No message of desired type"}, {"EIDRM", EIDRM, "Identifier removed"}, {"EREMOTE", EREMOTE, "Object is remote"}, {"EOVERFLOW", EOVERFLOW, "Value too large for defined data type"}, {"EILSEQ", EILSEQ, "Illegal byte sequence"}, {"EUSERS", EUSERS, "Too many users"}, {"ENOTSOCK", ENOTSOCK, "Socket operation on non-socket"}, {"EDESTADDRREQ", EDESTADDRREQ, "Destination address required"}, {"EMSGSIZE", EMSGSIZE, "Message too long"}, {"EPROTOTYPE", EPROTOTYPE, "Protocol wrong type for socket"}, {"ENOPROTOOPT", ENOPROTOOPT, "Protocol not available"}, {"EPROTONOSUPPORT", EPROTONOSUPPORT, "Protocol not supported"}, {"ESOCKTNOSUPPORT", ESOCKTNOSUPPORT, "Socket type not supported"}, {"EOPNOTSUPP", EOPNOTSUPP, "Operation not supported on transport endpoint"}, {"EPFNOSUPPORT", EPFNOSUPPORT, "Protocol family not supported"}, {"EAFNOSUPPORT", EAFNOSUPPORT, "Address family not supported by protocol"}, {"EADDRINUSE", EADDRINUSE, "Address already in use"}, {"EADDRNOTAVAIL", EADDRNOTAVAIL, "Cannot assign requested address"}, {"ENETDOWN", ENETDOWN, "Network is down"}, {"ENETUNREACH", ENETUNREACH, "Network is unreachable"}, {"ENETRESET", ENETRESET, "Network dropped connection because of reset"}, {"ECONNABORTED", ECONNABORTED, "Software caused connection abort"}, {"ECONNRESET", ECONNRESET, "Connection reset by peer"}, {"ENOBUFS", ENOBUFS, "No buffer space available"}, {"EISCONN", EISCONN, "Transport endpoint is already connected"}, {"ENOTCONN", ENOTCONN, "Transport endpoint is not connected"}, {"ESHUTDOWN", ESHUTDOWN, "Cannot send after transport endpoint shutdown"}, {"ETOOMANYREFS", ETOOMANYREFS, "Too many references: cannot splice"}, {"ETIMEDOUT", ETIMEDOUT, "Connection timed out"}, {"ECONNREFUSED", ECONNREFUSED, "Connection refused"}, {"EHOSTDOWN", EHOSTDOWN, "Host is down"}, {"EHOSTUNREACH", EHOSTUNREACH, "No route to host"}, {"EALREADY", EALREADY, "Operation already in progress"}, {"EINPROGRESS", EINPROGRESS, "Operation now in progress"}, {"ESTALE", ESTALE, "Stale NFS file handle"}, {"EDQUOT", EDQUOT, "Quota exceeded"}, #else #error impl me #endif {"NONE", 0, "No error"}, }; const char *GetErrorName(int e) { for (ErrorCodeType *c=ErrorCodes; c->Code; c++) { if (e == c->Code) { return c->Name; } } static char s[32]; sprintf(s, "Unknown(%i)", e); return s; } const char *GetErrorDesc(int e) { for (ErrorCodeType *c=ErrorCodes; c->Code; c++) { if (e == c->Code) { return c->Desc; } } return 0; } /****************************** Helper Functions **************************/ char *ReadTextFile(const char *File) { char *s = 0; GFile f; if (File && f.Open(File, O_READ)) { int64 Len = f.GetSize(); s = new char[Len+1]; if (s) { ssize_t Read = f.Read(s, (int)Len); s[Read] = 0; } } return s; } int64 LgiFileSize(const char *FileName) { struct stat64 s; if (FileName && stat64(FileName, &s) == 0) { return s.st_size; } return 0; } bool DirExists(const char *FileName, char *CorrectCase) { bool Status = false; if (FileName) { struct stat s; // Check for exact match... if (stat(FileName, &s) == 0) { Status = S_ISDIR(s.st_mode); } } return Status; } bool FileExists(const char *FileName, char *CorrectCase) { bool Status = false; if (FileName) { struct stat s; // Check for exact match... if (stat(FileName, &s) == 0) { Status = true; } else if (strlen(FileName) < MAX_PATH) { // Look for altenate case by enumerating the directory char d[MAX_PATH]; strcpy_s(d, sizeof(d), FileName); char *e = strrchr(d, DIR_CHAR); if (e) { *e++ = 0; DIR *Dir = opendir(d); if (Dir) { dirent *De; while ((De = readdir(Dir))) { if (stricmp(De->d_name, e) == 0) { try { // Tell the calling program the actual case of the file... e = (char*)strrchr(FileName, DIR_CHAR); // If this crashes because the argument is read only then we get caught by the try catch strcpy(e+1, De->d_name); // It worked! Status = true; } catch (...) { // It didn't work :( #ifdef _DEBUG printf("%s,%i - FileExists(%s) found an alternate case version but couldn't return it to the caller.\n", __FILE__, __LINE__, FileName); #endif } break; } } closedir(Dir); } } } } return Status; } bool ResolveShortcut(const char *LinkFile, char *Path, ssize_t Len) { return readlink (LinkFile, Path, Len) > 0; } void WriteStr(GFile &f, const char *s) { size_t Len = (s) ? strlen(s) : 0; f << Len; if (Len > 0) { f.Write(s, (int)Len); } } char *ReadStr(GFile &f DeclDebugArgs) { char *s = 0; // read the strings length... uint32 Len; f >> Len; if (Len > 0) { // 16mb sanity check.... anything over this // is _probably_ an error if (Len >= (16 << 20)) { // LgiAssert(0); return 0; } // allocate the memory buffer #if defined(_DEBUG) && defined MEMORY_DEBUG s = new(_file, _line) char[Len+1]; #else s = new char[Len+1]; #endif if (s) { // read the bytes from disk f.Read(s, Len); s[Len] = 0; } else { // memory allocation error, skip the data // on disk so the caller is where they think // they are in the file. f.Seek(Len, SEEK_CUR); } } return s; } ssize_t SizeofStr(const char *s) { return sizeof(uint32) + ((s) ? strlen(s) : 0); } bool LgiGetDriveInfo ( char *Path, uint64 *Free, uint64 *Size, uint64 *Available ) { bool Status = false; if (Path) { struct stat s; if (lstat(Path, &s) == 0) { // printf("LgiGetDriveInfo dev=%i\n", s.st_dev); } } return Status; } /****************************** Classes *************************************************************************************/ GVolume::GVolume() { _Type = VT_NONE; _Flags = 0; _Size = 0; _Free = 0; } ///////////////////////////////////////////////////////////////////////// #include #include class GMacVolume : public GVolume { int Which; List _Sub; List::I _It; public: GMacVolume(int w) : _It(_Sub.end()) { Which = w; _Type = VT_NONE; _Flags = 0; _Size = 0; _Free = 0; if (Which < 0) { _Name = "Desktop"; _Type = VT_DESKTOP; _Path = LGetSystemPath(LSP_DESKTOP); } } ~GMacVolume() { _Sub.DeleteObjects(); } bool IsMounted() { return false; } bool SetMounted(bool Mount) { return Mount; } void Insert(GAutoPtr v) { _Sub.Insert(v.Release()); } GVolume *First() { if (Which < 0 && !_Sub.Length()) { // Get various shortcuts to points of interest GMacVolume *v = new GMacVolume(0); if (v) { v->_Path = "/"; v->_Name = "Root"; v->_Type = VT_HARDDISK; _Sub.Insert(v); } struct passwd *pw = getpwuid(getuid()); if (pw) { v = new GMacVolume(0); if (v) { v->_Path = pw->pw_dir; v->_Name = "Home"; v->_Type = VT_HARDDISK; _Sub.Insert(v); } } /* // Get mount list // this is just a hack at this stage to establish some base // functionality. I would appreciate someone telling me how // to do this properly. Till then... GFile f; if (f.Open("/etc/fstab", O_READ)) { int Len = f.GetSize(); char *Buf = new char[Len+1]; if (Buf) { f.Read(Buf, Len); Buf[Len] = 0; f.Close(); GToken L(Buf, "\r\n"); for (int l=0; l 2) { char *Mount = M[1]; if (Mount AND strnicmp(M[0], "/dev/", 5) == 0 AND strlen(M[1]) > 1 AND stricmp(M[2], "swap") != 0) { v = new GMacVolume(0); if (v) { char *MountName = strrchr(Mount, '/'); v->_Name = NewStr(MountName ? MountName + 1 : Mount); v->_Path = NewStr(Mount); v->_Type = VT_HARDDISK; char *Device = M[0]; char *FileSys = M[2]; if (stristr(Device, "fd")) { v->_Type = VT_3_5FLOPPY; } else if (stristr(Device, "cdrom")) { v->_Type = VT_CDROM; } _Sub.Insert(v); } } } } } } */ } _It = _Sub.begin(); return *_It; } GVolume *Next() { return *(++_It); } GDirectory *GetContents() { GDirectory *Dir = 0; if (Which >= 0 && _Path) { Dir = new GDirectory; if (Dir) { if (!Dir->First(_Path)) { DeleteObj(Dir); } } } return Dir; } }; /////////////////////////////////////////////////////////////////////////////// GFileSystem *GFileSystem::Instance = 0; GFileSystem::GFileSystem() { Instance = this; Root = 0; } GFileSystem::~GFileSystem() { DeleteObj(Root); } void GFileSystem::OnDeviceChange(char *Reserved) { } GVolume *GFileSystem::GetRootVolume() { if (!Root) { Root = new GMacVolume(-1); } return Root; } int FloppyType(int Letter) { return 0; } #if 0 OSType gFinderSignature = 'MACS'; OSStatus MoveFileToTrash(CFURLRef fileURL) { AppleEvent event, reply; OSStatus err; FSRef fileRef; AliasHandle fileAlias; if (CFURLGetFSRef(fileURL, &fileRef) == false) return coreFoundationUnknownErr; err = FSNewAliasMinimal(&fileRef, &fileAlias); if (err == noErr) { err = AEBuildAppleEvent(kAECoreSuite, kAEDelete, typeApplSignature, &gFinderSignature, sizeof(OSType), kAutoGenerateReturnID, kAnyTransactionID, &event, NULL, "'----':alis(@@)", fileAlias); if (err == noErr) { err = AESendMessage(&event, &reply, kAEWaitReply, kAEDefaultTimeout); if (err == noErr) AEDisposeDesc(&reply); AEDisposeDesc(&event); } DisposeHandle((Handle)fileAlias); } return err; } #endif bool GFileSystem::Copy(const char *From, const char *To, LError *ErrorCode, CopyFileCallback Callback, void *Token) { if (!From || !To) { #if LGI_COCOA if (ErrorCode) *ErrorCode = NSFileReadInvalidFileNameError; #else if (ErrorCode) *ErrorCode = paramErr; #endif return false; } GFile In, Out; if (!In.Open(From, O_READ)) { if (ErrorCode) *ErrorCode = In.GetError(); return false; } if (!Out.Open(To, O_WRITE)) { if (ErrorCode) *ErrorCode = Out.GetError(); return false; } if (Out.SetSize(0)) { if (ErrorCode) *ErrorCode = #if LGI_COCOA NSFileWriteUnknownError; #else writErr; #endif return false; } int64 Size = In.GetSize(); if (!Size) { return true; } int64 Block = MIN((1 << 20), Size); char *Buf = new char[Block]; if (!Buf) { if (ErrorCode) *ErrorCode = #if LGI_COCOA NSFileWriteOutOfSpaceError; #else notEnoughBufferSpace; #endif return false; } int64 i = 0; while (i < Size) { ssize_t r = In.Read(Buf, Block); if (r > 0) { int Written = 0; while (Written < r) { ssize_t w = Out.Write(Buf + Written, r - Written); if (w > 0) { Written += w; } else { if (ErrorCode) *ErrorCode = #if LGI_COCOA NSFileWriteUnknownError; #else writErr; #endif goto ExitCopyLoop; } } i += Written; if (Callback) { if (!Callback(Token, i, Size)) { break; } } } else break; } ExitCopyLoop: DeleteArray(Buf); if (i == Size) { if (ErrorCode) *ErrorCode = noErr; } else { Out.Close(); Delete(To, false); } return i == Size; /* bool Status = false; if (From AND To) { GFile In, Out; if (In.Open(From, O_READ) AND Out.Open(To, O_WRITE)) { Out.SetSize(0); int64 Size = In.GetSize(); int64 Block = min((1 << 20), Size); char *Buf = new char[Block]; if (Buf) { int64 i = 0; while (i < Size) { int r = In.Read(Buf, Block); if (r > 0) { int Written = 0; while (Written < r) { int w = Out.Write(Buf + Written, r - Written); if (w > 0) { Written += w; } else goto ExitCopyLoop; } i += Written; if (Callback) { if (!Callback(Token, i, Size)) { break; } } } else break; } ExitCopyLoop: DeleteArray(Buf); Status = i == Size; if (!Status) { Delete(To, false); } } } } return Status; */ } bool GFileSystem::Delete(GArray &Files, GArray *Status, bool ToTrash) { bool Error = false; if (ToTrash) { #if defined MAC #if LGI_COCOA NSMutableArray *urls = [[NSMutableArray alloc] initWithCapacity:Files.Length()]; for (auto f : Files) { - id u = (NSURL *)CFURLCreateFromFileSystemRepresentation(NULL, (UInt8 *)f, strlen(f), 0); - [urls addObject:u]; - CFRelease(u); + CFURLRef u = CFURLCreateFromFileSystemRepresentation(NULL, (UInt8 *)f, strlen(f), 0); + NSURL *url = (__bridge NSURL *)u; + [urls addObject:url]; + // CFRelease(u); } [[NSWorkspace sharedWorkspace] recycleURLs:urls completionHandler:NULL]; #else // Apple events method for (int i=0; i f; f.Add(FileName); return Delete(f, 0, ToTrash); } return false; } bool GFileSystem::CreateFolder(const char *PathName, bool CreateParentFolders, LError *ErrorCode) { int r = mkdir(PathName, S_IRWXU | S_IXGRP | S_IXOTH); if (r) { if (ErrorCode) *ErrorCode = errno; if (CreateParentFolders) { char Base[MAX_PATH]; strcpy_s(Base, sizeof(Base), PathName); do { char *Leaf = strrchr(Base, DIR_CHAR); if (!Leaf) return false; *Leaf = 0; } while (!DirExists(Base)); GToken Parts(PathName + strlen(Base), DIR_STR); for (int i=0; id_name, ".") == 0 || strcmp(De->d_name, "..") == 0 || ( Pattern && !MatchStr(Pattern, De->d_name) ) ); } }; GDirectory::GDirectory() { d = new GDirectoryPriv; } GDirectory::~GDirectory() { Close(); DeleteObj(d); } GDirectory *GDirectory::Clone() { return new GDirectory; } int GDirectory::First(const char *Name, const char *Pattern) { Close(); if (Name) { strcpy_s(d->BasePath, sizeof(d->BasePath), Name); d->BaseEnd = d->BasePath + strlen(d->BasePath); if (!Pattern || stricmp(Pattern, LGI_ALL_FILES) == 0) { struct stat S; if (lstat(Name, &S) == 0) { if (S_ISREG(S.st_mode)) { char *Dir = strrchr(d->BasePath, DIR_CHAR); if (Dir) { *Dir++ = 0; d->Pattern = NewStr(Dir); } } } } else { d->Pattern = NewStr(Pattern); } d->Dir = opendir(d->BasePath); if (d->Dir) { d->De = readdir(d->Dir); if (d->De) { char s[512]; LgiMakePath(s, sizeof(s), d->BasePath, GetName()); lstat(s, &d->Stat); if (d->Ignore()) { if (!Next()) { return false; } } } } } return d->Dir != 0 && d->De != 0; } int GDirectory::Next() { int Status = false; while (d->Dir && d->De) { if ((d->De = readdir(d->Dir))) { char s[512]; LgiMakePath(s, sizeof(s), d->BasePath, GetName()); lstat(s, &d->Stat); if (!d->Ignore()) { Status = true; break; } } } return Status; } int GDirectory::Close() { if (d->Dir) { closedir(d->Dir); d->Dir = 0; } d->De = 0; return true; } bool GDirectory::Path(char *s, int BufLen) const { if (!s) { return false; } return LgiMakePath(s, BufLen, d->BasePath, GetName()); } int GDirectory::GetType() const { return IsDir() ? VT_FOLDER : VT_FILE; } int GDirectory::GetUser(bool Group) const { if (Group) { return d->Stat.st_gid; } else { return d->Stat.st_uid; } } bool GDirectory::IsReadOnly() const { if (getuid() == d->Stat.st_uid) { // Check user perms return !TestFlag(GetAttributes(), S_IWUSR); } else if (getgid() == d->Stat.st_gid) { // Check group perms return !TestFlag(GetAttributes(), S_IWGRP); } // Check global perms return !TestFlag(GetAttributes(), S_IWOTH); } bool GDirectory::IsSymLink() const { long a = GetAttributes(); return S_ISLNK(a); } bool GDirectory::IsHidden() const { return GetName() && GetName()[0] == '.'; } bool GDirectory::IsDir() const { long a = GetAttributes(); return !S_ISLNK(a) && S_ISDIR(a); } long GDirectory::GetAttributes() const { return d->Stat.st_mode; } char *GDirectory::GetName() const { return (d->De) ? d->De->d_name : 0; } uint64 GDirectory::GetCreationTime() const { return (uint64)d->Stat.st_ctime * 1000; } uint64 GDirectory::GetLastAccessTime() const { return (uint64)d->Stat.st_atime * 1000; } uint64 GDirectory::GetLastWriteTime() const { return (uint64)d->Stat.st_mtime * 1000; } uint64 GDirectory::GetSize() const { return d->Stat.st_size; } int64 GDirectory::GetSizeOnDisk() { return d->Stat.st_size; } const char *GDirectory::FullPath() { auto n = GetName(); if (!n) return NULL; strncpy(d->BaseEnd, n, sizeof(d->BasePath) - (d->BaseEnd - d->BasePath)); return d->BasePath; } GString GDirectory::FileName() const { return GetName(); } ///////////////////////////////////////////////////////////////////////////////// //////////////////////////// File /////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////// class GFilePrivate { public: int hFile; char *Name; bool Swap; int Status; int Attributes; int LastError; GFilePrivate() { hFile = INVALID_HANDLE; Name = 0; Swap = false; Status = true; Attributes = 0; #if LGI_COCOA LastError = 0; #else LastError = noErr; #endif } ~GFilePrivate() { DeleteArray(Name); } }; GFile::GFile(const char *path, int mode) { d = new GFilePrivate; if (path) Open(path, mode); } GFile::~GFile() { if (d && ValidHandle(d->hFile)) { Close(); } DeleteObj(d); } int GFile::GetError() { return d->LastError; } OsFile GFile::Handle() { return d->hFile; } bool GFile::IsOpen() { return ValidHandle(d->hFile); } void GFile::ChangeThread() { } // #define _FILE_OPEN #ifdef _FILE_OPEN GSemaphore _FileLock; GHashTable _FileOpen; LgiFunc void _DumpOpenFiles() { if (_FileLock.Lock(_FL)) { char *k; int i=0; for (void *p=_FileOpen.First(&k); p; p=_FileOpen.Next(&k)) { printf("File[%i]='%s'\n", i++, k); } _FileLock.Unlock(); } } #endif int GFile::Open(const char *File, int Mode) { if (!File) { #if LGI_COCOA d->LastError = NSFileReadInvalidFileNameError; #else d->LastError = paramErr; #endif return false; } if (TestFlag(Mode, O_WRITE) || TestFlag(Mode, O_READWRITE)) { Mode |= O_CREAT; } Close(); d->hFile = open(File, Mode | O_LARGEFILE, S_IRUSR | S_IWUSR); if (!ValidHandle(d->hFile)) { d->LastError = errno; printf("GFile::Open failed\n\topen(%s,%8.8x) = %i\n\terrno=%s (%s)\n", File, Mode, d->hFile, GetErrorName(errno), GetErrorDesc(errno)); return false; } #ifdef _FILE_OPEN if (_FileLock.Lock(_FL)) {5 _FileOpen.Add(File, this); _FileLock.Unlock(); } #endif d->Attributes = Mode; d->Name = new char[strlen(File)+1]; if (d->Name) { strcpy(d->Name, File); } d->Status = true; return true; } int GFile::Close() { if (ValidHandle(d->hFile)) { #ifdef _FILE_OPEN if (_FileLock.Lock(_FL)) { _FileOpen.Delete(d->Name); _FileLock.Unlock(); } #endif close(d->hFile); d->hFile = INVALID_HANDLE; DeleteArray(d->Name); } return true; } #define CHUNK 0xFFF0 ssize_t GFile::Read(void *Buffer, ssize_t Size, int Flags) { ssize_t Red = 0; if (Buffer && Size > 0) { Red = read(d->hFile, Buffer, Size); #ifdef _DEBUG if (Red < 0) { int Err = errno; int64 Pos = GetPos(); printf("Read error: %i, " LPrintfInt64 "\n", Err, Pos); } #endif } d->Status = Red == Size; return MAX(Red, 0); } ssize_t GFile::Write(const void *Buffer, ssize_t Size, int Flags) { ssize_t Written = 0; if (Buffer && Size > 0) { Written = write(d->hFile, Buffer, Size); #ifdef _DEBUG if (Written < 0) { int Err = errno; int64 Pos = GetPos(); printf("Write error: %i, " LPrintfInt64 "\n", Err, Pos); } #endif } d->Status = Written == Size; return MAX(Written, 0); } int64 GFile::Seek(int64 To, int Whence) { #if LINUX64 return lseek64(d->hFile, To, Whence); // If this doesn't compile, switch off LINUX64 #else return lseek(d->hFile, To, Whence); #endif } int64 GFile::SetPos(int64 Pos) { #if LINUX64 int64 p = lseek64(d->hFile, Pos, SEEK_SET); if (p < 0) { int e = errno; printf("%s:%i - lseek64(%Lx) failed (error %i: %s).\n", __FILE__, __LINE__, Pos, e, GetErrorName(e)); } #else return lseek(d->hFile, Pos, SEEK_SET); #endif } int64 GFile::GetPos() { #if LINUX64 int64 p = lseek64(d->hFile, 0, SEEK_CUR); if (p < 0) { int e = errno; printf("%s:%i - lseek64 failed (error %i: %s).\n", __FILE__, __LINE__, e, GetErrorName(e)); } return p; #else return lseek(d->hFile, 0, SEEK_CUR); #endif } int64 GFile::GetSize() { int64 Here = GetPos(); #if LINUX64 int64 Ret = lseek64(d->hFile, 0, SEEK_END); #else off_t Ret = lseek(d->hFile, 0, SEEK_END); #endif SetPos(Here); return Ret; } int64 GFile::SetSize(int64 Size) { if (ValidHandle(d->hFile)) { int64 Pos = GetPos(); /* close(d->hFile); if (d->Name) { #if LINUX64 truncate64(Name, Size); #else truncate(Name, Size); #endif } d->hFile = open(Name, Attributes, 0); */ #if LINUX64 ftruncate64(d->hFile, Size); #else ftruncate(d->hFile, Size); #endif if (d->hFile) { SetPos(Pos); } } return GetSize(); } bool GFile::Eof() { return GetPos() >= GetSize(); } ssize_t GFile::SwapRead(uchar *Buf, ssize_t Size) { ssize_t r = Read(Buf, Size); if (r == Size) { uint8 *s = Buf, *e = Buf + r - 1; for (; s < e; s++, e--) { uchar c = *s; *s = *e; *e = c; } } else return 0; return r; } ssize_t GFile::SwapWrite(uchar *Buf, ssize_t Size) { switch (Size) { case 1: { return Write(Buf, Size); break; } case 2: { uint16 i = *((uint16*)Buf); i = LgiSwap16(i); return Write(&i, Size); break; } case 4: { uint32 i = *((uint32*)Buf); i = LgiSwap32(i); return Write(&i, Size); break; } case 8: { uint64 i = *((uint64*)Buf); i = LgiSwap64(i); return Write(&i, Size); break; } default: { ssize_t i, n; for (i=0, n=Size-1; i 0) { char c; Size--; do { r = read(d->hFile, &c, 1); if (Eof()) { break; } *Buf++ = c; i++; } while (i < Size - 1 && c != '\n'); *Buf = 0; } return i; } ssize_t GFile::WriteStr(char *Buf, ssize_t Size) { ssize_t i = 0; ssize_t w; while (i <= Size) { w = write(d->hFile, Buf, 1); Buf++; i++; if (*Buf == '\n') break; } return i; } void GFile::SetStatus(bool s) { d->Status = s; } bool GFile::GetStatus() { return d->Status; } void GFile::SetSwap(bool s) { d->Swap = s; } bool GFile::GetSwap() { return d->Swap; } int GFile::GetOpenMode() { return d->Attributes; } const char *GFile::GetName() { return d->Name; } #define RdIO { d->Status |= ((d->Swap) ? SwapRead((uchar*) &i, sizeof(i)) : Read(&i, sizeof(i))) != sizeof(i); return *this; } #define WrIO { d->Status |= ((d->Swap) ? SwapWrite((uchar*) &i, sizeof(i)) : Write(&i, sizeof(i))) != sizeof(i); return *this; } #define GFilePre GFile &GFile::operator >> ( #define GFilePost &i) RdIO GFileOps(); #undef GFilePre #undef GFilePost #define GFilePre GFile &GFile::operator << ( #define GFilePost i) WrIO GFileOps(); #undef GFilePre #undef GFilePost diff --git a/src/mac/cocoa/Lgi/GApp.mm b/src/mac/cocoa/Lgi/GApp.mm --- a/src/mac/cocoa/Lgi/GApp.mm +++ b/src/mac/cocoa/Lgi/GApp.mm @@ -1,1038 +1,1038 @@ #include #include #include #include #include #include #import #include "Lgi.h" #include "GProcess.h" #include "GSkinEngine.h" #include "GArray.h" #include "GToken.h" #include "LThread.h" #include "GXmlTree.h" #include "GSymLookup.h" #include "GFontCache.h" #include #include #include #include #include #import "LCocoaView.h" #include "GEventTargetThread.h" extern int hndstate(int hnd); struct OsAppArgumentsPriv { GAutoString Str; GArray Ptr; }; OsAppArguments::OsAppArguments(int args, const char **arg) { d = new OsAppArgumentsPriv; Args = args; Arg = arg; } OsAppArguments::~OsAppArguments() { DeleteObj(d); } void OsAppArguments::Set(char *CmdLine) { d->Str.Reset(); d->Ptr.Length(0); GArray Raw; GArray Offsets; auto Exe = LGetExeFile(); Offsets.Add(0); if (Exe) { Raw.Length(Exe.Length() + 1); strcpy(Raw.AddressOf(), Exe); } else { Raw.Add(0); } if (CmdLine) { for (char *s = CmdLine; *s; ) { while (*s && strchr(WhiteSpace, *s)) s++; char *e; if (*s == '\'' || *s == '\"') { char delim = *s++; Offsets.Add(Raw.Length()); e = s; while (*e && *e != delim) { Raw.Add(*e++); } Raw.Add(0); } else { Offsets.Add(Raw.Length()); for (e = s; *e && !strchr(WhiteSpace, *e); e++) { Raw.Add(*e); } Raw.Add(0); } s = *e ? e + 1 : e; } } d->Str.Reset(Raw.Release()); for (int n=0; nPtr[n] = d->Str + Offsets[n]; } Args = (int)d->Ptr.Length(); Arg = (const char**) &d->Ptr[0]; } OsAppArguments &OsAppArguments::operator =(OsAppArguments &a) { GArray Raw; GArray Offsets; for (int i=0; iStr.Reset(new char[Raw.Length()]); memcpy(d->Str, &Raw[0], Raw.Length()); for (int n=0; nPtr[n] = d->Str + Offsets[n]; } Args = (int)d->Ptr.Length(); Arg = (const char**) &d->Ptr[0]; return *this; } //////////////////////////////////////////////////////////////// #if defined(MAC_OS_X_VERSION_10_12) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_12 #define SDK_10_12(newSym, oldSym) newSym #else #define SDK_10_12(newSym, oldSym) oldSym #endif void GMouse::SetFromEvent(NSEvent *ev, NSView *view) { auto r = view.frame; auto pt = ev.locationInWindow; GMouse m; x = (int)pt.x; y = (int)(r.size.height - pt.y); SetModifer((uint32)ev.modifierFlags); Double(ev.clickCount == 2); switch (ev.type) { case SDK_10_12(NSEventTypeLeftMouseDown, NX_LMOUSEDOWN): Down(true); Left(true); break; case SDK_10_12(NSEventTypeLeftMouseUp, NX_LMOUSEUP): Down(false); Left(true); break; case SDK_10_12(NSEventTypeRightMouseDown, NX_RMOUSEDOWN): Down(true); Right(true); break; case SDK_10_12(NSEventTypeRightMouseUp, NX_RMOUSEUP): Down(false); Right(true); break; case SDK_10_12(NSEventTypeOtherMouseDown, NX_OMOUSEDOWN): Down(true); Middle(true); break; case SDK_10_12(NSEventTypeOtherMouseUp, NX_OMOUSEUP): Down(false); Middle(true); break; case SDK_10_12(NSEventTypeMouseMoved, NX_MOUSEMOVED): IsMove(true); break; case SDK_10_12(NSEventTypeLeftMouseDragged, NX_LMOUSEDRAGGED): Down(true); IsMove(true); Left(true); break; case SDK_10_12(NSEventTypeRightMouseDragged, NX_RMOUSEDRAGGED): Down(true); IsMove(true); Right(true); break; default: LgiAssert(!"Unknown event."); break; } } void GUiEvent::SetModifer(uint32_t modifierKeys) { System(modifierKeys & SDK_10_12(NSEventModifierFlagCommand, NSCommandKeyMask)); Shift (modifierKeys & SDK_10_12(NSEventModifierFlagShift, NSShiftKeyMask)); Alt (modifierKeys & SDK_10_12(NSEventModifierFlagOption, NSAlternateKeyMask)); Ctrl (modifierKeys & SDK_10_12(NSEventModifierFlagControl, NSControlKeyMask)); } void GMessage::Set(int msg, Param A, Param B) { m = msg; a = A; b = B; } //////////////////////////////////////////////////////////////// typedef GArray AppArray; void OnSigPipe(int i) { } void OnCrash(int i) { printf("%s:%i - on crash.\n", __FILE__, __LINE__); signal(SIGBUS, 0); signal(SIGSEGV, 0); struct Pipe { int Read; int Write; Pipe() { Read = -1; Write = -1; } }; Pipe Read; Pipe Write; Pipe Error; int Pid; pipe((int*)&Read); pipe((int*)&Error); auto Exe = LGetExeFile(); // Has stdin pipe pipe((int*)&Write); if (!(Pid = fork())) { // stdin -> Write close(0); // close stdin dup(Write.Read); close(Write.Write); // stdout -> Read close(1); // close stdout dup(Read.Write); close(Read.Read); // stderr -> Error close(2); // close stderr dup(Error.Write); close(Error.Read); // setup read & write handles char sPid[32]; sprintf(sPid, "--pid=%i", getpid()); char *Args[] = {sPid, Exe, 0}; // printf("Calling: execv('gdb', '%s', '%s');\n", Exe, sPid); execv("/usr/bin/gdb", Args); // We should never get here printf("%s:%i - execv(gdb) failed.\n", __FILE__, __LINE__); exit(-1); } ssize_t r, Used = 0; char Buf[1025]; bool Capture = false; while ((r = read(Read.Read, Buf + Used, sizeof(Buf) - Used - 1)) > 0) { printf("Got %i bytes\n", (int)r); Used += r; Buf[Used] = 0; printf("Capt=%i Buf='%s'\n", Capture, Buf); if (!Capture) { if (stristr(Buf, "(gdb)")) { char c[] = "info pid\n"; ssize_t w = write(Write.Write, c, strlen(c)); printf("Writing cmd %i bytes\n", (int)w); Capture = true; Used = 0; Buf[0] = 0; } } char *Eol; while ((Eol = strstr(Buf, "\n"))) { *Eol = 0; if (Capture) { printf("Capture '%s'\n", Buf); } Eol += 1; ptrdiff_t Len = Eol - Buf; memmove(Buf, Eol, Used + 1 - Len); Used -= Len; } } exit(-1); } class GAppPrivate { public: OsApp NsApp; int RunDepth; // Common GXmlTag *Config; GFileSystem *FileSystem; GdcDevice *GdcSystem; OsAppArguments Args; GLibrary *SkinLib; LHashTbl,AppArray*> MimeToApp; OsThread GuiThread; OsThreadId GuiThreadId; GSymLookup SymLookup; GAutoString Mime; GAutoString Name; GAutoString UrlArg; /// Any fonts needed for styling the elements GAutoPtr FontCache; GAppPrivate() { NsApp = NULL; RunDepth = 0; FileSystem = 0; GdcSystem = 0; Config = 0; SkinLib = 0; GuiThread = LgiGetCurrentThread(); GuiThreadId = GetCurrentThreadId(); } ~GAppPrivate() { DeleteObj(SkinLib); for (auto p : MimeToApp) { p.value->DeleteObjects(); DeleteObj(p.value); } } }; ///////////////////////////////////////////////////////////////////////////// @implementation LNsApplication - (id)init:(GAppPrivate*)priv { if ((self = [super init]) != nil) { self.d = priv; printf("LNsApplication.init\n"); } return self; } - (void)terminate:(nullable id)sender { [super terminate:sender]; } - (void)dealloc { - [super dealloc]; + // [super dealloc]; printf("LNsApplication.dealloc\n"); } - (void)assert:(LCocoaAssert*)ca { NSAlert *a = [[NSAlert alloc] init]; a.messageText = ca.msg.NsStr(); a.alertStyle = NSAlertStyleCritical; [a addButtonWithTitle:@"Debug"]; [a addButtonWithTitle:@"Ignore"]; [a addButtonWithTitle:@"Abort"]; ca.result = [a runModal]; - [a release]; + // [a release]; } @end ///////////////////////////////////////////////////////////////////////////// GSkinEngine *GApp::SkinEngine = 0; GApp *TheApp = 0; GMouseHook *GApp::MouseHook = 0; GApp::GApp(OsAppArguments &AppArgs, const char *AppName, GAppArguments *ObjArgs) : OsApplication(AppArgs.Args, AppArgs.Arg) { TheApp = this; d = new GAppPrivate; d->Name.Reset(NewStr(AppName)); AppWnd = 0; Name(AppName); LgiArgsAppPath = AppArgs.Arg[0]; // Catch and ignore SIGPIPE signal(SIGPIPE, OnSigPipe); #if 0 // Crash handler... signal(SIGBUS, OnCrash); signal(SIGSEGV, OnCrash); #endif // We want our printf's NOW! setvbuf(stdout,(char *)NULL,_IONBF,0); // print mesgs immediately. // Connect to the server d->NsApp = [LNsApplication sharedApplication]; #if 0 auto mainMenu = [d->NsApp mainMenu]; if (!mainMenu) { mainMenu = [[NSMenu alloc] initWithTitle:@"App"]; } NSMenuItem *appItem = [mainMenu itemAtIndex:0]; if (!appItem) { appItem = [[NSMenuItem alloc] initWithTitle:@"appItem" action:NULL keyEquivalent:@""]; [mainMenu addItem:appItem]; } NSMenu *appMenu = [appItem submenu]; if (!appMenu) { appMenu = [[NSMenu alloc] initWithTitle:@"AppMenu"]; [appItem setSubmenu:appMenu]; } if (appMenu) { auto myItem = [[NSMenuItem alloc] initWithTitle:@"Quit" action:NULL keyEquivalent:@"Q"]; [myItem setKeyEquivalentModifierMask: NSCommandKeyMask]; [appMenu addItem:myItem]; } [d->NsApp setMainMenu:mainMenu]; #endif // Setup the file and graphics sub-systems d->FileSystem = new GFileSystem; d->GdcSystem = new GdcDevice; srand((unsigned)LgiCurrentTime()); GColour::OnChange(); SetAppArgs(AppArgs); MouseHook = new GMouseHook; // System font setup SystemNormal = 0; GFontType SysFontType; if (SysFontType.GetSystemFont("System")) { SystemNormal = SysFontType.Create(); if (SystemNormal) { SystemNormal->Transparent(true); } else { printf("%s:%i - Error creating system font.\n", __FILE__, __LINE__); } SystemBold = SysFontType.Create(); if (SystemBold) { SystemBold->Bold(true); SystemBold->Transparent(true); SystemBold->Create(); } else { printf("%s:%i - Error creating bold version of the system font.\n", __FILE__, __LINE__); } } else { printf("%s:%i - Couldn't get system font setting.\n", __FILE__, __LINE__); } if (!SystemNormal) { LgiMsg(0, "Error: Couldn't create system font.", "Lgi Error: GApp::GApp", MB_OK); LgiExitApp(); } if (!GetOption("noskin")) { extern GSkinEngine *CreateSkinEngine(GApp *App); SkinEngine = CreateSkinEngine(this); } } GApp::~GApp() { DeleteObj(AppWnd); DeleteObj(SystemNormal); DeleteObj(SystemBold); DeleteObj(MouseHook); DeleteObj(d->FileSystem); DeleteObj(d->GdcSystem); DeleteObj(d->Config); DeleteObj(GFontSystem::Me); DeleteObj(d); TheApp = 0; } OsApp &GApp::Handle() { return d->NsApp; } bool GApp::PostEvent(GViewI *View, int Msg, GMessage::Param A, GMessage::Param B) { if (!View) { printf("%s:%i - No view.\n", _FL); return false; } bool Exists = GView::LockHandler(View, GView::LockOp::OpExists); if (!Exists) { printf("%s:%i - View deleted.\n", _FL); return false; } GWindow *w = View->GetWindow(); if (!w) { // printf("%s:%i - No window.\n", _FL); return false; } auto v = w->Handle(); if (!v) { printf("%s:%i - No handle.\n", _FL); return false; } auto m = [[LCocoaMsg alloc] init:View msg:Msg a:A b:B]; [v performSelectorOnMainThread:@selector(userEvent:) withObject:m waitUntilDone:false]; return true; } GApp *GApp::ObjInstance() { return TheApp; } bool GApp::IsOk() { bool Status = #if !defined(__clang__) (this != 0) && #endif (d != 0) /* #ifdef XWIN && (XDisplay() != 0) #endif */ ; LgiAssert(Status); return Status; } GMouseHook *GApp::GetMouseHook() { return MouseHook; } int GApp::GetMetric(LgiSystemMetric Metric) { switch (Metric) { default: break; case LGI_MET_DECOR_X: { return 0; } case LGI_MET_DECOR_Y: case LGI_MET_DECOR_CAPTION: { if (AppWnd) { #if 0 Rect r; OSStatus e = GetWindowBounds(AppWnd->WindowHandle(), kWindowTitleBarRgn, &r); if (e) printf("%s:%i - GetWindowBounds failed with %i\n", _FL, (int)e); else { int y = r.bottom - r.top; return y; } #endif } return 22; } } return 0; } GViewI *GApp::GetFocus() { auto kw = d->NsApp.p.keyWindow; if (!kw) return NULL; LNsWindow *w = objc_dynamic_cast(LNsWindow, kw); GWindow *gw = w ? [w getWindow] : nil; if (!gw) return NULL; return gw->GetFocus(); } OsThread GApp::_GetGuiThread() { return d->GuiThread; } OsThreadId GApp::GetGuiThreadId() { return d->GuiThreadId; } bool GApp::InThread() { return GetCurrentThreadId() == d->GuiThreadId; } OsProcessId GApp::GetProcessId() { return getpid(); } OsAppArguments *GApp::GetAppArgs() { return IsOk() ? &d->Args : 0; } void GApp::SetAppArgs(OsAppArguments &AppArgs) { if (IsOk()) { d->Args = AppArgs; } } struct IdleGluePtrs { GApp::OnIdleProc Callback; void *Param; }; #define CUSTOM_LOOP 0 #if 0 void IdleGlue(EventLoopTimerRef inTimer, void *inUserData) { IdleGluePtrs *p = (IdleGluePtrs*)inUserData; p->Callback(p->Param); } #endif bool GApp::Run(bool Loop, OnIdleProc IdleCallback, void *IdleParam) { if (!d->NsApp) { LgiAssert(!"No d->NsApp"); return false; } if (Loop) { #if CUSTOM_LOOP // This impl allows for us to exit gracefully. // NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; int Depth = ++d->RunDepth; do { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; NSEvent *event = [ d->NsApp nextEventMatchingMask:NSAnyEventMask untilDate:[NSDate distantFuture] inMode:NSDefaultRunLoopMode dequeue:YES]; [d->NsApp sendEvent:event]; [d->NsApp updateWindows]; [pool release]; } while (d->RunDepth >= Depth); // [pool release]; #else #if 1 NSApplicationMain(GetArgs(), GetArg()); #else [d->NsApp run]; #endif #endif return true; } else { } return 0; } void GApp::Exit(int Code) { #if CUSTOM_LOOP if (!Code) { if (d->RunDepth > 0) d->RunDepth--; } #else if (!Code) { if (AppWnd) AppWnd->Quit(); [d->NsApp performSelector:@selector(terminate:) withObject:nil afterDelay:0.0]; } else #endif { // hard exit ::exit(Code); } } void GApp::OnUrl(const char *Url) { if (AppWnd) AppWnd->OnUrl(Url); else d->UrlArg.Reset(NewStr(Url)); } void GApp::OnReceiveFiles(GArray &Files) { if (AppWnd) AppWnd->OnReceiveFiles(Files); } GXmlTag *GApp::GetConfig(const char *Tag) { if (IsOk() && !d->Config) { char File[] = "lgi.conf"; char Path[256]; if (LgiGetExePath(Path, sizeof(Path))) { if (Path[strlen(Path)-1] != DIR_CHAR) strcat(Path, DIR_STR); strcat(Path, File); if (FileExists(Path)) { d->Config = new GXmlTag("Config"); if (d->Config) { GFile f; if (f.Open(Path, O_READ)) { GXmlTree t; t.Read(d->Config, &f, 0); } } } } if (!d->Config) { d->Config = new GXmlTag("Options"); } } if (Tag && d->Config) { return d->Config->GetChildTag(Tag); } return 0; } void GApp::SetConfig(GXmlTag *Tag) { if (IsOk() && Tag) { GXmlTag *Old = GetConfig(Tag->GetTag()); if (Old) { Old->RemoveTag(); DeleteObj(Old); } if (!d->Config) { GetConfig(0); } if (d->Config) { d->Config->InsertTag(Tag); } } } const char *GApp::GetArgumentAt(int n) { return n >= 0 && n < d->Args.Args ? d->Args.Arg[n] : 0; } bool GApp::GetOption(const char *Option, char *Dest, int DestLen) { GString Buf; if (GetOption(Option, Buf)) { if (Dest) strcpy_s(Dest, DestLen, Buf); return true; } return false; } bool GApp::GetOption(const char *Option, GString &Buf) { if (IsOk() && Option) { size_t OptLen = strlen(Option); for (int i=1; iArgs.Args; i++) { const char *a = d->Args.Arg[i]; if (strchr("-/\\", a[0])) { if (strncmp(a+1, Option, OptLen) == 0) { const char *Arg = 0; if (strlen(a+1+OptLen) > 0) { Arg = a + 1 + OptLen; } else if (i < d->Args.Args - 1) { Arg = d->Args.Arg[i + 1]; } if (Arg) { if (strchr("\'\"", *Arg)) { char Delim = *Arg++; char *End = strchr(Arg, Delim); if (End) { size_t Len = End-Arg; if (Len > 0) { Buf.Set(Arg, Len); } else return false; } else return false; } else { Buf = Arg; } } return true; } } } } return false; } void GApp::OnCommandLine() { GArray Files; for (int i=1; iArgs; i++) { const char *a = GetAppArgs()->Arg[i]; if (FileExists(a)) { Files.Add(NewStr(a)); } } // call app if (Files.Length() > 0) { OnReceiveFiles(Files); } // clear up Files.DeleteArrays(); } GString GApp::GetFileMimeType(const char *File) { GString Ret; if (!FileExists(File)) { // Look in the path GToken p(getenv("PATH"), LGI_PATH_SEPARATOR); for (int i=0; i &Apps) { // Use LSCopyApplicationForMIMEType? // Find alternative version of the MIME type (e.g. x-type and type). char AltMime[256]; strcpy(AltMime, Mime); char *s = strchr(AltMime, '/'); if (s) { s++; size_t Len = strlen(s) + 1; if (strnicmp(s, "x-", 2) == 0) { memmove(s, s+2, Len - 2); } else { memmove(s+2, s, Len); s[0] = 'x'; s[1] = '-'; } } if (!d->MimeToApp.Length()) { // printf("%s:%i - Building MimeToApp.\n", __FILE__, __LINE__); } AppArray *p = (AppArray*)d->MimeToApp.Find(Mime); if (p) { for (int i=0; iLength(); i++) { Apps[i] = (*p)[i]; } return true; } return false; } GSymLookup *GApp::GetSymLookup() { return &d->SymLookup; } bool GApp::IsElevated() { return geteuid() == 0; } int GApp::GetCpuCount() { return 1; } GFontCache *GApp::GetFontCache() { if (!d->FontCache) d->FontCache.Reset(new GFontCache(SystemNormal)); return d->FontCache; } diff --git a/src/mac/cocoa/Lgi/GClipBoard.mm b/src/mac/cocoa/Lgi/GClipBoard.mm --- a/src/mac/cocoa/Lgi/GClipBoard.mm +++ b/src/mac/cocoa/Lgi/GClipBoard.mm @@ -1,173 +1,173 @@ // MacOSX Clipboard Implementation #include "Lgi.h" #include "GClipBoard.h" #define kClipboardTextType "public.utf16-plain-text" class GClipBoardPriv { public: GClipBoardPriv() { } ~GClipBoardPriv() { } }; /////////////////////////////////////////////////////////////////////////////////////////////// GClipBoard::GClipBoard(GView *o) { d = new GClipBoardPriv; Owner = o; Open = true; } GClipBoard::~GClipBoard() { DeleteObj(d); } bool GClipBoard::Empty() { - LAutoPool Ap; + // LAutoPool Ap; bool Status = false; Txt.Empty(); wTxt.Reset(); NSPasteboard *pasteboard = [NSPasteboard generalPasteboard]; [pasteboard clearContents]; return Status; } bool GClipBoard::Text(char *Str, bool AutoEmpty) { - LAutoPool Ap; + // LAutoPool Ap; if (AutoEmpty) Empty(); Txt = Str; wTxt.Reset(); NSPasteboard *pasteboard = [NSPasteboard generalPasteboard]; NSArray *array = [NSArray arrayWithObject:Txt.NsStr()]; [pasteboard writeObjects:array]; return Txt; } char *GClipBoard::Text() { - LAutoPool Ap; + // LAutoPool Ap; NSArray *classes = [[NSArray alloc] initWithObjects:[NSString class], nil]; NSArray *copiedItems = [[NSPasteboard generalPasteboard] readObjectsForClasses:classes options:[NSDictionary dictionary]]; if (copiedItems != nil) { for (NSString *s in copiedItems) { Txt = [s UTF8String]; break; } } - [classes release]; + //[classes release]; return Txt; } bool GClipBoard::TextW(char16 *Str, bool AutoEmpty) { bool Status = false; if (AutoEmpty) Empty(); Txt = Str; wTxt.Reset(); NSPasteboard *pasteboard = [NSPasteboard generalPasteboard]; NSArray *array = [NSArray arrayWithObject:Txt.NsStr()]; [pasteboard writeObjects:array]; return Status; } char16 *GClipBoard::TextW() { Text(); wTxt.Reset(Utf8ToWide(Txt)); return wTxt; } bool GClipBoard::Html(const char *doc, bool AutoEmpty) { return false; } GString GClipBoard::Html() { return GString(); } bool GClipBoard::Bitmap(GSurface *pDC, bool AutoEmpty) { bool Status = false; if (pDC && Owner) { LgiAssert(!"Not impl"); } return Status; } GSurface *GClipBoard::Bitmap() { GSurface *pDC = NULL; LgiAssert(!"Not impl"); return pDC; } bool GClipBoard::Binary(FormatType Format, uchar *Ptr, ssize_t Len, bool AutoEmpty) { bool Status = false; if (Ptr && Len > 0) { LgiAssert(!"Not impl"); } return Status; } bool GClipBoard::Binary(FormatType Format, GAutoPtr &Ptr, ssize_t *Len) { bool Status = false; NSPasteboard *pasteboard = [NSPasteboard generalPasteboard]; NSArray *classes = [[NSArray alloc] initWithObjects:[NSPasteboardItem class], nil]; NSDictionary *options = [NSDictionary dictionary]; NSArray *copiedItems = [pasteboard readObjectsForClasses:classes options:options]; if (copiedItems != nil) { for (NSPasteboardItem *i in copiedItems) { GString::Array Types; Types.SetFixedLength(false); for (id type in i.types) Types.New() = [type UTF8String]; // Pick a type and decode it... printf("%s:%i - FIXME decode a binary type here.\n", _FL); } - [copiedItems release]; + // [copiedItems release]; } return Status; } diff --git a/src/mac/cocoa/Lgi/GGeneral.mm b/src/mac/cocoa/Lgi/GGeneral.mm --- a/src/mac/cocoa/Lgi/GGeneral.mm +++ b/src/mac/cocoa/Lgi/GGeneral.mm @@ -1,575 +1,575 @@ // Mac Implementation of General LGI functions #include #include #include #include #include // #define _POSIX_TIMERS #include #include "Lgi.h" #include "GProcess.h" #include "GTextLabel.h" #include "GButton.h" #include "INet.h" #include #include #include //////////////////////////////////////////////////////////////// // Local helper functions bool _lgi_check_file(char *Path) { if (Path) { if (FileExists(Path)) { // file is there return true; } else { // shortcut? char *e = Path + strlen(Path); strcpy(e, ".lnk"); if (FileExists(Path)) { // resolve shortcut char Link[256]; if (ResolveShortcut(Path, Link, sizeof(Link))) { // check destination of link if (FileExists(Link)) { strcpy(Path, Link); return true; } } } *e = 0; } } return false; } void LgiSleep(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]; + //[ca release]; #else GAlert 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 GMessage CreateMsg(int m, GMessage::Param a, GMessage::Param b) { static class GMessage Msg(0); Msg.Set(m, a, b); return Msg; } OsView DefaultOsView(GView *v) { return NULL; } GString LGetFileMimeType(const char *File) { return LgiApp->GetFileMimeType(File); } #include "GToken.h" bool _GetIniField(char *Grp, char *Field, char *In, char *Out, int OutSize) { if (ValidStr(In)) { bool InGroup = false; GToken t(In, "\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); GArray a; a.Add(File); char *p; while ((p = LgiTokStr(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; #endif } } } } return Status; } CFStringRef Utf8ToCFString(char *s, ssize_t len) { if (s && len < 0) len = strlen(s); return CFStringCreateWithBytes(kCFAllocatorDefault, (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 LgiGetMimeTypeExtensions(const char *Mime, GArray &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", 0) HardCodeExtention("text/x-vcard", "vcf", 0) HardCodeExtention("text/mbox", "mbx", "mbox"); return Ext.Length() > Start; } GString LCurrentUserName() { struct passwd *pw = getpwuid(geteuid()); if (pw) return pw->pw_name; return ""; } diff --git a/src/mac/cocoa/Lgi/GView.mm b/src/mac/cocoa/Lgi/GView.mm --- a/src/mac/cocoa/Lgi/GView.mm +++ b/src/mac/cocoa/Lgi/GView.mm @@ -1,883 +1,883 @@ /*hdr ** FILE: GView.cpp ** AUTHOR: Matthew Allen ** DATE: 23/4/98 ** DESCRIPTION: Linux GView Implementation ** ** Copyright (C) 1998-2003, Matthew Allen ** fret@memecode.com */ #include #include #include "Lgi.h" #include "GDragAndDrop.h" #include "GScrollBar.h" #include "GEdit.h" #include "GViewPriv.h" #include "GCss.h" #include "LCocoaView.h" #define ADJ_LEFT 1 #define ADJ_RIGHT 2 #define ADJ_UP 3 #define ADJ_DOWN 4 // CursorData is a bitmap in an array of uint32's. This is generated from a graphics file: // ./Code/cursors.png // // The pixel values are turned into C code by a program called i.Mage: // http://www.memecode.com/image.php // // Load the graphic into i.Mage and then go Edit->CopyAsCode // Then paste the text into the CursorData variable at the bottom of this file. // // This saves a lot of time finding and loading an external resouce, and even having to // bundle extra files with your application. Which have a tendancy to get lost along the // way etc. extern uint32 CursorData[]; GInlineBmp Cursors = { 300, 20, 8, CursorData }; struct LgiCursorInfo { public: GRect Pos; GdcPt2 HotSpot; } CursorMetrics[] = { // up arrow { GRect(0, 0, 8, 15), GdcPt2(4, 0) }, // cross hair { GRect(20, 0, 38, 18), GdcPt2(29, 9) }, // hourglass { GRect(40, 0, 51, 15), GdcPt2(45, 8) }, // I beam { GRect(60, 0, 66, 17), GdcPt2(63, 8) }, // N-S arrow { GRect(80, 0, 91, 16), GdcPt2(85, 8) }, // E-W arrow { GRect(100, 0, 116, 11), GdcPt2(108, 5) }, // NW-SE arrow { GRect(120, 0, 132, 12), GdcPt2(126, 6) }, // NE-SW arrow { GRect(140, 0, 152, 12), GdcPt2(146, 6) }, // 4 way arrow { GRect(160, 0, 178, 18), GdcPt2(169, 9) }, // Blank { GRect(0, 0, 0, 0), GdcPt2(0, 0) }, // Vertical split { GRect(180, 0, 197, 16), GdcPt2(188, 8) }, // Horizontal split { GRect(200, 0, 216, 17), GdcPt2(208, 8) }, // Hand { GRect(220, 0, 233, 13), GdcPt2(225, 0) }, // No drop { GRect(240, 0, 258, 18), GdcPt2(249, 9) }, // Copy drop { GRect(260, 0, 279, 19), GdcPt2(260, 0) }, // Move drop { GRect(280, 0, 299, 19), GdcPt2(280, 0) }, }; //////////////////////////////////////////////////////////////////////////// GView *GWindowFromHandle(OsView h) { if (!h) return 0; return 0; } //////////////////////////////////////////////////////////////////////////// bool LgiIsKeyDown(int Key) { LgiAssert(!"Not impl."); return false; } bool LgiIsMounted(char *Name) { LgiAssert(!"Not impl."); return false; } bool LgiMountVolume(char *Name) { LgiAssert(!"Not impl."); return false; } GKey::GKey(int Vkey, uint32_t flags) { c16 = vkey = Vkey; Flags = flags; Data = 0; IsChar = false; } //////////////////////////////////////////////////////////////////////////////////////////////////// #if 0 bool GViewPrivate::CursorSet = false; GView *GViewPrivate::LastCursor = 0; #endif GViewPrivate::GViewPrivate() { TabStop = false; #if 0 CursorId = 0; FontOwn = false; #endif Parent = 0; ParentI = 0; Notify = 0; CtrlId = -1; DropTarget = 0; Font = 0; Popup = 0; Pulse = 0; SinkHnd = -1; AttachEvent = false; static bool First = true; if (First) { First = false; } } GViewPrivate::~GViewPrivate() { DeleteObj(Popup); LgiAssert(Pulse == NULL); } const char *GView::GetClass() { return "GView"; } GView *&GView::PopupChild() { return d->Popup; } bool GView::_Mouse(GMouse &m, bool Move) { #if 0 if (Move) { static bool First = true; if (First) { First = false; //_DumpHeirarchy(GetWindow()); //_Dump(0, GetWindow(), HIViewGetRoot(GetWindow()->WindowHandle())); } printf("_Mouse %p,%s %i,%i down=%i move=%i\n", this, GetClass(), m.x, m.y, m.Down(), Move); } #endif GWindow *Wnd = GetWindow(); if (_Capturing) { // Convert root NSView coords to capture view coords for (auto i = _Capturing; i && i != this; i = i->GetParent()) { auto p = i->GetPos(); m.x -= p.x1; m.y -= p.y1; } // if (!m.IsMove()) m.Trace("Capture"); if (Move) { GViewI *c = _Capturing; c->OnMouseMove(m); } else { if (!Wnd || Wnd->HandleViewMouse(dynamic_cast(_Capturing), m)) _Capturing->OnMouseClick(m); } } else { // Convert root NSView coords to _Over coords auto t = WindowFromPoint(m.x, m.y); if (t) { for (auto i = t; i && i != this; i = i->GetParent()) { auto p = i->GetPos(); m.x -= p.x1; m.y -= p.y1; } m.Target = t; } // if (!m.IsMove()) m.Trace("NonCapture"); if (_Over != m.Target) { if (_Over) _Over->OnMouseExit(m); _Over = m.Target; if (_Over) _Over->OnMouseEnter(m); } GView *Target = dynamic_cast(_Over ? _Over : m.Target); GLayout *Lo = dynamic_cast(Target); GRect Client = Lo ? Lo->GetClient(false) : Target->GView::GetClient(false); if (!Client.Valid() || Client.Overlap(m.x, m.y)) { if (Move) Target->OnMouseMove(m); else if (!Wnd || Wnd->HandleViewMouse(Target, m)) Target->OnMouseClick(m); } else return false; } return true; } GRect &GView::GetClient(bool ClientSpace) { int Edge = (Sunken() || Raised()) ? _BorderSize : 0; static GRect c; c = Pos; c.Offset(-c.x1, -c.y1); if (ClientSpace) { c.x2 -= Edge << 1; c.y2 -= Edge << 1; } else { c.Size(Edge, Edge); } return c; } void GView::Quit(bool DontDelete) { if (DontDelete) { Visible(false); } else { Detach(); delete this; } } GdcPt2 GView::Flip(GdcPt2 p) { auto Parent = GetParent() ? GetParent() : GetWindow(); if (Parent) { GRect r = Parent->GetClient(false); p.y = r.y2 - p.y; } return p; } void GView::OnDealloc() { #if LGI_VIEW_HASH LockHandler(this, OpDelete); #endif SetPulse(); for (auto c: Children) { auto gv = c->GetGView(); if (gv) gv->OnDealloc(); } } GRect GView::Flip(GRect p) { auto Parent = GetParent() ? GetParent() : GetWindow(); if (Parent) { GRect r = Parent->GetClient(false); int y2 = r.y2 - p.y1; int y1 = y2 - p.Y() + 1; p.Offset(0, y1-p.y1); } return p; } bool GView::SetPos(GRect &p, bool Repaint) { Pos = p; OnPosChange(); return true; } bool GView::Invalidate(GRect *rc, bool Repaint, bool Frame) { GRect r; if (rc) r = *rc; else r = GetClient(); if (!r.Valid()) return false; auto w = GetWindow(); GViewI *v; for (v = this; v; v = v->GetParent()) { if (!v->Visible()) return true; if (v == (GViewI*)w) break; auto p = v->GetPos(); r.Offset(p.x1, p.y1); } auto nsview = w ? w->Handle() : NULL; if (nsview) { #if 0 [nsview setNeedsDisplayInRect:v->GetGView()->Flip(r)]; printf("%s::Inval r=%s\n", GetClass(), r.GetStr()); #else nsview.needsDisplay = true; #endif } // else LgiTrace("%s:%i - No contentView? %s\n", _FL, GetClass()); return false; } void GView::SetPulse(int Length) { DeleteObj(d->Pulse); if (Length > 0) d->Pulse = new GPulseThread(this, Length); } LgiCursor GView::GetCursor(int x, int y) { return LCUR_Normal; } GMessage::Result GView::OnEvent(GMessage *Msg) { switch (Msg->m) { case M_PULSE: { OnPulse(); break; } case M_CHANGE: { GViewI *Ctrl; if (GetViewById((int)Msg->A(), Ctrl)) return OnNotify(Ctrl, (int)Msg->B()); break; } case M_COMMAND: { return OnCommand((int)Msg->A(), 0, (OsView)Msg->B()); } default: { break; } } return 0; } bool GView::PointToScreen(GdcPt2 &p) { GViewI *c = this; // Find offset to window while (c && c != c->GetWindow()) { GRect pos = c->GetPos(); p.x += pos.x1; p.y += pos.y1; c = c->GetParent(); } if (c && c->WindowHandle()) { NSWindow *w = c->WindowHandle(); GRect wFrame = w.frame; GRect Screen(0, 0, -1, -1); for (NSScreen *s in [NSScreen screens]) { GRect pos = s.frame; if (wFrame.Overlap(&pos)) { Screen = pos; break; } } if (!Screen.Valid()) return false; p = c->GetGView()->Flip(p); NSRect i = {{(double)p.x, (double)p.y}, {0.0, 0.0}}; NSRect o = [w convertRectToScreen:i]; p.x = (int)o.origin.x; p.y = Screen.Y() - (int)o.origin.y; } else return false; return true; } bool GView::PointToView(GdcPt2 &p) { GViewI *c = this; int Ox = 0, Oy = 0; // Find offset to window while (c && c != c->GetWindow()) { GView *gv = c->GetGView(); GRect cli = gv ? gv->GView::GetClient(false) : c->GetClient(false); GRect pos = c->GetPos(); Ox += pos.x1 + cli.x1; Oy += pos.y1 + cli.y1; c = c->GetParent(); } // Apply window position if (c && c->WindowHandle()) { NSWindow *w = c->WindowHandle(); GRect wFrame = w.frame; GRect Screen(0, 0, -1, -1); for (NSScreen *s in [NSScreen screens]) { GRect pos = s.frame; if (wFrame.Overlap(&pos)) { Screen = pos; break; } } if (!Screen.Valid()) return false; // Flip into top-down to bottom up: NSRect i = {(double)p.x, (double)(Screen.Y()-p.y), 0.0, 0.0}; NSRect o = [w convertRectFromScreen:i]; p.x = (int)o.origin.x; p.y = (int)o.origin.y; // Flip back into top down.. in window space p = c->GetGView()->Flip(p); // Now offset into view space. p.x += Ox; p.y += Oy; } else return false; return true; } bool GView::GetMouse(GMouse &m, bool ScreenCoords) { GViewI *w = GetWindow(); if (!w) return false; NSWindow *wh = w->WindowHandle(); if (!wh) return false; NSPoint pt = wh.mouseLocationOutsideOfEventStream; m.x = pt.x; m.y = pt.y; GdcPt2 p(pt.x, pt.y); p = w->GetGView()->Flip(p); if (ScreenCoords) PointToScreen(p); m.x = p.x; m.y = p.y; return true; } bool GView::IsAttached() { GWindow *w = GetWindow(); if (!w) return false; if (w == this) return WindowHandle() != 0; if (!d->AttachEvent) return false; if (GetParent() != NULL) return w->WindowHandle() != 0; return false; } void BuildTabStops(GArray &Stops, GViewI *v) { if (v && v->Visible()) { if (v->GetTabStop() && v->Enabled()) Stops.Add(v); GViewIterator *it = v->IterateViews(); if (it) { for (GViewI *c = it->First(); c; c = it->Next()) { BuildTabStops(Stops, c); } DeleteObj(it); } } } void NextTabStop(GViewI *v, int dir) { GArray Stops; BuildTabStops(Stops, v->GetWindow()); ssize_t Idx = Stops.IndexOf(v); if (Idx >= 0) Idx += dir; else Idx = 0; if (Idx < 0) Idx = Stops.Length() - 1; else if (Idx >= Stops.Length()) Idx = 0; if (Idx < Stops.Length()) Stops[Idx]->Focus(true); } void SetDefaultFocus(GViewI *v) { GArray Stops; BuildTabStops(Stops, v->GetWindow()); if (Stops.Length()) { int Set = -1; for (int i=0; iFocus()) { Set = i; break; } } if (Set < 0) Set = 0; Stops[Set]->Focus(true); } } int VirtualKeyToLgi(int Virt) { switch (Virt) { // various case 122: return LK_F1; case 120: return LK_F2; case 99: return LK_F3; case 118: return LK_F4; case 96: return LK_F5; case 97: return LK_F6; case 98: return LK_F7; case 100: return LK_F8; case 101: return LK_F9; case 109: return LK_F10; case 103: return LK_F11; case 110: return LK_APPS; case 111: return LK_F12; case 123: return LK_LEFT; case 124: return LK_RIGHT; case 125: return LK_DOWN; case 126: return LK_UP; case 114: return LK_INSERT; case 116: return LK_PAGEUP; case 121: return LK_PAGEDOWN; case 53: return LK_ESCAPE; case 51: return LK_BACKSPACE; case 117: return LK_DELETE; case 115: return LK_HOME; case 119: return LK_END; // whitespace case 76: return LK_RETURN; case 36: return '\r'; case 48: return '\t'; case 49: return ' '; // delimiters case 27: return '-'; case 24: return '='; case 42: return '\\'; case 47: return '.'; case 50: return '`'; // digits case 18: return '1'; case 19: return '2'; case 20: return '3'; case 21: return '4'; case 23: return '5'; case 22: return '6'; case 26: return '7'; case 28: return '8'; case 25: return '9'; case 29: return '0'; // alpha case 0: return 'a'; case 11: return 'b'; case 8: return 'c'; case 2: return 'd'; case 14: return 'e'; case 3: return 'f'; case 5: return 'g'; case 4: return 'h'; case 34: return 'i'; case 38: return 'j'; case 40: return 'k'; case 37: return 'l'; case 46: return 'm'; case 45: return 'n'; case 31: return 'o'; case 35: return 'p'; case 12: return 'q'; case 15: return 'r'; case 1: return 's'; case 17: return 't'; case 32: return 'u'; case 9: return 'v'; case 13: return 'w'; case 7: return 'x'; case 16: return 'y'; case 6: return 'z'; default: printf("%s:%i - unimplemented virt->lgi code mapping: %d\n", _FL, (unsigned)Virt); break; } return 0; } #if 0 static int GetIsChar(GKey &k, int mods) { return k.IsChar = (mods & 0x100) == 0 && ( k.c16 >= ' ' || k.c16 == VK_RETURN || k.c16 == VK_TAB || k.c16 == VK_BACKSPACE ); } #endif bool GView::_Attach(GViewI *parent) { - LAutoPool Pool; + // LAutoPool Pool; if (!parent) { LgiAssert(0); return false; } d->ClassName = GetClass(); d->ParentI = parent; d->Parent = d->ParentI ? parent->GetGView() : NULL; LgiAssert(!_InLock); _Window = d->GetParent() ? d->GetParent()->GetWindow() : 0; if (_Window) _Lock = _Window->_Lock; auto p = d->GetParent(); if (p) { GWindow *w = dynamic_cast(p); NSView *ph = nil; if (w) ph = w->WindowHandle().p.contentView; if (!d->AttachEvent) { d->AttachEvent = true; OnCreate(); } } else { LgiAssert(0); } if (!p->Children.HasItem(this)) { p->Children.Add(this); OnAttach(); } return true; } bool GView::Attach(GViewI *parent) { if (_Attach(parent)) { if (d->Parent && !d->Parent->HasView(this)) d->Parent->AddView(this); d->Parent->OnChildrenChanged(this, true); return true; } LgiTrace("%s:%i - Attaching '%s' failed.\n", _FL, GetClass()); return false; } void GView::_Delete() { - LAutoPool Pool; + // LAutoPool Pool; if (_Over == this) _Over = 0; if (_Capturing == this) _Capturing = 0; if (LgiApp && LgiApp->AppWnd == this) { LgiApp->AppWnd = 0; } SetPulse(); Pos.ZOff(-1, -1); GViewI *c; auto it = Children.begin(); while ((c = *it)) { GViewI *p = c->GetParent(); if (p != (GViewI*)this) { printf("Error: GView::_Delete, child not attached correctly: %p(%s) Parent: %p(%s)\n", c, c->Name(), c->GetParent(), c->GetParent() ? c->GetParent()->Name() : ""); Children.Delete(it); } DeleteObj(c); } Detach(); } bool GView::Detach() { - LAutoPool Pool; + // LAutoPool Pool; bool Status = false; // Detach view if (_Window) { GWindow *Wnd = dynamic_cast(_Window); if (Wnd) Wnd->SetFocus(this, GWindow::ViewDelete); _Window = NULL; } if (d->Parent) { // Remove the view from the parent int D = 0; while (d->Parent->HasView(this)) { d->Parent->DelView(this); D++; } if (D > 1) { printf("%s:%i - Error: View %s(%p) was in %s(%p) list %i times.\n", _FL, GetClass(), this, d->Parent->GetClass(), d->Parent, D); } d->Parent->OnChildrenChanged(this, false); d->Parent = NULL; } Status = true; return Status; } //////////////////////////////// uint32 CursorData[] = { 0x02020202, 0x02020201, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020102, 0x02020202, 0x02020202, 0x01010101, 0x01010101, 0x01010101, 0x02020202, 0x02020202, 0x02010101, 0x02010101, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02010102, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020102, 0x01020202, 0x02020202, 0x02020202, 0x02020202, 0x01010101, 0x01010101, 0x02020201, 0x02020202, 0x01010101, 0x01010101, 0x02020201, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020102, 0x02020202, 0x02020202, 0x02020202, 0x01020202, 0x02010101, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020201, 0x02020202, 0x02020202, 0x02020202, 0x02010102, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x01020202, 0x01010101, 0x02020202, 0x02020202, 0x02020101, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020101, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x01020202, 0x02020100, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02010001, 0x02020202, 0x02020202, 0x00000001, 0x00000000, 0x01000000, 0x02020202, 0x02020202, 0x01000001, 0x02010000, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x01000001, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020101, 0x01020202, 0x02020201, 0x02020202, 0x02020202, 0x00000102, 0x00000000, 0x02020201, 0x02020202, 0x00000001, 0x01000000, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02010001, 0x02020202, 0x02020202, 0x02020202, 0x01020202, 0x02010000, 0x02020202, 0x02020202, 0x02020202, 0x01020202, 0x02020100, 0x02020202, 0x02020202, 0x02020202, 0x01000001, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x00010102, 0x00000000, 0x02020101, 0x02020202, 0x02010001, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02010001, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x01020202, 0x02020100, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02010001, 0x02020202, 0x02020202, 0x00010001, 0x00010001, 0x01000001, 0x02020202, 0x02020202, 0x00010102, 0x02020101, 0x02020202, 0x02020202, 0x02020202, 0x01020202, 0x00000000, 0x02020201, 0x02020202, 0x02020202, 0x01020202, 0x02020100, 0x01020202, 0x02020100, 0x02020202, 0x02020202, 0x00010202, 0x00000000, 0x02020201, 0x02020202, 0x00000001, 0x02010000, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x01020202, 0x01000000, 0x02020202, 0x02020202, 0x02020202, 0x01020202, 0x02010000, 0x02020202, 0x02020202, 0x02020202, 0x00010202, 0x02010000, 0x02020202, 0x02020202, 0x02020202, 0x01000001, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x00000001, 0x00000000, 0x02010000, 0x02020202, 0x01000001, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x01000001, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x00010202, 0x02010000, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02010001, 0x02020202, 0x02020202, 0x01000102, 0x00000100, 0x02010000, 0x02020202, 0x02020202, 0x00010202, 0x02020201, 0x02020202, 0x02020202, 0x02020202, 0x00010202, 0x00000000, 0x02020100, 0x02020202, 0x02020202, 0x00010202, 0x02020100, 0x01020202, 0x02010000, 0x02020202, 0x02020202, 0x01020202, 0x00000000, 0x02020201, 0x02020202, 0x00000001, 0x02020100, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x00010202, 0x00000000, 0x02020201, 0x02020202, 0x02020202, 0x01020202, 0x02010000, 0x02020202, 0x02020202, 0x02020202, 0x00000102, 0x01000000, 0x02020202, 0x02020202, 0x02020202, 0x01000001, 0x02020202, 0x02020202, 0x02020202, 0x01020202, 0x00000000, 0x00010101, 0x01000000, 0x02020202, 0x00000001, 0x02020201, 0x02020202, 0x02020202, 0x02020202, 0x00000001, 0x02020201, 0x02020202, 0x02020202, 0x02020202, 0x00010202, 0x02010000, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02010001, 0x02020202, 0x02020202, 0x00010202, 0x00000001, 0x02020100, 0x02020202, 0x02020202, 0x00010202, 0x02020201, 0x02020202, 0x02020202, 0x02020202, 0x00000102, 0x00000000, 0x02010000, 0x02020202, 0x02020202, 0x00000102, 0x01010100, 0x01010101, 0x01000000, 0x02020202, 0x02020201, 0x00010202, 0x00000000, 0x02020201, 0x02020202, 0x00000001, 0x02010000, 0x02020202, 0x02020201, 0x02020202, 0x02020202, 0x01010102, 0x01010001, 0x02020101, 0x02020202, 0x02020202, 0x01020201, 0x02010000, 0x02020102, 0x02020202, 0x02020202, 0x01010101, 0x01010100, 0x02020201, 0x02020202, 0x02020202, 0x01000001, 0x02020101, 0x02020202, 0x02020202, 0x00010202, 0x01010000, 0x01020202, 0x00000001, 0x02020201, 0x00000001, 0x02020100, 0x02020202, 0x02020202, 0x02020202, 0x00000001, 0x02020100, 0x02020202, 0x02020202, 0x02020202, 0x00000102, 0x01000000, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02010001, 0x02020202, 0x02020202, 0x01020202, 0x00000000, 0x02020201, 0x02020202, 0x02020202, 0x00010202, 0x02020201, 0x02020202, 0x02020202, 0x02020202, 0x01010101, 0x01000001, 0x01010101, 0x02020202, 0x02020202, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x02020201, 0x02020101, 0x00000102, 0x00000100, 0x02020201, 0x02020202, 0x01000001, 0x01000000, 0x01020202, 0x02020201, 0x02020202, 0x02020202, 0x02020201, 0x02010001, 0x02010202, 0x02020202, 0x01020202, 0x01020201, 0x02010000, 0x02010102, 0x02020202, 0x02020202, 0x01020202, 0x02020100, 0x02020202, 0x02020202, 0x02020202, 0x00000001, 0x01010000, 0x02020101, 0x02020202, 0x00000102, 0x01000000, 0x02020202, 0x00000102, 0x02020100, 0x00000001, 0x02010000, 0x02020202, 0x02020202, 0x02020202, 0x00000001, 0x02010000, 0x02020202, 0x02020202, 0x02020202, 0x00000102, 0x01000000, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02010001, 0x02020202, 0x02020202, 0x02020202, 0x01000001, 0x02020202, 0x02020202, 0x02020202, 0x00010202, 0x02020201, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x01000001, 0x02020202, 0x02020202, 0x02020202, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x02020201, 0x02010001, 0x00000001, 0x00010201, 0x02020201, 0x02020202, 0x02010001, 0x00000001, 0x00010201, 0x02020201, 0x02020202, 0x01020202, 0x02020201, 0x02010001, 0x01010202, 0x02020202, 0x00010202, 0x01020201, 0x02010000, 0x01000102, 0x02020202, 0x02020202, 0x01020202, 0x02020100, 0x02020202, 0x02020202, 0x02010102, 0x00000001, 0x00000000, 0x02010000, 0x02020202, 0x00000102, 0x00000001, 0x02020201, 0x00010202, 0x02020100, 0x00000001, 0x01000000, 0x02020202, 0x02020202, 0x02020202, 0x00000001, 0x01000000, 0x02020202, 0x02020202, 0x02020202, 0x00000001, 0x00000000, 0x02020201, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02010001, 0x02020202, 0x02020202, 0x02020202, 0x01000001, 0x02020202, 0x02020202, 0x02020202, 0x00010202, 0x02020201, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x01000001, 0x02020202, 0x02020202, 0x02020202, 0x00000102, 0x01010100, 0x01010101, 0x01000000, 0x02020202, 0x01000001, 0x01000000, 0x01020202, 0x02020201, 0x02020202, 0x02020101, 0x00000102, 0x00000100, 0x02020201, 0x02020202, 0x00010202, 0x02020201, 0x02010001, 0x00010202, 0x02020201, 0x00000102, 0x01010101, 0x01010000, 0x00000101, 0x02020201, 0x01010101, 0x01010101, 0x01010100, 0x01010101, 0x02020201, 0x01000001, 0x00000001, 0x00000000, 0x02010000, 0x02020202, 0x00000001, 0x00000101, 0x02020100, 0x00010202, 0x02010000, 0x00000001, 0x00000000, 0x02020201, 0x02020202, 0x02020202, 0x00000001, 0x00000000, 0x02020201, 0x02020202, 0x02020202, 0x00000001, 0x00000000, 0x02020201, 0x02020202, 0x02020202, 0x01010102, 0x01010101, 0x01010001, 0x01010101, 0x02020101, 0x02020202, 0x01000001, 0x02020202, 0x02020202, 0x02020202, 0x00010202, 0x02020201, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x01000001, 0x02020202, 0x02020202, 0x02020202, 0x00010202, 0x02020100, 0x01020202, 0x02010000, 0x02020202, 0x00000001, 0x02010000, 0x02020202, 0x02020201, 0x02020202, 0x02020201, 0x00010202, 0x00000000, 0x02020201, 0x02020202, 0x00000102, 0x01010101, 0x01010001, 0x00010101, 0x02020100, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x02020100, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x02020201, 0x00000001, 0x00000000, 0x00000000, 0x02010000, 0x02020202, 0x01000001, 0x00010202, 0x02010000, 0x01020202, 0x02010000, 0x00000001, 0x00000000, 0x02020100, 0x02020202, 0x02020202, 0x00000001, 0x00000000, 0x02020100, 0x02020202, 0x02020202, 0x01010101, 0x01010100, 0x02020201, 0x02020202, 0x02020202, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x02010000, 0x02020202, 0x01000001, 0x02020202, 0x02020202, 0x02020202, 0x00010202, 0x02020201, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x01000001, 0x02020202, 0x02020202, 0x02020202, 0x01020202, 0x02020100, 0x01020202, 0x02020100, 0x02020202, 0x00000001, 0x02020100, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x01020202, 0x00000000, 0x02020201, 0x02020202, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x02010000, 0x00000102, 0x01010101, 0x01010000, 0x00000101, 0x02020201, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x02020201, 0x00000102, 0x00000000, 0x00000000, 0x02010000, 0x02020202, 0x01000001, 0x01020202, 0x01000000, 0x01020202, 0x02010000, 0x00000001, 0x00000000, 0x02010000, 0x02020202, 0x02020202, 0x00000001, 0x00000000, 0x02010000, 0x02020202, 0x02020202, 0x01020202, 0x02020100, 0x02020202, 0x02020202, 0x02020202, 0x01010102, 0x01010101, 0x01010001, 0x01010101, 0x02020101, 0x01020202, 0x00000000, 0x02020201, 0x02020202, 0x02020202, 0x00010202, 0x02020201, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x01000001, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020101, 0x01020202, 0x02020201, 0x02020202, 0x00000001, 0x02010000, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x00010202, 0x00000000, 0x02020201, 0x02020202, 0x00000102, 0x01010101, 0x01010001, 0x00010101, 0x02020100, 0x00010202, 0x01020201, 0x02010000, 0x01000102, 0x02020202, 0x01010101, 0x01010101, 0x01010100, 0x01010101, 0x02020201, 0x00010202, 0x00000000, 0x00000000, 0x02010000, 0x02020202, 0x01000001, 0x02020202, 0x00000001, 0x01020201, 0x02010000, 0x00000001, 0x01000000, 0x02010101, 0x02020202, 0x02020202, 0x00000001, 0x01000000, 0x02010101, 0x02020202, 0x02020202, 0x01020202, 0x02020100, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02010001, 0x02020202, 0x02020202, 0x00010202, 0x01000001, 0x02020100, 0x02020202, 0x02020202, 0x00010202, 0x02020201, 0x02020202, 0x02020202, 0x02020202, 0x01010101, 0x01000001, 0x01010101, 0x02020202, 0x02020202, 0x02020202, 0x02020102, 0x01020202, 0x02020202, 0x02020202, 0x00000001, 0x01000000, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x00000102, 0x00000000, 0x02020201, 0x02020202, 0x00010202, 0x02020201, 0x02010001, 0x00010202, 0x02020201, 0x01020202, 0x01020201, 0x02010000, 0x02010102, 0x02020202, 0x02020202, 0x01020202, 0x02020100, 0x02020202, 0x02020202, 0x01020202, 0x00000000, 0x00000000, 0x02010000, 0x02020202, 0x00000001, 0x02020201, 0x00000102, 0x00010100, 0x02010000, 0x00000001, 0x01000001, 0x01020202, 0x01010101, 0x01010101, 0x00000001, 0x01000001, 0x01020202, 0x01010101, 0x01010101, 0x01020202, 0x02020100, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02010001, 0x02020202, 0x02020202, 0x01000102, 0x01000001, 0x02010001, 0x02020202, 0x02020202, 0x00010202, 0x02020201, 0x02020202, 0x02020202, 0x02020202, 0x00000102, 0x00000000, 0x02010000, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x01010101, 0x01010101, 0x02020201, 0x02020202, 0x02020202, 0x02020202, 0x01010101, 0x01010101, 0x02020201, 0x02020202, 0x01020202, 0x02020201, 0x02010001, 0x01010202, 0x02020202, 0x02020202, 0x01020201, 0x02010000, 0x02020102, 0x02020202, 0x02020202, 0x01020202, 0x02020100, 0x02020202, 0x02020202, 0x02020202, 0x00000001, 0x00000000, 0x02020100, 0x02020202, 0x00000102, 0x02020201, 0x00010202, 0x00010000, 0x02020100, 0x01000001, 0x01000001, 0x01020202, 0x00000000, 0x01000000, 0x01000001, 0x01000001, 0x01020202, 0x00000000, 0x01000000, 0x01020202, 0x02020100, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02010001, 0x02020202, 0x02020202, 0x00010001, 0x00000000, 0x01000100, 0x02020202, 0x02020202, 0x00010202, 0x02020201, 0x02020202, 0x02020202, 0x02020202, 0x00010202, 0x00000000, 0x02020100, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020201, 0x02010001, 0x02010202, 0x02020202, 0x02020202, 0x01020202, 0x02010000, 0x02020202, 0x02020202, 0x02020202, 0x01010101, 0x01010100, 0x02020201, 0x02020202, 0x02020202, 0x00000102, 0x00000000, 0x02020201, 0x02020202, 0x00000102, 0x02020100, 0x01020202, 0x00000000, 0x02020100, 0x02010001, 0x00000102, 0x01020201, 0x01010000, 0x01000001, 0x02010001, 0x00000102, 0x01020201, 0x01010100, 0x01000001, 0x01020202, 0x02020100, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02010001, 0x02020202, 0x02020202, 0x00000001, 0x00000000, 0x01000000, 0x02020202, 0x02020202, 0x00010202, 0x02020201, 0x02020202, 0x02020202, 0x02020202, 0x01020202, 0x00000000, 0x02020201, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x01010102, 0x01010001, 0x02020101, 0x02020202, 0x02020202, 0x01020202, 0x02010000, 0x02020202, 0x02020202, 0x02020202, 0x00000102, 0x01000000, 0x02020202, 0x02020202, 0x02020202, 0x01010202, 0x01010101, 0x02020202, 0x02020202, 0x00010202, 0x01010000, 0x01020202, 0x00000001, 0x02020201, 0x02020101, 0x00000102, 0x01020201, 0x00000100, 0x01000100, 0x02020101, 0x00000102, 0x01020201, 0x01000100, 0x01000100, 0x01020202, 0x02020101, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02010001, 0x02020202, 0x02020202, 0x01010101, 0x01010101, 0x01010101, 0x02020202, 0x02020202, 0x00010102, 0x02020101, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x01000001, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x00010202, 0x00000000, 0x02020201, 0x02020202, 0x02020202, 0x01020202, 0x02010000, 0x02020202, 0x02020202, 0x02020202, 0x00010202, 0x02010000, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x01020202, 0x00000000, 0x00010101, 0x01000000, 0x02020202, 0x02020202, 0x00010202, 0x01020100, 0x00000100, 0x01000000, 0x02020202, 0x00010202, 0x01020100, 0x01000100, 0x01000100, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02010001, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x01000001, 0x02010000, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02010102, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x01020202, 0x01000000, 0x02020202, 0x02020202, 0x02020202, 0x01020202, 0x02010101, 0x02020202, 0x02020202, 0x02020202, 0x01020202, 0x02020100, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x00000001, 0x00000000, 0x02010000, 0x02020202, 0x02020202, 0x00010202, 0x01020100, 0x00000100, 0x01000100, 0x02020202, 0x00010202, 0x01020100, 0x01000100, 0x01000100, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02010001, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02010101, 0x02010101, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02010001, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020201, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x00010102, 0x00000000, 0x02020101, 0x02020202, 0x02020202, 0x01020202, 0x01020201, 0x01010000, 0x01000001, 0x02020202, 0x01020202, 0x01020201, 0x01000100, 0x01000100, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020102, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020102, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x01020202, 0x01010101, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x01020202, 0x00000000, 0x01000000, 0x02020202, 0x02020202, 0x01020202, 0x00000000, 0x01000000, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x01020202, 0x01010101, 0x01010101, 0x02020202, 0x02020202, 0x01020202, 0x01010101, 0x01010101, }; diff --git a/src/mac/cocoa/Lgi/GWidgets.mm b/src/mac/cocoa/Lgi/GWidgets.mm --- a/src/mac/cocoa/Lgi/GWidgets.mm +++ b/src/mac/cocoa/Lgi/GWidgets.mm @@ -1,354 +1,354 @@ /*hdr ** FILE: GWidgets.cpp ** AUTHOR: Matthew Allen ** DATE: 30/12/2006 ** DESCRIPTION: Mac dialog components ** ** Copyright (C) 2006 Matthew Allen ** fret@memecode.com */ #include #include #include "Lgi.h" #include "GSlider.h" #include "GBitmap.h" #include "GTableLayout.h" #include "GDisplayString.h" #include "GButton.h" /////////////////////////////////////////////////////////////////////////////////////////// #define GreyBackground() struct GDialogPriv { bool IsModal; int ModalStatus; int BtnId; GDialogPriv() { IsModal = false; ModalStatus = -1; BtnId = -1; } }; /////////////////////////////////////////////////////////////////////////////////////////// GDialog::GDialog() : ResObject(Res_Dialog) { d = new GDialogPriv; Name("Dialog"); _SetDynamic(false); } GDialog::~GDialog() { DeleteObj(d); } int GDialog::GetButtonId() { return d->BtnId; } int GDialog::OnNotify(GViewI *Ctrl, int Flags) { GButton *b = dynamic_cast(Ctrl); if (b) { d->BtnId = b->GetId(); if (d->IsModal) EndModal(); else EndModeless(); } return 0; } bool GDialog::IsModal() { return d->IsModal; } void GDialog::Quit(bool DontDelete) { if (d->IsModal) EndModal(0); else EndModeless(0); } void GDialog::OnPosChange() { if (Children.Length() == 1) { auto it = Children.begin(); GTableLayout *t = dynamic_cast((GViewI*)it); if (t) { GRect r = GetClient(); r.Size(GTableLayout::CellSpacing, GTableLayout::CellSpacing); t->SetPos(r); } } } bool GDialog::LoadFromResource(int Resource, char *TagList) { GAutoString n; GRect p; bool Status = GLgiRes::LoadFromResource(Resource, this, &p, &n, TagList); if (Status) { Name(n); SetPos(p); } return Status; } bool GDialog::OnRequestClose(bool OsClose) { if (d->IsModal) { EndModal(0); return false; } return true; } int GDialog::DoModal(OsView OverideParent) { d->ModalStatus = 0; if (Wnd && Attach(0)) { - LAutoPool Pool; + // LAutoPool Pool; GWindow *Owner = GetParent() ? GetParent()->GetWindow() : 0; if (Owner) { GRect Pr = Owner->GetPos(); GRect Mr = GetPos(); Mr.Offset( Pr.x1 + (Pr.X() - Mr.X()) / 2 - Mr.x1, Pr.y1 + (Pr.Y() - Mr.Y()) / 2 - Mr.y1); SetPos(Mr); Owner->SetChildDialog(this); } d->IsModal = true; AttachChildren(); Visible(true); NSApplication *app = LgiApp->Handle(); auto wnd = WindowHandle(); [app runModalForWindow:wnd]; if (Owner) Owner->SetChildDialog(NULL); GWindow::Visible(false); } return d->ModalStatus; } void GDialog::EndModal(int Code) { if (d->IsModal) { - LAutoPool Pool; + // LAutoPool Pool; d->IsModal = false; d->ModalStatus = Code; NSApplication *app = LgiApp->Handle(); [app stopModal]; } else { LgiAssert(0); } } int GDialog::DoModeless() { d->IsModal = false; if (Attach(0)) { AttachChildren(); Visible(true); } return 0; } void GDialog::EndModeless(int Code) { GWindow::Quit(Code); } extern GButton *FindDefault(GView *w); GMessage::Result GDialog::OnEvent(GMessage *Msg) { switch (Msg->Msg()) { case M_CLOSE: { printf("M_CLOSE received... Fixme!\n"); break; } } return GView::OnEvent(Msg); } /////////////////////////////////////////////////////////////////////////////////////////// GControl::GControl(OsView view) : GView(view) { Pos.ZOff(10, 10); } GControl::~GControl() { } GMessage::Result GControl::OnEvent(GMessage *Msg) { switch (Msg->Msg()) { } return 0; } GdcPt2 GControl::SizeOfStr(const char *Str) { int y = SysFont->GetHeight(); GdcPt2 Pt(0, 0); if (Str) { const char *e = 0; for (const char *s = Str; s && *s; s = e?e+1:0) { e = strchr(s, '\n'); size_t Len = e ? e-s : strlen(s); GDisplayString ds(SysFont, s, Len); Pt.x = MAX(Pt.x, ds.X()); Pt.y += y; } } return Pt; } ////////////////////////////////////////////////////////////////////////////////// // Slider control GSlider::GSlider(int id, int x, int y, int cx, int cy, const char *name, bool vert) : ResObject(Res_Slider) { SetId(id); GRect r(x, y, x+cx, y+cy); SetPos(r); Name(name); Vertical = vert; Min = Max = 0; Val = 0; SetTabStop(true); } GSlider::~GSlider() { } void GSlider::Value(int64 i) { if (i > Max) i = Max; if (i < Min) i = Min; if (i != Val) { Val = i; GViewI *n = GetNotify() ? GetNotify() : GetParent(); if (n) { n->OnNotify(this, (int)Val); } Invalidate(); } } int64 GSlider::Value() { return Val; } void GSlider::GetLimits(int64 &min, int64 &max) { min = Min; max = Max; } void GSlider::SetLimits(int64 min, int64 max) { Min = min; Max = max; } GMessage::Result GSlider::OnEvent(GMessage *Msg) { return GView::OnEvent(Msg); } void GSlider::OnPaint(GSurface *pDC) { pDC->Colour(L_MED); pDC->Rectangle(); GRect r = GetClient(); int y = r.Y() >> 1; r.y1 = y - 2; r.y2 = r.y1 + 3; r.x1 += 3; r.x2 -= 3; LgiWideBorder(pDC, r, DefaultSunkenEdge); if (Min <= Max) { int x = (int) (Val * r.X() / (Max-Min)); Thumb.ZOff(5, 9); Thumb.Offset(r.x1 + x - 3, y - 5); GRect b = Thumb; LgiWideBorder(pDC, b, DefaultRaisedEdge); pDC->Rectangle(&b); } } void GSlider::OnMouseClick(GMouse &m) { Capture(m.Down()); if (Thumb.Overlap(m.x, m.y)) { Tx = m.x - Thumb.x1; Ty = m.y - Thumb.y1; } } void GSlider::OnMouseMove(GMouse &m) { if (IsCapturing()) { int Rx = X() - 6; if (Rx > 0 && Max >= Min) { int x = m.x - Tx; int v = (int) (x * (Max-Min) / Rx); Value(v); } } } diff --git a/src/mac/cocoa/Lgi/GWindow.mm b/src/mac/cocoa/Lgi/GWindow.mm --- a/src/mac/cocoa/Lgi/GWindow.mm +++ b/src/mac/cocoa/Lgi/GWindow.mm @@ -1,1296 +1,1296 @@ #include #include "Lgi.h" #include "GDragAndDrop.h" #include "GToken.h" #include "GPopup.h" #include "GDisplayString.h" #include "LCocoaView.h" extern void NextTabStop(GViewI *v, int dir); extern void SetDefaultFocus(GViewI *v); #define DEBUG_KEYS 0 GRect LScreenFlip(GRect r) { GRect screen(0, 0, -1, -1); for (NSScreen *s in [NSScreen screens]) { GRect pos = s.frame; if (r.Overlap(&pos)) { screen = pos; break; } } if (screen.Valid()) { GRect 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; GView *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 GWindowPrivate { public: GWindow *Wnd; GDialog *ChildDlg; LMenu *EmptyMenu; GViewI *Focus; int Sx, Sy; GKey LastKey; GArray Hooks; uint64 LastMinimize; uint64 LastDragDrop; bool Dynamic; bool SnapToEdge; bool DeleteWhenDone; bool InitVisible; bool CloseRequestDone; bool Closing; GWindowPrivate(GWindow *wnd) { Focus = NULL; InitVisible = false; LastMinimize = 0; Wnd = wnd; LastDragDrop = 0; DeleteWhenDone = false; ChildDlg = 0; Sx = Sy = -1; Dynamic = true; SnapToEdge = false; EmptyMenu = 0; CloseRequestDone = false; Closing = false; } ~GWindowPrivate() { DeleteObj(EmptyMenu); } ssize_t GetHookIndex(GView *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; + auto wnd = Wnd->WindowHandle(); - Wnd->Pos = wnd.frame; + Wnd->Pos = wnd.p.frame; Wnd->OnPosChange(); - wnd.contentView.needsLayout = YES; + wnd.p.contentView.needsLayout = YES; } }; @implementation LNsWindow - (id)init:(GWindowPrivate*)priv Frame:(NSRect)rc { NSUInteger windowStyleMask = NSTitledWindowMask | NSResizableWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask; if ((self = [super initWithContentRect:rc styleMask:windowStyleMask backing:NSBackingStoreBuffered defer:NO ]) != nil) { self.d = priv; self.contentView = [[LCocoaView alloc] init:priv->Wnd]; [self makeFirstResponder:self.contentView]; self.acceptsMouseMovedEvents = true; self.ignoresMouseEvents = false; printf("LNsWindow.init\n"); } return self; } - (void)dealloc { if (self.d) self.d->Wnd->OnDealloc(); - LAutoPool Ap; + // LAutoPool Ap; LCocoaView *cv = objc_dynamic_cast(LCocoaView, self.contentView); cv.w = NULL; - [cv release]; + // [cv release]; self.contentView = NULL; - [super dealloc]; + // [super dealloc]; printf("LNsWindow.dealloc.\n"); } - (GWindow*)getWindow { return self.d ? self.d->Wnd : nil; } - (BOOL)canBecomeKeyWindow { return YES; } @end @implementation LWindowDelegate - (id)init { if ((self = [super init]) != nil) { } return self; } - (void)dealloc { - [super 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) { if (w.d) { //printf("%s:%i - windowWillClose(%s) w.d->Closing=%i\n", // _FL, w.d->Wnd->GetClass(), w.d->Closing); if (w.d->Closing) { auto gwnd = w.d->Wnd; w.d = NULL; delete gwnd; } else { w.d->Wnd->Quit(); } } // else printf("%s:%i - w.d is NULL\n", _FL); } } - (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!" +// #error "NO ARC!" #endif GWindow::GWindow(OsWindow wnd) : GView(NULL) { d = new GWindowPrivate(this); _QuitOnClose = false; Wnd = NULL; Menu = 0; _Default = 0; _Window = this; WndFlags |= GWND_CREATE; GView::Visible(false); _Lock = new LMutex; - LAutoPool Pool; + // LAutoPool Pool; GRect pos(200, 200, 200, 200); NSRect frame = pos; - if (wnd) - Wnd = wnd; - else - Wnd.p = [[LNsWindow alloc] init:d Frame:frame]; + //if (&wnd != NULL && wnd) + // Wnd = wnd; + //else + Wnd.p = [[LNsWindow alloc] init:d Frame:frame]; if (Wnd) { if (!Delegate) Delegate = [[LWindowDelegate alloc] init]; //[Wnd.p makeKeyAndOrderFront:NSApp]; Wnd.p.delegate = Delegate; } } GWindow::~GWindow() { - LAutoPool Pool; + //LAutoPool Pool; if (LgiApp->AppWnd == this) { LgiApp->AppWnd = 0; } _Delete(); if (Wnd) { LCocoaView *cv = objc_dynamic_cast(LCocoaView, Wnd.p.contentView); if (cv) cv.w = NULL; LNsWindow *w = objc_dynamic_cast(LNsWindow, Wnd.p); if (w) w.d = NULL; Wnd.p.delegate = nil; if (!d->Closing) [Wnd.p close]; - [Wnd.p release]; + //[Wnd.p release]; Wnd = nil; } DeleteObj(Menu); DeleteObj(d); DeleteObj(_Lock); } NSView *GWindow::Handle() { if (Wnd.p != nil) return Wnd.p.contentView; //Wnd.p.contentViewController.view; return NULL; } bool &GWindow::CloseRequestDone() { return d->CloseRequestDone; } bool GWindow::SetIcon(const char *FileName) { return false; } GViewI *GWindow::GetFocus() { return d->Focus; } void GWindow::SetFocus(GViewI *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) { GView *v = d->Focus->GetGView(); if (v) v->WndFlags &= ~GWF_FOCUS; d->Focus->OnFocus(false); d->Focus->Invalidate(); #if DEBUG_SETFOCUS GAutoString _foc = DescribeView(d->Focus); LgiTrace(".....defocus: %s\n", _foc.Get()); #endif } d->Focus = ctrl; if (d->Focus) { GView *v = d->Focus->GetGView(); if (v) v->WndFlags |= GWF_FOCUS; d->Focus->OnFocus(true); d->Focus->Invalidate(); #if DEBUG_SETFOCUS GAutoString _set = DescribeView(d->Focus); LgiTrace("GWindow::SetFocus(%s, %s) focusing\n", _set.Get(), TypeName); #endif } break; } case LoseFocus: { if (ctrl == d->Focus) { GView *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 GAutoString _ctrl = DescribeView(ctrl); GAutoString _foc = DescribeView(d->Focus); LgiTrace("GWindow::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("GWindow::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("GWindow::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 GWindow::SetDragHandlers(bool On) { #if 0 if (Wnd && _View) SetAutomaticControlDragTrackingEnabledForWindow(Wnd, On); #endif } void GWindow::Quit(bool DontDelete) { - LAutoPool Pool; + //LAutoPool Pool; if (_QuitOnClose) { _QuitOnClose = false; LgiCloseApp(); } if (d) d->DeleteWhenDone = !DontDelete; if (Wnd) { SetDragHandlers(false); if (d->Closing) { PostEvent(M_DESTROY); } else { d->Closing = true; PostEvent(M_CLOSE); } } } void GWindow::SetChildDialog(GDialog *Dlg) { d->ChildDlg = Dlg; } bool GWindow::GetSnapToEdge() { return d->SnapToEdge; } void GWindow::SetSnapToEdge(bool s) { d->SnapToEdge = s; } void GWindow::OnFrontSwitch(bool b) { } bool GWindow::Visible() { // LAutoPool Pool; if (!Wnd) return false; return [Wnd.p isVisible]; } void GWindow::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]; } } void GWindow::_SetDynamic(bool i) { d->Dynamic = i; } void GWindow::_OnViewDelete() { if (d->Dynamic) { delete this; } } void GWindow::SetAlwaysOnTop(bool b) { } bool GWindow::PostEvent(int Event, GMessage::Param a, GMessage::Param b) { return LgiApp->PostEvent(this, Event, a, b); } bool GWindow::Attach(GViewI *p) { bool Status = false; if (Wnd) { if (GBase::Name()) Name(GBase::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 GWindow::OnRequestClose(bool OsShuttingDown) { if (GetQuitOnClose()) { LgiCloseApp(); } return GView::OnRequestClose(OsShuttingDown); } bool GWindow::HandleViewMouse(GView *v, GMouse &m) { #ifdef MAC if (m.Down()) { #if 0 GAutoPtr it(IterateViews()); for (GViewI *n = it->Last(); n; n = it->Prev()) { GPopup *p = dynamic_cast(n); if (p) { GRect pos = p->GetPos(); if (!pos.Overlap(m.x, m.y)) { printf("Closing Popup, m=%i,%i not over pos=%s\n", m.x, m.y, pos.GetStr()); p->Visible(false); } } else break; } #else bool ParentPopup = false; GViewI *p = m.Target; while (p && p->GetParent()) { if (dynamic_cast(p)) { ParentPopup = true; break; } p = p->GetParent(); } if (!ParentPopup) { for (int i=0; iVisible()) pu->Visible(false); } } #endif if (!m.IsMove() && LgiApp) { GMouseHook *mh = LgiApp->GetMouseHook(); if (mh) mh->TrackClick(v); } } #endif for (int i=0; iHooks.Length(); i++) { if (d->Hooks[i].Flags & GMouseEvents) { if (!d->Hooks[i].Target->OnViewMouse(v, m)) { return false; } } } return true; } bool GWindow::HandleViewKey(GView *v, GKey &k) { bool Status = false; GViewI *Ctrl = NULL; if (!v && d->Focus) v = d->Focus->GetGView(); if (!v) return false; // Give key to popups if (LgiApp && LgiApp->GetMouseHook() && LgiApp->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 & GKeyEvents) { 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 printf("View 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 Status = true; goto AllDone; } // Window didn't want the key... switch (k.c16) { case LK_RETURN: { Ctrl = _Default; break; } case LK_ESCAPE: { Ctrl = FindControl(IDCANCEL); break; } } 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 if (d->CloseRequestDone || OnRequestClose(false)) { if (d) d->CloseRequestDone = true; delete this; return true; } } AllDone: d->LastKey = k; return Status; } void GWindow::Raise() { if (Wnd) { // BringToFront(Wnd); } } GWindowZoom GWindow::GetZoom() { if (Wnd) { #if 0 bool c = IsWindowCollapsed(Wnd); // printf("IsWindowCollapsed=%i\n", c); if (c) return GZoomMin; c = IsWindowInStandardState(Wnd, NULL, NULL); // printf("IsWindowInStandardState=%i\n", c); if (!c) return GZoomMax; #endif } return GZoomNormal; } void GWindow::SetZoom(GWindowZoom i) { #if 0 OSStatus e = 0; switch (i) { case GZoomMin: { e = CollapseWindow(Wnd, true); if (e) printf("%s:%i - CollapseWindow failed with %i\n", _FL, (int)e); // else printf("GZoomMin ok.\n"); break; } default: case GZoomNormal: { e = CollapseWindow(Wnd, false); if (e) printf("%s:%i - [Un]CollapseWindow failed with %i\n", _FL, (int)e); // else printf("GZoomNormal ok.\n"); break; } } #endif } GViewI *GWindow::GetDefault() { return _Default; } void GWindow::SetDefault(GViewI *v) { if (v && v->GetWindow() == (GViewI*)this) { if (_Default != v) { GViewI *Old = _Default; _Default = v; if (Old) Old->Invalidate(); if (_Default) _Default->Invalidate(); } } else { _Default = 0; } } bool GWindow::Name(const char *n) { - LAutoPool Pool; + //LAutoPool Pool; bool Status = GBase::Name(n); if (Wnd) { NSString *ns = [NSString stringWithCString:n encoding:NSUTF8StringEncoding]; Wnd.p.title = ns; //[ns release]; } return Status; } char *GWindow::Name() { return GBase::Name(); } GRect &GWindow::GetClient(bool ClientSpace) { // LAutoPool Pool; static GRect r; if (Wnd) { r = Wnd.p.contentView.frame; if (ClientSpace) r.Offset(-r.x1, -r.y1); } else { r.ZOff(-1, -1); } return r; } bool GWindow::SerializeState(GDom *Store, const char *FieldName, bool Load) { if (!Store || !FieldName) return false; if (Load) { GVariant v; if (Store->GetValue(FieldName, v) && v.Str()) { GRect Position(0, 0, -1, -1); GWindowZoom State = GZoomNormal; GToken t(v.Str(), ";"); for (int i=0; i #import "LCocoaView.h" #include "GEventTargetThread.h" #define Check() if (!self.w) return static int LCocoaView_Count = 0; @implementation LCocoaMsg - (id)init:(GViewI*)View msg:(int)Msg a:(GMessage::Param)A b:(GMessage::Param)B { if ((self = [super init]) != nil) { self.v = View; self.m = Msg; self.a = A; self.b = B; } return self; } @end @implementation LCocoaAssert - (id)init:(GString)m { if ((self = [super init]) != nil) { self.msg = m; } return self; } @end @implementation LCocoaView { NSTrackingArea *tracking; } - (id)init:(GView*)wnd { - LAutoPool Pool; + // LAutoPool Pool; LCocoaView_Count++; if ((self = [super initWithFrame:wnd->GetPos()]) != nil) { printf("LCocoaView.alloc... (%i, %s)\n", LCocoaView_Count, wnd->GetClass()); self.w = wnd; self.WndClass = wnd->GetClass(); NSRect r = {{0, 0},{4000,2000}}; self->tracking = [[NSTrackingArea alloc] initWithRect:r options:NSTrackingMouseEnteredAndExited | NSTrackingActiveAlways | NSTrackingMouseMoved owner:self userInfo:nil]; [self addTrackingArea:self->tracking]; [self setAutoresizingMask:NSViewNotSizable]; [self setTranslatesAutoresizingMaskIntoConstraints:YES]; } return self; } - (void)dealloc { - LAutoPool Pool; + // LAutoPool Pool; printf("LCocoaView.dealloc... (%i, %s)\n", LCocoaView_Count-1, self.WndClass.Get()); if (self->tracking) { - [self->tracking release]; + // [self->tracking release]; self->tracking = NULL; } self.w = nil; - [super dealloc]; + // [super dealloc]; LCocoaView_Count--; } - (void)drawRect:(NSRect)dirtyRect { Check(); - LAutoPool Pool; + // LAutoPool Pool; GScreenDC Dc(self.w); self.w->_Paint(&Dc); } - (void)layout { } - (void)mouseDown:(NSEvent*)ev { - LAutoPool Pool; + // LAutoPool Pool; Check(); GMouse m(self.w); m.SetFromEvent(ev, self); m.Target->GetGView()->_Mouse(m, false); } - (void)mouseUp:(NSEvent*)ev { - LAutoPool Pool; + // LAutoPool Pool; Check(); GMouse m(self.w); m.SetFromEvent(ev, self); m.Target->GetGView()->_Mouse(m, false); } - (void)rightMouseDown:(NSEvent*)ev { - LAutoPool Pool; + // LAutoPool Pool; Check(); GMouse m(self.w); m.SetFromEvent(ev, self); m.Target->GetGView()->_Mouse(m, false); } - (void)rightMouseUp:(NSEvent*)ev { - LAutoPool Pool; + // LAutoPool Pool; Check(); GMouse m(self.w); m.SetFromEvent(ev, self); m.Target->GetGView()->_Mouse(m, false); } - (void)mouseMoved:(NSEvent*)ev { - LAutoPool Pool; + // LAutoPool Pool; Check(); GMouse m(self.w); m.SetFromEvent(ev, self); m.Target->GetGView()->_Mouse(m, true); } - (void)mouseDragged:(NSEvent*)ev { - LAutoPool Pool; + // LAutoPool Pool; Check(); GMouse m(self.w); m.SetFromEvent(ev, self); m.Target->GetGView()->_Mouse(m, true); } - (void)scrollWheel:(NSEvent*)ev { - LAutoPool Pool; + // LAutoPool Pool; Check(); auto r = self.frame; auto pt = ev.locationInWindow; int x = (int)pt.x; int y = (int)(r.size.height - pt.y); auto t = self.w->WindowFromPoint(x, y); if (!t) return; static CGFloat total = 0.0; auto deltaY = ev.scrollingDeltaY; total += deltaY; // int px = SysFont->GetHeight(); int px = 1; int lines = (int) (total / px); // printf("Scroll %g, lines=%i\n", deltaY, lines); if (lines) { total -= lines * px; t->OnMouseWheel(-lines); } } GKey KeyEvent(NSEvent *ev) { - LAutoPool Pool; + // LAutoPool Pool; GKey k; GString s = [ev.characters UTF8String]; auto mod = ev.modifierFlags; #if 0 bool capsLock = (mod & NSEventModifierFlagCapsLock) != 0; bool shift = (mod & NSEventModifierFlagShift) != 0; bool ctrl = (mod & NSEventModifierFlagControl) != 0; bool numPad = (mod & NSEventModifierFlagNumericPad) != 0; bool help = (mod & NSEventModifierFlagHelp) != 0; #endif bool option = (mod & NSEventModifierFlagOption) != 0; bool cmd = (mod & NSEventModifierFlagCommand) != 0; bool func = (mod & NSEventModifierFlagFunction) != 0; uint8_t *p = (uint8_t*) s.Get(); ssize_t len = s.Length(); uint32_t u32 = LgiUtf8To32(p, len); k.c16 = u32; k.vkey = u32; k.SetModifer((uint32_t)mod); k.IsChar = !func && !cmd && !option && ( k.c16 >= ' ' || k.vkey == LK_RETURN || k.vkey == LK_TAB || k.vkey == LK_BACKSPACE ) && k.vkey != LK_DELETE; return k; } - (void)keyDown:(NSEvent*)event { - LAutoPool Pool; + // LAutoPool Pool; Check(); GKey k = KeyEvent(event); k.Down(true); GWindow *wnd = dynamic_cast(self.w); if (wnd) wnd->HandleViewKey(NULL, k); else self.w->OnKey(k); } - (void)keyUp:(NSEvent*)event { - LAutoPool Pool; + // LAutoPool Pool; Check(); GKey k = KeyEvent(event); GWindow *wnd = dynamic_cast(self.w); if (wnd) wnd->HandleViewKey(NULL, k); else self.w->OnKey(k); } - (void)userEvent:(LCocoaMsg*)msg { - LAutoPool Pool; + // LAutoPool Pool; if (GView::LockHandler(msg.v, GView::OpExists)) { GMessage Msg(msg.m, msg.a, msg.b); // LgiTrace("%s::OnEvent %i,%i,%i\n", msg.v->GetClass(), msg.m, msg.a, msg.b); msg.v->OnEvent(&Msg); } - [msg release]; + // [msg release]; } - (BOOL) acceptsFirstResponder { return YES; } @end diff --git a/src/mac/cocoa/Lgi/LMenu.mm b/src/mac/cocoa/Lgi/LMenu.mm --- a/src/mac/cocoa/Lgi/LMenu.mm +++ b/src/mac/cocoa/Lgi/LMenu.mm @@ -1,1350 +1,1350 @@ /*hdr ** FILE: GuiMenu.cpp ** AUTHOR: Matthew Allen ** DATE: 18/7/98 ** DESCRIPTION: Gui menu system ** ** Copyright (C) 1998, Matthew Allen ** fret@memecode.com */ #include #include #include #include "Lgi.h" #include "GToken.h" #include "GDisplayString.h" #define DEBUG_INFO 0 @interface LNSMenuItem : NSMenuItem { } @property LMenuItem* item; - (id)init:(LMenuItem*)it; - (void)activate; - (BOOL)worksWhenModal; @end @implementation LNSMenuItem - (id)init:(LMenuItem*)it { if ((self = [super init]) != nil) { self.item = it; [self setTarget:self]; self.action = @selector(activate); } return self; } - (BOOL)worksWhenModal { return YES; } - (void)activate { self.item->OnActivate(self.item); } @end struct LShortcut { NSString *Str; public: NSString *Key; NSEventModifierFlags Mod; LShortcut(const char *s) { Key = @""; Str = nil; Mod = 0; auto Keys = GString(s).SplitDelimit("+-"); if (Keys.Length() <= 0) return; for (auto k: Keys) { if (stricmp(k, "CtrlCmd") == 0 || stricmp(k, "AltCmd") == 0 || stricmp(k, "Cmd") == 0 || stricmp(k, "Command") == 0) { Mod |= NSEventModifierFlagCommand; } else if (stricmp(k, "Ctrl") == 0 || stricmp(k, "Control") == 0) { Mod |= NSEventModifierFlagControl; } else if (stricmp(k, "Alt") == 0 || stricmp(k, "Option") == 0) { Mod |= NSEventModifierFlagOption; } else if (stricmp(k, "Shift") == 0) { Mod |= NSEventModifierFlagShift; } else if (stricmp(k, "Del") == 0 || stricmp(k, "Delete") == 0) { unichar s[] = {NSDeleteCharacter}; Key = Str = [[NSString alloc] initWithCharacters:s length:1]; } else if (stricmp(k, "Ins") == 0 || stricmp(k, "Insert") == 0) { unichar s[] = {NSInsertFunctionKey}; Key = Str = [[NSString alloc] initWithCharacters:s length:1]; } else if (stricmp(k, "Home") == 0) { unichar s[] = {NSHomeFunctionKey}; Key = Str = [[NSString alloc] initWithCharacters:s length:1]; } else if (stricmp(k, "End") == 0) { unichar s[] = {NSEndFunctionKey}; Key = Str = [[NSString alloc] initWithCharacters:s length:1]; } else if (stricmp(k, "PageUp") == 0) { unichar s[] = {NSPageUpFunctionKey}; Key = Str = [[NSString alloc] initWithCharacters:s length:1]; } else if (stricmp(k, "PageDown") == 0) { unichar s[] = {NSPageDownFunctionKey}; Key = Str = [[NSString alloc] initWithCharacters:s length:1]; } else if (stricmp(k, "Backspace") == 0) { unichar s[] = {NSBackspaceCharacter}; Key = Str = [[NSString alloc] initWithCharacters:s length:1]; } else if (stricmp(k, "Space") == 0) { Key = @" "; } else if (k[0] == 'F' && isdigit(k[1])) { int64 index = k.Strip("F").Int(); unichar s[] = {(unichar)(NSF1FunctionKey + index - 1)}; Key = Str = [[NSString alloc] initWithCharacters:s length:1]; } else if (isalpha(k[0])) { Key = Str = GString(k).Lower().NsStr(); } else if (isdigit(k[0])) { Key = Str = GString(k).NsStr(); } else if (strchr(",.", k(0))) { unichar s[] = {(unichar)k(0)}; Key = Str = [[NSString alloc] initWithCharacters:s length:1]; } else { printf("%s:%i - Unhandled shortcut token '%s'\n", _FL, k.Get()); } } } ~LShortcut() { - if (Str) [Str release]; + // if (Str) [Str release]; } }; /////////////////////////////////////////////////////////////////////////////////////////////// LSubMenu::LSubMenu(const char *name, bool Popup) { Menu = 0; Parent = 0; Info = NULL; GBase::Name(name); Info.p = [[NSMenu alloc] init]; [Info.p setAutoenablesItems:NO]; } LSubMenu::~LSubMenu() { while (Items.Length()) { LMenuItem *i = Items[0]; if (i->Parent != this) { i->Parent = NULL; Items.Delete(i); } delete i; } if (Info) { - [Info.p release]; + // [Info.p release]; Info = NULL; } } void LSubMenu::OnAttach(bool Attach) { for (auto i: Items) { i->OnAttach(Attach); } if (Attach && this != Menu && Parent && Parent->Parent) { } } size_t LSubMenu::Length() { return Items.Length(); } LMenuItem *LSubMenu::ItemAt(int Id) { return Items.ItemAt(Id); } LMenuItem *LSubMenu::AppendItem(const char *Str, int Id, bool Enabled, int Where, const char *Shortcut) { LMenuItem *i = new LMenuItem(Menu, this, Str, Id, Where, Shortcut); if (!i || !Info) return NULL; Items.Insert(i, Where); auto Index = Items.IndexOf(i); // auto Max = Info.p.numberOfItems; GString s(i->GBase::Name()); auto name = s.NsStr(); LShortcut sc(Shortcut); i->Info.p = [[LNSMenuItem alloc] init:i]; if (!i->Info) { Items.Delete(i); delete i; return NULL; } [i->Info.p setTitle:name]; i->Info.p.keyEquivalent = sc.Key; i->Info.p.keyEquivalentModifierMask = sc.Mod; i->Id(Id); i->Enabled(Enabled); [Info.p insertItem:i->Info atIndex:Index]; return i; } LMenuItem *LSubMenu::AppendSeparator(int Where) { LMenuItem *i = new LMenuItem; if (i) { i->Parent = this; i->Menu = Menu; i->Id(-2); Items.Insert(i, Where); if (Info) { auto Index = Items.IndexOf(i); // auto Max = Info.p.numberOfItems; // printf("Adding ----- @ %i, %i\n", (int)Index, (int)Max); i->Info = [NSMenuItem separatorItem]; [Info.p insertItem:i->Info atIndex:Index]; } else { printf("%s:%i - No menu to attach item to.\n", _FL); } return i; } return 0; } LSubMenu *LSubMenu::AppendSub(const char *Str, int Where) { LMenuItem *i = new LMenuItem; if (i && Str) { i->Parent = this; i->Menu = Menu; i->Id(-1); Items.Insert(i, Where); if (Info) { i->Child = new LSubMenu(Str); if (i->Child) { i->Child->Parent = i; i->Child->Menu = Menu; i->Child->Window = Window; i->Info.p = [[NSMenuItem alloc] init]; LgiAssert(i->Info); i->Name(Str); GString s(i->GBase::Name()); [i->Child->Info.p setTitle:s.NsStr()]; [i->Info.p setSubmenu:i->Child->Info.p]; auto Index = Items.IndexOf(i); [Info.p insertItem:i->Info atIndex:Index]; } } else { printf("%s:%i - No menu to attach item to.\n", __FILE__, __LINE__); } return i->Child; } return 0; } void LSubMenu::Empty() { while (Items[0]) { if (!RemoveItem(Items[0])) break; // Otherwise we'll get an infinite loop. } } bool LSubMenu::RemoveItem(int i) { LMenuItem *Item = Items[i]; if (Item) { return Item->Remove(); } return false; } bool LSubMenu::RemoveItem(LMenuItem *Item) { if (Item && Items.HasItem(Item)) { return Item->Remove(); } return false; } bool LSubMenu::OnKey(GKey &k) { return false; } #if 0 bool IsOverMenu(XEvent *e) { if (e->xany.type == ButtonPress OR e->xany.type == ButtonRelease) { QWidget *q = QWidget::Find(e->xany.window); if (q) { QPopup *m = 0; for (; q; q = q->parentWidget()) { if (m = dynamic_cast(q)) { break; } } if (m) { GRect gr = m->geometry(); return gr.Overlap ( e->xbutton.x_root, e->xbutton.y_root ); } } } return false; } #endif void LSubMenu::OnActivate(LMenuItem *item) { if (!item) return; if (FloatResult) *FloatResult = item->Id(); else if (Parent) Parent->OnActivate(item); else LgiAssert(!"Should have a float result OR a parent.."); } int LSubMenu::Float(GView *From, int x, int y, int Btns) { GdcPt2 p(x, y); OsView v = nil; auto w = From ? From->GetWindow() : NULL; if (w) { v = w->Handle(); w->PointToView(p); p = w->Flip(p); } FloatResult.Reset(new int(0)); auto item = Items[0]; auto menuitem = item->Info.p; auto en = menuitem.enabled; NSPoint loc = {(double)p.x, (double)p.y}; [Info.p popUpMenuPositioningItem:nil atLocation:loc inView:v]; return FloatResult ? *FloatResult : 0; } LSubMenu *LSubMenu::FindSubMenu(int Id) { for (auto i: Items) { LSubMenu *Sub = i->Sub(); if (i->Id() == Id) { return Sub; } else if (Sub) { LSubMenu *m = Sub->FindSubMenu(Id); if (m) { return m; } } } return 0; } LMenuItem *LSubMenu::FindItem(int Id) { for (auto i: Items) { LSubMenu *Sub = i->Sub(); if (i->Id() == Id) { return i; } else if (Sub) { i = Sub->FindItem(Id); if (i) { return i; } } } return 0; } /////////////////////////////////////////////////////////////////////////////////////////////// class LMenuItemPrivate { public: GString Shortcut; }; LMenuItem::LMenuItem() { d = new LMenuItemPrivate(); Menu = NULL; Info = NULL; Child = NULL; Parent = NULL; _Icon = -1; _Id = 0; _Flags = 0; } LMenuItem::LMenuItem(LMenu *m, LSubMenu *p, const char *Str, int Id, int Pos, const char *Shortcut) { d = new LMenuItemPrivate(); GBase::Name(Str); Menu = m; Parent = p; Info = NULL; Child = NULL; _Icon = -1; _Id = Id; _Flags = 0; d->Shortcut = Shortcut; Name(Str); } LMenuItem::~LMenuItem() { if (Parent) { Parent->Items.Delete(this); Parent = NULL; } DeleteObj(Child); DeleteObj(d); } void LMenuItem::OnActivate(LMenuItem *item) { if (Parent) Parent->OnActivate(item); else LgiAssert(!"Should have a parent."); } void LMenuItem::OnAttach(bool Attach) { if (Attach) { if (_Icon >= 0) { Icon(_Icon); } if (Sub()) { Sub()->OnAttach(Attach); } } } // the following 3 functions paint the menus according the to // windows standard. but also allow for correct drawing of menuitem // icons. some implementations of windows force the program back // to the 8-bit palette when specifying the icon graphic, thus removing // control over the colours displayed. these functions remove that // limitation and also provide the application the ability to override // the default painting behaviour if desired. void LMenuItem::_Measure(GdcPt2 &Size) { GFont *Font = Menu && Menu->GetFont() ? Menu->GetFont() : SysFont; bool BaseMenu = Parent == Menu; // true if attached to a windows menu // else is a submenu int Ht = Font->GetHeight(); // int IconX = BaseMenu ? ((24-Ht)/2)-Ht : 20; int IconX = BaseMenu ? 2 : 16; if (Separator()) { Size.x = 8; Size.y = 8; } else { // remove '&' chars for string measurement char Str[256]; char *n = Name(), *i = n, *o = Str; while (i && *i) { if (*i == '&') { if (i[1] == '&') { *o++ = *i++; } } else { *o++ = *i; } i++; } *o++ = 0; // check for accelerators char *Tab = strchr(Str, '\t'); if (Tab) { // string with accel int Mx, Tx; GDisplayString ds(Font, Str, Tab-Str); Mx = ds.X(); GDisplayString ds2(Font, Tab + 1); Tx = ds2.X(); Size.x = IconX + 32 + Mx + Tx; } else { // normal string GDisplayString ds(Font, Str); Size.x = IconX + ds.X() + 4; } if (!BaseMenu) { // leave room for child pointer Size.x += Child ? 8 : 0; } Size.y = MAX(IconX, Ht+2); } } #define Time(a, b) ((double)(b - a) / 1000) void LMenuItem::_PaintText(GSurface *pDC, int x, int y, int Width) { char *n = Name(); if (n) { GFont *Font = Menu && Menu->GetFont() ? Menu->GetFont() : SysFont; bool Underline = false; char *e = 0; for (char *s=n; s && *s; s = *e ? e : 0) { switch (*s) { case '&': { if (s[1] == '&') { e = s + 2; GDisplayString d(Font, "&"); d.Draw(pDC, x, y, 0); x += d.X(); } else { Underline = true; e = s + 1; } break; } case '\t': { GDisplayString ds(Font, e + 1); x = Width - ds.X() - 8; e = s + 1; break; } default: { if (Underline) { LgiNextUtf8(e); } else { for (e = s; *e; e++) { if (*e == '\t') break; if (*e == '&') break; } } ptrdiff_t Len = e - s; if (Len > 0) { // paint text till that point GDisplayString d(Font, s, Len); d.Draw(pDC, x, y, 0); if (Underline) { GDisplayString ds(Font, s, 1); int UnderX = ds.X(); int Ascent = (int)ceil(Font->Ascent()); pDC->Colour(Font->Fore()); pDC->Line(x, y+Ascent+1, x+MAX(UnderX-2, 1), y+Ascent+1); Underline = false; } x += d.X(); } break; } } } } } void LMenuItem::_Paint(GSurface *pDC, int Flags) { bool BaseMenu = Parent == Menu; int IconX = BaseMenu ? 5 : 20; bool Selected = TestFlag(Flags, ODS_SELECTED); bool Disabled = TestFlag(Flags, ODS_DISABLED); bool Checked = TestFlag(Flags, ODS_CHECKED); #if defined(WIN32) || defined(MAC) GRect r(0, 0, pDC->X()-1, pDC->Y()-1); #else GRect r = Info->GetClient(); #endif if (Separator()) { // Paint a separator int Cy = r.Y() / 2; pDC->Colour(L_MED); pDC->Rectangle(); pDC->Colour(L_LOW); pDC->Line(0, Cy-1, pDC->X()-1, Cy-1); pDC->Colour(L_LIGHT); pDC->Line(0, Cy, pDC->X()-1, Cy); } else { // Paint a text menu item GColour Fore(L_TEXT); GColour Back(Selected ? L_HIGH : L_MED); int x = IconX; int y = 1; // For a submenu pDC->Colour(Back); pDC->Rectangle(); // Draw the text on top GFont *Font = Menu && Menu->GetFont() ? Menu->GetFont() : SysFont; Font->Transparent(true); if (Disabled) { // Disabled text if (!Selected) { Font->Colour(L_LIGHT); _PaintText(pDC, x+1, y+1, r.X()); } // Else selected... don't draw the hilight // "greyed" text... Font->Colour(L_LOW); _PaintText(pDC, x, y, r.X()); } else { // Normal coloured text Font->Fore(Fore); _PaintText(pDC, x, y, r.X()); } GImageList *ImgLst = (Menu && Menu->GetImageList()) ? Menu->GetImageList() : Parent ? Parent->GetImageList() : 0; // Draw icon/check mark if (Checked && IconX > 0) { // it's a check! int x = 4; int y = 6; pDC->Colour(Fore); pDC->Line(x, y, x+2, y+2); pDC->Line(x+2, y+2, x+6, y-2); y++; pDC->Line(x, y, x+2, y+2); pDC->Line(x+2, y+2, x+6, y-2); y++; pDC->Line(x, y, x+2, y+2); pDC->Line(x+2, y+2, x+6, y-2); } else if (ImgLst && _Icon >= 0) { // it's an icon! GColour Bk(L_MED); ImgLst->Draw(pDC, 0, 0, _Icon, Bk); } // Sub menu arrow if (Child && !dynamic_cast(Parent)) { pDC->Colour(L_TEXT); int x = r.x2 - 4; int y = r.y1 + (r.Y()/2); for (int i=0; i<4; i++) { pDC->Line(x, y-i, x, y+i); x--; } } } } bool LMenuItem::ScanForAccel() { if (!d->Shortcut) return false; return true; } LSubMenu *LMenuItem::GetParent() { return Parent; } bool LMenuItem::Remove() { if (!Parent) return false; if (Parent->Info && Info) { [Parent->Info.p removeItem:Info]; Parent->Items.Delete(this); Info = NULL; } else { Parent->Items.Delete(this); } return true; } void LMenuItem::Id(int i) { _Id = i; if (Parent && Parent->Info && Info) { #if LGI_COCOA #else SetMenuItemCommandID(Parent->Info, Info, _Id); #endif } } void LMenuItem::Separator(bool s) { if (s) { _Id = -2; } if (Parent) { #if LGI_COCOA #else if (s) ChangeMenuItemAttributes(Parent->Info, Info, kMenuItemAttrSeparator, 0); else ChangeMenuItemAttributes(Parent->Info, Info, 0, kMenuItemAttrSeparator); #endif } } void LMenuItem::Checked(bool c) { if (c) SetFlag(_Flags, ODS_CHECKED); else ClearFlag(_Flags, ODS_CHECKED); if (Info) [Info.p setState: c ? NSOnState : NSOffState]; } bool LMenuItem::Name(const char *n) { char *Tmp = NewStr(n); if (Tmp) { char *in = Tmp, *out = Tmp; while (*in) { if (*in != '&') *out++ = *in; in++; } *out++ = 0; } bool Status = GBase::Name(Tmp); if (Status && Info) { GString s(Tmp); [Info.p setTitle:s.NsStr()]; } DeleteArray(Tmp); return Status; } void LMenuItem::Enabled(bool e) { #if 1 if (Info && Info.p.enabled ^ e) Info.p.enabled = e; #endif } void LMenuItem::Focus(bool f) { } void LMenuItem::Sub(LSubMenu *s) { Child = s; } void releaseData(void *info, const void *data, size_t size) { uchar *i = (uchar*)info; DeleteArray(i); } void LMenuItem::Icon(int i) { _Icon = i; GImageList *Lst = Menu ? Menu->GetImageList() : Parent->GetImageList(); if (!Lst || !Info) return; if (_Icon < 0 || _Icon >= Lst->GetItems()) return; GRect r = Lst->GetIconRect(_Icon); [Info.p setImage: Lst->NsImage(&r)]; } void LMenuItem::Visible(bool i) { } int LMenuItem::Id() { return _Id; } char *LMenuItem::Name() { return GBase::Name(); } bool LMenuItem::Separator() { return _Id == -2; } bool LMenuItem::Checked() { return TestFlag(_Flags, ODS_CHECKED); } bool LMenuItem::Enabled() { if (Parent) { #if LGI_COCOA #else return IsMenuItemEnabled(Parent->Info, Info); #endif } return true; } bool LMenuItem::Visible() { return true; } bool LMenuItem::Focus() { return 0; } LSubMenu *LMenuItem::Sub() { return Child; } int LMenuItem::Icon() { return _Icon; } /////////////////////////////////////////////////////////////////////////////////////////////// class LMenuPrivate { public: int PrefId, AboutId; LMenuPrivate() { PrefId = AboutId = 0; } }; LMenu::LMenu(const char *AppName) : LSubMenu("", false) { Menu = this; d = new LMenuPrivate; auto s = AppendSub("Root"); if (s) { s->AppendItem("About", M_ABOUT); s->AppendSeparator(); s->AppendItem("Preferences", M_PERFERENCES, true, -1, "Cmd+,"); s->AppendItem("Hide", M_HIDE, true, -1, "Cmd+H"); s->AppendSeparator(); s->AppendItem("Quit", M_QUIT, true, -1, "Cmd+Q"); } } LMenu::~LMenu() { Accel.DeleteObjects(); DeleteObj(d); } void LMenu::OnActivate(LMenuItem *item) { if (!item) { LgiAssert(0); return; } switch (item->Id()) { case M_ABOUT: if (Window && d->AboutId) Window->PostEvent(M_COMMAND, d->AboutId); break; case M_PERFERENCES: if (Window && d->PrefId) Window->PostEvent(M_COMMAND, d->PrefId); break; case M_HIDE: [[NSApplication sharedApplication] hide:Info]; break; case M_QUIT: LgiCloseApp(); break; default: if (Window) Window->PostEvent(M_COMMAND, item->Id()); break; } } bool LMenu::SetPrefAndAboutItems(int PrefId, int AboutId) { d->PrefId = PrefId; d->AboutId = AboutId; return true; } struct LMenuFont { GFont *f; LMenuFont() { f = NULL; } ~LMenuFont() { DeleteObj(f); } } MenuFont; GFont *LMenu::GetFont() { if (!MenuFont.f) { GFontType Type; if (Type.GetSystemFont("Menu")) { MenuFont.f = Type.Create(); if (MenuFont.f) { #ifndef MAC _Font->CodePage(SysFont->CodePage()); #endif } else { printf("LMenu::GetFont Couldn't create menu font.\n"); } } else { printf("LMenu::GetFont Couldn't get menu typeface.\n"); } if (!MenuFont.f) { MenuFont.f = new GFont; if (MenuFont.f) *MenuFont.f = *SysFont; } } return MenuFont.f ? MenuFont.f : SysFont; } bool LMenu::Attach(GViewI *p) { bool Status = false; GWindow *w = dynamic_cast(p); if (w) { Window = p; [NSApplication sharedApplication].mainMenu = Info; if (Info) { OnAttach(true); Status = true; } else { printf("%s:%i - No menu\n", _FL); } } return Status; } bool LMenu::Detach() { bool Status = false; return Status; } bool LMenu::OnKey(GView *v, GKey &k) { if (k.Down()) { for (auto a: Accel) { if (a->Match(k)) { Window->OnCommand(a->GetId(), 0, NULL); return true; } } if (k.Alt() && !dynamic_cast(v) && !dynamic_cast(v)) { bool Hide = false; for (auto s: Items) { if (!s->Separator()) { if (Hide) { // s->Info->HideSub(); } else { char *n = s->Name(); if (ValidStr(n)) { char *Amp = strchr(n, '&'); while (Amp && Amp[1] == '&') { Amp = strchr(Amp + 2, '&'); } if (Amp) { char Accel = tolower(Amp[1]); char Press = tolower(k.c16); if (Accel == Press) { Hide = true; } } } if (Hide) { // s->Info->ShowSub(); } else { // s->Info->HideSub(); } } } } if (Hide) { return true; } } } return false; } //////////////////////////////////////////////////////////////////////////// GAccelerator::GAccelerator(int flags, int key, int id) { Flags = flags; Key = key; Id = id; } bool GAccelerator::Match(GKey &k) { int Press = (uint) k.c16; #if 0 printf("GAccelerator::Match %i(%c)%s%s%s = %i(%c)%s%s%s\n", Press, Press>=' '?Press:'.', k.Ctrl()?" ctrl":"", k.Alt()?" alt":"", k.Shift()?" shift":"", Key, Key>=' '?Key:'.', TestFlag(Flags, LGI_EF_CTRL)?" ctrl":"", TestFlag(Flags, LGI_EF_ALT)?" alt":"", TestFlag(Flags, LGI_EF_SHIFT)?" shift":"" ); #endif if (toupper(Press) == (uint)Key) { if ( ((TestFlag(Flags, LGI_EF_CTRL) ^ k.Ctrl()) == 0) && ((TestFlag(Flags, LGI_EF_ALT) ^ k.Alt()) == 0) && ((TestFlag(Flags, LGI_EF_SHIFT) ^ k.Shift()) == 0) ) { return true; } } return false; } //////////////////////////////////////////////////////////////////////////// GCommand::GCommand() { Flags = GWF_VISIBLE; Id = 0; ToolButton = 0; MenuItem = 0; Accelerator = 0; TipHelp = 0; PrevValue = false; } GCommand::~GCommand() { DeleteArray(Accelerator); DeleteArray(TipHelp); } bool GCommand::Enabled() { if (ToolButton) return ToolButton->Enabled(); if (MenuItem) return MenuItem->Enabled(); return false; } void GCommand::Enabled(bool e) { if (ToolButton) { ToolButton->Enabled(e); } if (MenuItem) { MenuItem->Enabled(e); } } bool GCommand::Value() { bool HasChanged = false; if (ToolButton) { HasChanged |= (ToolButton->Value() != 0) ^ PrevValue; } if (MenuItem) { HasChanged |= (MenuItem->Checked() != 0) ^ PrevValue; } if (HasChanged) { Value(!PrevValue); } return PrevValue; } void GCommand::Value(bool v) { if (ToolButton) { ToolButton->Value(v); } if (MenuItem) { MenuItem->Checked(v); } PrevValue = v; } 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,1029 +1,1031 @@ // !$*UTF8*$! { archiveVersion = 1; classes = { }; objectVersion = 46; objects = { /* Begin PBXBuildFile section */ 34109857217A9805007020CE /* LCocoaView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 34109856217A9805007020CE /* LCocoaView.mm */; }; 34114C8B23091E6E00F342B1 /* LgiClasses.h in Headers */ = {isa = PBXBuildFile; fileRef = 34114C8A23091E6E00F342B1 /* LgiClasses.h */; }; 3413170E23068FFE008CE982 /* GFileSelect.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3413170D23068FFE008CE982 /* GFileSelect.cpp */; }; 34131710230694D1008CE982 /* Gel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3413170F230694D1008CE982 /* Gel.cpp */; }; 343874B5230F46B200CF96B4 /* GWindow.h in Headers */ = {isa = PBXBuildFile; fileRef = 343874B1230F46B200CF96B4 /* GWindow.h */; }; 343874B6230F46B200CF96B4 /* GView.h in Headers */ = {isa = PBXBuildFile; fileRef = 343874B2230F46B200CF96B4 /* GView.h */; }; 343874B7230F46B200CF96B4 /* GApp.h in Headers */ = {isa = PBXBuildFile; fileRef = 343874B3230F46B200CF96B4 /* GApp.h */; }; 343874B8230F46B200CF96B4 /* GLayout.h in Headers */ = {isa = PBXBuildFile; fileRef = 343874B4230F46B200CF96B4 /* GLayout.h */; }; 345920FF1F25649000098DFD /* GFont.h in Headers */ = {isa = PBXBuildFile; fileRef = 345920FC1F25649000098DFD /* GFont.h */; }; 345921001F25649000098DFD /* GFontCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 345920FD1F25649000098DFD /* GFontCache.h */; }; 345921011F25649000098DFD /* GFontSelect.h in Headers */ = {isa = PBXBuildFile; fileRef = 345920FE1F25649000098DFD /* GFontSelect.h */; }; 346FACE71D3C720B00FFEBCE /* GMessage.h in Headers */ = {isa = PBXBuildFile; fileRef = 346FACE61D3C720B00FFEBCE /* GMessage.h */; }; 346FACEB1D3C75AE00FFEBCE /* GUri.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 346FACE91D3C75AE00FFEBCE /* GUri.cpp */; }; 346FACEC1D3C75AE00FFEBCE /* MDStringToDigest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 346FACEA1D3C75AE00FFEBCE /* MDStringToDigest.cpp */; }; 3477C26C1CBF020F0028B84B /* LgiProject.h in Headers */ = {isa = PBXBuildFile; fileRef = 3477C26B1CBF020F0028B84B /* LgiProject.h */; settings = {ATTRIBUTES = (Public, ); }; }; 3477C2751CBF07DD0028B84B /* GApp.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3477C2741CBF07DD0028B84B /* GApp.mm */; }; 3477C2781CBF08050028B84B /* GClipBoard.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3477C2761CBF08050028B84B /* GClipBoard.mm */; }; 3477C2821CBF086A0028B84B /* GGeneral.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3477C27A1CBF086A0028B84B /* GGeneral.mm */; }; 3477C2831CBF086A0028B84B /* GLayout.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3477C27B1CBF086A0028B84B /* GLayout.mm */; }; 3477C2841CBF086A0028B84B /* LMenu.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3477C27C1CBF086A0028B84B /* LMenu.mm */; }; 3477C2851CBF086A0028B84B /* GPrinter.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3477C27D1CBF086A0028B84B /* GPrinter.mm */; }; 3477C2861CBF086A0028B84B /* LThread.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3477C27E1CBF086A0028B84B /* LThread.mm */; }; 3477C2871CBF086A0028B84B /* GView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3477C27F1CBF086A0028B84B /* GView.mm */; }; 3477C2881CBF086A0028B84B /* GWidgets.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3477C2801CBF086A0028B84B /* GWidgets.mm */; }; 3477C2891CBF086A0028B84B /* GWindow.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3477C2811CBF086A0028B84B /* GWindow.mm */; }; 3477C28F1CBF08C10028B84B /* Gdc2.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3477C28B1CBF08C10028B84B /* Gdc2.mm */; }; 3477C2901CBF08C10028B84B /* GMemDC.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C28C1CBF08C10028B84B /* GMemDC.cpp */; }; 3477C2911CBF08C10028B84B /* GPrintDC.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C28D1CBF08C10028B84B /* GPrintDC.cpp */; }; 3477C2921CBF08C10028B84B /* GScreenDC.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C28E1CBF08C10028B84B /* GScreenDC.cpp */; }; 3477C2971CBF09320028B84B /* GFile.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3477C2941CBF09320028B84B /* GFile.mm */; }; 3477C2981CBF09320028B84B /* GMem.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3477C2951CBF09320028B84B /* GMem.mm */; }; 3477C2991CBF09320028B84B /* ShowFileProp_Mac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3477C2961CBF09320028B84B /* ShowFileProp_Mac.mm */; }; 3477C2A11CBF0A920028B84B /* GMem.h in Headers */ = {isa = PBXBuildFile; fileRef = 3477C29B1CBF0A920028B84B /* GMem.h */; }; 3477C2A21CBF0A920028B84B /* GSymLookup.h in Headers */ = {isa = PBXBuildFile; fileRef = 3477C29C1CBF0A920028B84B /* GSymLookup.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 /* GFile.h in Headers */ = {isa = PBXBuildFile; fileRef = 3477C2A91CBF22A00028B84B /* GFile.h */; }; 3477C2AC1CBF72170028B84B /* GViewPriv.h in Headers */ = {isa = PBXBuildFile; fileRef = 3477C2AB1CBF72170028B84B /* GViewPriv.h */; }; 3477C2AF1CBF96B90028B84B /* LgiRes.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C2AE1CBF96B90028B84B /* LgiRes.cpp */; }; 3477C2B11CBF96C40028B84B /* Res.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C2B01CBF96C40028B84B /* Res.cpp */; }; 3477C2B41CBF96F20028B84B /* LgiMsg.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C2B31CBF96F20028B84B /* LgiMsg.cpp */; }; 3477C2B71CBF973F0028B84B /* GGuiUtils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C2B61CBF973F0028B84B /* GGuiUtils.cpp */; }; 3477C2B91CBF977F0028B84B /* LgiCommon.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C2B81CBF977F0028B84B /* LgiCommon.cpp */; }; 3477C2BB1CBF97C80028B84B /* GdcCommon.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C2BA1CBF97C80028B84B /* GdcCommon.cpp */; }; 3477C2C11CBF9A040028B84B /* GString.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C2C01CBF9A040028B84B /* GString.cpp */; }; 3477C2C31CC045840028B84B /* GMem.h in Headers */ = {isa = PBXBuildFile; fileRef = 3477C2C21CC045840028B84B /* GMem.h */; }; 3477C2C81CC046310028B84B /* GTextView3.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C2C41CC046310028B84B /* GTextView3.cpp */; }; 3477C2C91CC046310028B84B /* GUnicode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C2C51CC046310028B84B /* GUnicode.cpp */; }; 3477C2CA1CC046310028B84B /* GUtf8.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C2C61CC046310028B84B /* GUtf8.cpp */; }; 3477C2CB1CC046310028B84B /* GXmlTree.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C2C71CC046310028B84B /* GXmlTree.cpp */; }; 3477C2CE1CC047BE0028B84B /* GFontCodePages.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C2CD1CC047BE0028B84B /* GFontCodePages.cpp */; }; 3477C2D01CC047F50028B84B /* GToolBar.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C2CF1CC047F50028B84B /* GToolBar.cpp */; }; 3477C2D31CC048100028B84B /* GContainers.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C2D21CC048100028B84B /* GContainers.cpp */; }; 3477C2D51CC0481B0028B84B /* GArray.h in Headers */ = {isa = PBXBuildFile; fileRef = 3477C2D41CC0481B0028B84B /* GArray.h */; }; 3477C2D71CC048390028B84B /* GPopup.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C2D61CC048390028B84B /* GPopup.cpp */; }; 3477C2DB1CC048F90028B84B /* GDisplayString.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C2D81CC048F90028B84B /* GDisplayString.cpp */; }; 3477C2DC1CC048F90028B84B /* GFont.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C2D91CC048F90028B84B /* GFont.cpp */; }; 3477C2DD1CC048F90028B84B /* GFontSystem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C2DA1CC048F90028B84B /* GFontSystem.cpp */; }; 3477C2DF1CC04A030028B84B /* GScrollBar.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C2DE1CC04A030028B84B /* GScrollBar.cpp */; }; 3477C2E11CC04A3C0028B84B /* GFontSelect.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C2E01CC04A3C0028B84B /* GFontSelect.cpp */; }; 3477C2E31CC04A5C0028B84B /* GStream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C2E21CC04A5C0028B84B /* GStream.cpp */; }; 3477C2E51CC04A7F0028B84B /* GViewCommon.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C2E41CC04A7F0028B84B /* GViewCommon.cpp */; }; 3477C2E71CC04B1E0028B84B /* GSurface.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C2E61CC04B1E0028B84B /* GSurface.cpp */; }; 3477C2E91CC04B5D0028B84B /* LgiRand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C2E81CC04B5D0028B84B /* LgiRand.cpp */; }; 3477C2EB1CC04B890028B84B /* GFilter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C2EA1CC04B890028B84B /* GFilter.cpp */; }; 3477C2EF1CC04BBB0028B84B /* GItemContainer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C2EC1CC04BBB0028B84B /* GItemContainer.cpp */; }; 3477C2F01CC04BBB0028B84B /* LList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C2ED1CC04BBB0028B84B /* LList.cpp */; }; 3477C2F11CC04BBB0028B84B /* GTree.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C2EE1CC04BBB0028B84B /* GTree.cpp */; }; 3477C2FF1CC04BF00028B84B /* GBitmap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C2F21CC04BF00028B84B /* GBitmap.cpp */; }; 3477C3001CC04BF00028B84B /* GBox.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C2F31CC04BF00028B84B /* GBox.cpp */; }; 3477C3011CC04BF00028B84B /* GButton.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C2F41CC04BF00028B84B /* GButton.cpp */; }; 3477C3021CC04BF00028B84B /* GCheckBox.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C2F51CC04BF00028B84B /* GCheckBox.cpp */; }; 3477C3031CC04BF00028B84B /* GCombo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C2F61CC04BF00028B84B /* GCombo.cpp */; }; 3477C3041CC04BF00028B84B /* GEdit.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C2F71CC04BF00028B84B /* GEdit.cpp */; }; 3477C3051CC04BF00028B84B /* GPanel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C2F81CC04BF00028B84B /* GPanel.cpp */; }; 3477C3061CC04BF00028B84B /* GProgress.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C2F91CC04BF00028B84B /* GProgress.cpp */; }; 3477C3071CC04BF00028B84B /* GRadioGroup.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C2FA1CC04BF00028B84B /* GRadioGroup.cpp */; }; 3477C3081CC04BF00028B84B /* GSplitter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C2FB1CC04BF00028B84B /* GSplitter.cpp */; }; 3477C3091CC04BF00028B84B /* GTableLayout.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C2FC1CC04BF00028B84B /* GTableLayout.cpp */; }; 3477C30A1CC04BF00028B84B /* GTabView.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C2FD1CC04BF00028B84B /* GTabView.cpp */; }; 3477C30B1CC04BF00028B84B /* GTextLabel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C2FE1CC04BF00028B84B /* GTextLabel.cpp */; }; 3477C30D1CC04C560028B84B /* GFindReplace.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C30C1CC04C560028B84B /* GFindReplace.cpp */; }; 3477C3101CC04C790028B84B /* GCss.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C30E1CC04C790028B84B /* GCss.cpp */; }; 3477C3111CC04C790028B84B /* GCssTools.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C30F1CC04C790028B84B /* GCssTools.cpp */; }; 3477C3131CC04CB10028B84B /* GRect.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C3121CC04CB10028B84B /* GRect.cpp */; }; 3477C3161CC04CCB0028B84B /* GLibrary.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C3151CC04CCB0028B84B /* GLibrary.cpp */; }; 3477C3191CC04CF10028B84B /* LThreadCommon.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C3181CC04CF10028B84B /* LThreadCommon.cpp */; }; 3477C31D1CC04D3F0028B84B /* INet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C31B1CC04D3F0028B84B /* INet.cpp */; }; 3477C31E1CC04D3F0028B84B /* INetTools.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C31C1CC04D3F0028B84B /* INetTools.cpp */; }; 3477C3201CC04D630028B84B /* LThreadEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C31F1CC04D630028B84B /* LThreadEvent.cpp */; }; 3477C3221CC04DA00028B84B /* GColour.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C3211CC04DA00028B84B /* GColour.cpp */; }; 3477C3241CC04DD70028B84B /* GObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C3231CC04DD70028B84B /* GObject.cpp */; }; 3477C3261CC04DE20028B84B /* LMutex.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C3251CC04DE20028B84B /* LMutex.cpp */; }; 3477C3281CC04E020028B84B /* GVariant.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C3271CC04E020028B84B /* GVariant.cpp */; }; 3477C3311CC04E120028B84B /* 8Bit.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C3291CC04E120028B84B /* 8Bit.cpp */; }; 3477C3321CC04E120028B84B /* 15Bit.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C32A1CC04E120028B84B /* 15Bit.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 */; }; 3477C3371CC04E120028B84B /* 64Bit.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C32F1CC04E120028B84B /* 64Bit.cpp */; }; 3477C3381CC04E120028B84B /* Alpha.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C3301CC04E120028B84B /* Alpha.cpp */; }; 3477C33A1CC04ED90028B84B /* GDragAndDrop.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3477C3391CC04ED90028B84B /* GDragAndDrop.mm */; }; 3477C33D1CC088590028B84B /* GFileCommon.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C33C1CC088590028B84B /* GFileCommon.cpp */; }; 3477C33F1CC0A6780028B84B /* GToken.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C33E1CC0A6780028B84B /* GToken.cpp */; }; 3477C3411CC0A68E0028B84B /* LDateTime.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C3401CC0A68E0028B84B /* LDateTime.cpp */; }; 3477C3431CC0A6B90028B84B /* GDocView.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C3421CC0A6B90028B84B /* GDocView.cpp */; }; 3477C3451CC0A9DE0028B84B /* GInput.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C3441CC0A9DE0028B84B /* GInput.cpp */; }; 3477C3471CC0AA220028B84B /* GWindowCommon.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C3461CC0AA220028B84B /* GWindowCommon.cpp */; }; 3477C3491CC0AA7E0028B84B /* GProgressDlg.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C3481CC0AA7E0028B84B /* GProgressDlg.cpp */; }; 3477C34B1CC0AB0B0028B84B /* GToolTip.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C34A1CC0AB0B0028B84B /* GToolTip.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 /* GMemStream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C4391CC234750028B84B /* GMemStream.cpp */; }; 3477C46D1CC26DEB0028B84B /* GAlert.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C46C1CC26DEB0028B84B /* GAlert.cpp */; }; 3477C4ED1CC27F1C0028B84B /* GTrayIcon.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3477C4EC1CC27F1C0028B84B /* GTrayIcon.cpp */; }; 3477C5171CC303B70028B84B /* LgiClass.h in Headers */ = {isa = PBXBuildFile; fileRef = 3477C5161CC303B70028B84B /* LgiClass.h */; }; 347D192121B1F5700008C4CB /* GFont_W.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 347D192021B1F5700008C4CB /* GFont_W.cpp */; }; 348362421F233A77003B2A6D /* GStream.h in Headers */ = {isa = PBXBuildFile; fileRef = 348362411F233A77003B2A6D /* GStream.h */; }; 34A3ACE820568D5800B1D62A /* LStringLayout.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 34A3ACE720568D5800B1D62A /* LStringLayout.cpp */; }; 34A3ACEA20568D9700B1D62A /* LMenuCommon.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 34A3ACE920568D9700B1D62A /* LMenuCommon.cpp */; }; 34B531D822F65734002B50F7 /* LMenu.h in Headers */ = {isa = PBXBuildFile; fileRef = 34B531D722F65734002B50F7 /* LMenu.h */; }; 34D1B3C121748A2800BC6B58 /* GPath.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 34D1B3C021748A2800BC6B58 /* GPath.cpp */; }; 34D21CEC217981AE003D1EA6 /* GEventTargetThread.h in Headers */ = {isa = PBXBuildFile; fileRef = 34D21CEB217981AE003D1EA6 /* GEventTargetThread.h */; }; 34D6AA1722D3749A005D739E /* Gdc2.h in Headers */ = {isa = PBXBuildFile; fileRef = 34D6AA1622D3749A005D739E /* Gdc2.h */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ 34109853217A975E007020CE /* LCocoaView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = LCocoaView.h; path = ../../../../include/mac/cocoa/LCocoaView.h; sourceTree = ""; }; 34109856217A9805007020CE /* LCocoaView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = LCocoaView.mm; path = Lgi/LCocoaView.mm; sourceTree = SOURCE_ROOT; }; 34114C8A23091E6E00F342B1 /* LgiClasses.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LgiClasses.h; path = ../../../include/common/LgiClasses.h; sourceTree = ""; }; 3413170D23068FFE008CE982 /* GFileSelect.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GFileSelect.cpp; path = ../../../common/Lgi/GFileSelect.cpp; sourceTree = ""; }; 3413170F230694D1008CE982 /* Gel.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Gel.cpp; path = ../../../common/Skins/Gel/Gel.cpp; sourceTree = ""; }; 343874B1230F46B200CF96B4 /* GWindow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GWindow.h; path = ../../../../include/common/GWindow.h; sourceTree = ""; }; 343874B2230F46B200CF96B4 /* GView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GView.h; path = ../../../../include/common/GView.h; sourceTree = ""; }; 343874B3230F46B200CF96B4 /* GApp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GApp.h; path = ../../../../include/common/GApp.h; sourceTree = ""; }; 343874B4230F46B200CF96B4 /* GLayout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GLayout.h; path = ../../../../include/common/GLayout.h; sourceTree = ""; }; 345920FC1F25649000098DFD /* GFont.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GFont.h; path = ../../../../include/common/GFont.h; sourceTree = ""; }; 345920FD1F25649000098DFD /* GFontCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GFontCache.h; path = ../../../../include/common/GFontCache.h; sourceTree = ""; }; 345920FE1F25649000098DFD /* GFontSelect.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GFontSelect.h; path = ../../../../include/common/GFontSelect.h; sourceTree = ""; }; 346FACE61D3C720B00FFEBCE /* GMessage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GMessage.h; path = ../../../../include/common/GMessage.h; sourceTree = ""; }; 346FACE91D3C75AE00FFEBCE /* GUri.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GUri.cpp; path = ../../../common/INet/GUri.cpp; sourceTree = ""; }; 346FACEA1D3C75AE00FFEBCE /* MDStringToDigest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = MDStringToDigest.cpp; path = ../../../common/INet/MDStringToDigest.cpp; sourceTree = ""; }; 3477C2681CBF020F0028B84B /* LgiCocoa.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = LgiCocoa.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 3477C26B1CBF020F0028B84B /* LgiProject.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = LgiProject.h; path = Lgi/LgiProject.h; sourceTree = ""; }; 3477C26D1CBF020F0028B84B /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Info.plist; path = Lgi/Info.plist; sourceTree = ""; }; 3477C2741CBF07DD0028B84B /* GApp.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = GApp.mm; sourceTree = ""; }; 3477C2761CBF08050028B84B /* GClipBoard.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = GClipBoard.mm; sourceTree = ""; }; 3477C27A1CBF086A0028B84B /* GGeneral.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = GGeneral.mm; sourceTree = ""; }; 3477C27B1CBF086A0028B84B /* GLayout.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = GLayout.mm; sourceTree = ""; }; 3477C27C1CBF086A0028B84B /* LMenu.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = LMenu.mm; sourceTree = ""; }; 3477C27D1CBF086A0028B84B /* GPrinter.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = GPrinter.mm; sourceTree = ""; }; 3477C27E1CBF086A0028B84B /* LThread.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = LThread.mm; sourceTree = ""; }; 3477C27F1CBF086A0028B84B /* GView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = GView.mm; sourceTree = ""; }; 3477C2801CBF086A0028B84B /* GWidgets.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = GWidgets.mm; sourceTree = ""; }; 3477C2811CBF086A0028B84B /* GWindow.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = GWindow.mm; sourceTree = ""; }; 3477C28B1CBF08C10028B84B /* Gdc2.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = Gdc2.mm; path = Gdc2/Gdc2.mm; sourceTree = SOURCE_ROOT; }; 3477C28C1CBF08C10028B84B /* GMemDC.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; name = GMemDC.cpp; path = ../common/GMemDC.cpp; sourceTree = SOURCE_ROOT; }; 3477C28D1CBF08C10028B84B /* GPrintDC.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; name = GPrintDC.cpp; path = ../common/GPrintDC.cpp; sourceTree = SOURCE_ROOT; }; 3477C28E1CBF08C10028B84B /* GScreenDC.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; name = GScreenDC.cpp; path = ../common/GScreenDC.cpp; sourceTree = SOURCE_ROOT; }; 3477C2941CBF09320028B84B /* GFile.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = GFile.mm; path = General/GFile.mm; sourceTree = SOURCE_ROOT; }; 3477C2951CBF09320028B84B /* GMem.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = GMem.mm; path = General/GMem.mm; sourceTree = SOURCE_ROOT; }; 3477C2961CBF09320028B84B /* ShowFileProp_Mac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = ShowFileProp_Mac.mm; path = General/ShowFileProp_Mac.mm; sourceTree = SOURCE_ROOT; }; 3477C29B1CBF0A920028B84B /* GMem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GMem.h; path = ../../../include/mac/cocoa/GMem.h; sourceTree = ""; }; 3477C29C1CBF0A920028B84B /* GSymLookup.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GSymLookup.h; path = ../../../include/mac/cocoa/GSymLookup.h; sourceTree = ""; }; 3477C29D1CBF0A920028B84B /* LgiMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LgiMac.h; path = ../../../include/mac/cocoa/LgiMac.h; sourceTree = ""; }; 3477C29E1CBF0A920028B84B /* LgiOs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LgiOs.h; path = ../../../include/mac/cocoa/LgiOs.h; sourceTree = ""; }; 3477C29F1CBF0A920028B84B /* LgiOsClasses.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LgiOsClasses.h; path = ../../../include/mac/cocoa/LgiOsClasses.h; sourceTree = ""; }; 3477C2A01CBF0A920028B84B /* LgiOsDefs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LgiOsDefs.h; path = ../../../include/mac/cocoa/LgiOsDefs.h; sourceTree = ""; }; 3477C2A71CBF0AAF0028B84B /* Lgi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Lgi.h; path = ../../../include/common/Lgi.h; sourceTree = ""; }; 3477C2A91CBF22A00028B84B /* GFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GFile.h; path = ../../../../include/common/GFile.h; sourceTree = ""; }; 3477C2AB1CBF72170028B84B /* GViewPriv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GViewPriv.h; path = ../../../../include/common/GViewPriv.h; sourceTree = ""; }; 3477C2AE1CBF96B90028B84B /* LgiRes.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LgiRes.cpp; path = ../../../common/Resource/LgiRes.cpp; sourceTree = ""; }; 3477C2B01CBF96C40028B84B /* Res.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Res.cpp; path = ../../../common/Resource/Res.cpp; sourceTree = ""; }; 3477C2B31CBF96F20028B84B /* LgiMsg.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; name = LgiMsg.cpp; path = ../../../common/Lgi/LgiMsg.cpp; sourceTree = ""; }; 3477C2B61CBF973F0028B84B /* GGuiUtils.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; name = GGuiUtils.cpp; path = ../../../common/Lgi/GGuiUtils.cpp; sourceTree = ""; }; 3477C2B81CBF977F0028B84B /* LgiCommon.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; name = LgiCommon.cpp; path = ../../../common/Lgi/LgiCommon.cpp; sourceTree = ""; }; 3477C2BA1CBF97C80028B84B /* GdcCommon.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GdcCommon.cpp; path = ../../../common/Gdc2/GdcCommon.cpp; sourceTree = ""; }; 3477C2C01CBF9A040028B84B /* GString.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GString.cpp; path = ../../../common/Text/GString.cpp; sourceTree = ""; }; 3477C2C21CC045840028B84B /* GMem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GMem.h; path = ../../../include/common/GMem.h; sourceTree = ""; }; 3477C2C41CC046310028B84B /* GTextView3.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GTextView3.cpp; path = ../../../common/Text/GTextView3.cpp; sourceTree = ""; }; 3477C2C51CC046310028B84B /* GUnicode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GUnicode.cpp; path = ../../../common/Text/GUnicode.cpp; sourceTree = ""; }; 3477C2C61CC046310028B84B /* GUtf8.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GUtf8.cpp; path = ../../../common/Text/GUtf8.cpp; sourceTree = ""; }; 3477C2C71CC046310028B84B /* GXmlTree.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GXmlTree.cpp; path = ../../../common/Text/GXmlTree.cpp; sourceTree = ""; }; 3477C2CD1CC047BE0028B84B /* GFontCodePages.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GFontCodePages.cpp; path = ../../../common/Gdc2/Font/GFontCodePages.cpp; sourceTree = ""; }; 3477C2CF1CC047F50028B84B /* GToolBar.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GToolBar.cpp; path = ../../../common/Widgets/GToolBar.cpp; sourceTree = ""; }; 3477C2D21CC048100028B84B /* GContainers.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GContainers.cpp; path = ../../../common/General/GContainers.cpp; sourceTree = ""; }; 3477C2D41CC0481B0028B84B /* GArray.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GArray.h; path = ../../../../include/common/GArray.h; sourceTree = ""; }; 3477C2D61CC048390028B84B /* GPopup.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp.preprocessed; fileEncoding = 4; name = GPopup.cpp; path = ../../../common/Widgets/GPopup.cpp; sourceTree = ""; }; 3477C2D81CC048F90028B84B /* GDisplayString.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GDisplayString.cpp; path = ../../../common/Gdc2/Font/GDisplayString.cpp; sourceTree = ""; }; 3477C2D91CC048F90028B84B /* GFont.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GFont.cpp; path = ../../../common/Gdc2/Font/GFont.cpp; sourceTree = ""; }; 3477C2DA1CC048F90028B84B /* GFontSystem.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; name = GFontSystem.cpp; path = ../../../common/Gdc2/Font/GFontSystem.cpp; sourceTree = ""; }; 3477C2DE1CC04A030028B84B /* GScrollBar.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GScrollBar.cpp; path = ../../../common/Widgets/GScrollBar.cpp; sourceTree = ""; }; 3477C2E01CC04A3C0028B84B /* GFontSelect.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GFontSelect.cpp; path = ../../../common/Lgi/GFontSelect.cpp; sourceTree = ""; }; 3477C2E21CC04A5C0028B84B /* GStream.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GStream.cpp; path = ../../../common/Lgi/GStream.cpp; sourceTree = ""; }; 3477C2E41CC04A7F0028B84B /* GViewCommon.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; name = GViewCommon.cpp; path = ../../../common/Lgi/GViewCommon.cpp; sourceTree = ""; }; 3477C2E61CC04B1E0028B84B /* GSurface.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GSurface.cpp; path = ../../../common/Gdc2/GSurface.cpp; sourceTree = ""; }; 3477C2E81CC04B5D0028B84B /* LgiRand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LgiRand.cpp; path = ../../../common/Lgi/LgiRand.cpp; sourceTree = ""; }; 3477C2EA1CC04B890028B84B /* GFilter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GFilter.cpp; path = ../../../common/Gdc2/Filters/GFilter.cpp; sourceTree = ""; }; 3477C2EC1CC04BBB0028B84B /* GItemContainer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GItemContainer.cpp; path = ../../../common/Widgets/GItemContainer.cpp; sourceTree = ""; }; 3477C2ED1CC04BBB0028B84B /* LList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LList.cpp; path = ../../../common/Widgets/LList.cpp; sourceTree = ""; }; 3477C2EE1CC04BBB0028B84B /* GTree.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GTree.cpp; path = ../../../common/Widgets/GTree.cpp; sourceTree = ""; }; 3477C2F21CC04BF00028B84B /* GBitmap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GBitmap.cpp; path = ../../../common/Widgets/GBitmap.cpp; sourceTree = ""; }; 3477C2F31CC04BF00028B84B /* GBox.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GBox.cpp; path = ../../../common/Widgets/GBox.cpp; sourceTree = ""; }; 3477C2F41CC04BF00028B84B /* GButton.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GButton.cpp; path = ../../../common/Widgets/GButton.cpp; sourceTree = ""; }; 3477C2F51CC04BF00028B84B /* GCheckBox.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GCheckBox.cpp; path = ../../../common/Widgets/GCheckBox.cpp; sourceTree = ""; }; 3477C2F61CC04BF00028B84B /* GCombo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GCombo.cpp; path = ../../../common/Widgets/GCombo.cpp; sourceTree = ""; }; 3477C2F71CC04BF00028B84B /* GEdit.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GEdit.cpp; path = ../../../common/Widgets/GEdit.cpp; sourceTree = ""; }; 3477C2F81CC04BF00028B84B /* GPanel.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GPanel.cpp; path = ../../../common/Widgets/GPanel.cpp; sourceTree = ""; }; 3477C2F91CC04BF00028B84B /* GProgress.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GProgress.cpp; path = ../../../common/Widgets/GProgress.cpp; sourceTree = ""; }; 3477C2FA1CC04BF00028B84B /* GRadioGroup.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GRadioGroup.cpp; path = ../../../common/Widgets/GRadioGroup.cpp; sourceTree = ""; }; 3477C2FB1CC04BF00028B84B /* GSplitter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GSplitter.cpp; path = ../../../common/Widgets/GSplitter.cpp; sourceTree = ""; }; 3477C2FC1CC04BF00028B84B /* GTableLayout.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GTableLayout.cpp; path = ../../../common/Widgets/GTableLayout.cpp; sourceTree = ""; }; 3477C2FD1CC04BF00028B84B /* GTabView.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GTabView.cpp; path = ../../../common/Widgets/GTabView.cpp; sourceTree = ""; }; 3477C2FE1CC04BF00028B84B /* GTextLabel.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GTextLabel.cpp; path = ../../../common/Widgets/GTextLabel.cpp; sourceTree = ""; }; 3477C30C1CC04C560028B84B /* GFindReplace.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GFindReplace.cpp; path = ../../../common/Lgi/GFindReplace.cpp; sourceTree = ""; }; 3477C30E1CC04C790028B84B /* GCss.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GCss.cpp; path = ../../../common/Lgi/GCss.cpp; sourceTree = ""; }; 3477C30F1CC04C790028B84B /* GCssTools.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GCssTools.cpp; path = ../../../common/Lgi/GCssTools.cpp; sourceTree = ""; }; 3477C3121CC04CB10028B84B /* GRect.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GRect.cpp; path = ../../../common/Gdc2/GRect.cpp; sourceTree = ""; }; 3477C3151CC04CCB0028B84B /* GLibrary.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GLibrary.cpp; path = ../../../common/Lgi/GLibrary.cpp; sourceTree = ""; }; 3477C3181CC04CF10028B84B /* LThreadCommon.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LThreadCommon.cpp; path = ../../../common/Lgi/LThreadCommon.cpp; sourceTree = ""; }; 3477C31B1CC04D3F0028B84B /* INet.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = INet.cpp; path = ../../../common/INet/INet.cpp; sourceTree = ""; }; 3477C31C1CC04D3F0028B84B /* INetTools.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = INetTools.cpp; path = ../../../common/INet/INetTools.cpp; sourceTree = ""; }; 3477C31F1CC04D630028B84B /* LThreadEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LThreadEvent.cpp; path = ../../../common/Lgi/LThreadEvent.cpp; sourceTree = ""; }; 3477C3211CC04DA00028B84B /* GColour.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GColour.cpp; path = ../../../common/Gdc2/GColour.cpp; sourceTree = ""; }; 3477C3231CC04DD70028B84B /* GObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GObject.cpp; path = ../../../common/Lgi/GObject.cpp; sourceTree = ""; }; 3477C3251CC04DE20028B84B /* LMutex.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LMutex.cpp; path = ../../../common/Lgi/LMutex.cpp; sourceTree = ""; }; 3477C3271CC04E020028B84B /* GVariant.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GVariant.cpp; path = ../../../common/Lgi/GVariant.cpp; sourceTree = ""; }; 3477C3291CC04E120028B84B /* 8Bit.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = 8Bit.cpp; path = ../../../common/Gdc2/8Bit.cpp; sourceTree = ""; }; 3477C32A1CC04E120028B84B /* 15Bit.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = 15Bit.cpp; path = ../../../common/Gdc2/15Bit.cpp; sourceTree = ""; }; 3477C32B1CC04E120028B84B /* 16Bit.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = 16Bit.cpp; path = ../../../common/Gdc2/16Bit.cpp; sourceTree = ""; }; 3477C32C1CC04E120028B84B /* 24Bit.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = 24Bit.cpp; path = ../../../common/Gdc2/24Bit.cpp; sourceTree = ""; }; 3477C32D1CC04E120028B84B /* 32Bit.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = 32Bit.cpp; path = ../../../common/Gdc2/32Bit.cpp; sourceTree = ""; }; 3477C32E1CC04E120028B84B /* 48Bit.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = 48Bit.cpp; path = ../../../common/Gdc2/48Bit.cpp; sourceTree = ""; }; 3477C32F1CC04E120028B84B /* 64Bit.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = 64Bit.cpp; path = ../../../common/Gdc2/64Bit.cpp; sourceTree = ""; }; 3477C3301CC04E120028B84B /* Alpha.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Alpha.cpp; path = ../../../common/Gdc2/Alpha.cpp; sourceTree = ""; }; 3477C3391CC04ED90028B84B /* GDragAndDrop.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = GDragAndDrop.mm; sourceTree = ""; }; 3477C33C1CC088590028B84B /* GFileCommon.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GFileCommon.cpp; path = ../../../common/General/GFileCommon.cpp; sourceTree = ""; }; 3477C33E1CC0A6780028B84B /* GToken.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GToken.cpp; path = ../../../common/Text/GToken.cpp; sourceTree = ""; }; 3477C3401CC0A68E0028B84B /* LDateTime.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LDateTime.cpp; path = ../../../common/General/LDateTime.cpp; sourceTree = ""; }; 3477C3421CC0A6B90028B84B /* GDocView.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GDocView.cpp; path = ../../../common/Text/GDocView.cpp; sourceTree = ""; }; 3477C3441CC0A9DE0028B84B /* GInput.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GInput.cpp; path = ../../../common/Lgi/GInput.cpp; sourceTree = ""; }; 3477C3461CC0AA220028B84B /* GWindowCommon.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; name = GWindowCommon.cpp; path = ../../../common/Lgi/GWindowCommon.cpp; sourceTree = ""; }; 3477C3481CC0AA7E0028B84B /* GProgressDlg.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GProgressDlg.cpp; path = ../../../common/Widgets/GProgressDlg.cpp; sourceTree = ""; }; 3477C34A1CC0AB0B0028B84B /* GToolTip.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GToolTip.cpp; path = ../../../common/Lgi/GToolTip.cpp; sourceTree = ""; }; 3477C34C1CC0ACED0028B84B /* md5.c */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.cpp; fileEncoding = 4; name = md5.c; path = ../../../common/Hash/md5/md5.c; sourceTree = ""; }; 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/common/LgiInc.h; sourceTree = ""; }; 3477C35C1CC2253E0028B84B /* LgiInterfaces.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LgiInterfaces.h; path = ../../../include/common/LgiInterfaces.h; sourceTree = ""; }; 3477C4391CC234750028B84B /* GMemStream.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GMemStream.cpp; path = ../../../common/Lgi/GMemStream.cpp; sourceTree = ""; }; 3477C46C1CC26DEB0028B84B /* GAlert.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GAlert.cpp; path = ../../../common/Lgi/GAlert.cpp; sourceTree = ""; }; 3477C4EC1CC27F1C0028B84B /* GTrayIcon.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; name = GTrayIcon.cpp; path = ../../../common/Lgi/GTrayIcon.cpp; sourceTree = ""; }; 3477C5161CC303B70028B84B /* LgiClass.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LgiClass.h; path = ../../../include/common/LgiClass.h; sourceTree = ""; }; 347D192021B1F5700008C4CB /* GFont_W.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GFont_W.cpp; path = ../../../common/Gdc2/Font/GFont_W.cpp; sourceTree = ""; }; 348362411F233A77003B2A6D /* GStream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GStream.h; path = ../../../../include/common/GStream.h; sourceTree = ""; }; 34A3ACE720568D5800B1D62A /* LStringLayout.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LStringLayout.cpp; path = ../../../common/Gdc2/Font/LStringLayout.cpp; sourceTree = ""; }; 34A3ACE920568D9700B1D62A /* LMenuCommon.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LMenuCommon.cpp; path = ../../../common/Lgi/LMenuCommon.cpp; sourceTree = ""; }; 34B531D722F65734002B50F7 /* LMenu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LMenu.h; path = ../../../../include/common/LMenu.h; sourceTree = ""; }; 34D1B3C021748A2800BC6B58 /* GPath.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GPath.cpp; path = ../../../common/Gdc2/Path/GPath.cpp; sourceTree = ""; }; 34D21CEB217981AE003D1EA6 /* GEventTargetThread.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GEventTargetThread.h; path = ../../../../include/common/GEventTargetThread.h; sourceTree = ""; }; 34D6AA1622D3749A005D739E /* Gdc2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Gdc2.h; path = ../../../../include/common/Gdc2.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 */ 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 */, ); 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 = ""; }; 3477C2731CBF07410028B84B /* Interface_Cocoa */ = { isa = PBXGroup; children = ( 343874B3230F46B200CF96B4 /* GApp.h */, 343874B4230F46B200CF96B4 /* GLayout.h */, 343874B2230F46B200CF96B4 /* GView.h */, 343874B1230F46B200CF96B4 /* GWindow.h */, 34109853217A975E007020CE /* LCocoaView.h */, 34109856217A9805007020CE /* LCocoaView.mm */, 3477C2741CBF07DD0028B84B /* GApp.mm */, 3477C2761CBF08050028B84B /* GClipBoard.mm */, 3477C3391CC04ED90028B84B /* GDragAndDrop.mm */, 3477C27A1CBF086A0028B84B /* GGeneral.mm */, 3477C27B1CBF086A0028B84B /* GLayout.mm */, 3477C27C1CBF086A0028B84B /* LMenu.mm */, 3477C27D1CBF086A0028B84B /* GPrinter.mm */, 3477C27F1CBF086A0028B84B /* GView.mm */, 3477C2AB1CBF72170028B84B /* GViewPriv.h */, 3477C2801CBF086A0028B84B /* GWidgets.mm */, 3477C2811CBF086A0028B84B /* GWindow.mm */, ); name = Interface_Cocoa; sourceTree = ""; }; 3477C28A1CBF08760028B84B /* Graphics */ = { isa = PBXGroup; children = ( 3413170F230694D1008CE982 /* Gel.cpp */, 34D6AA1622D3749A005D739E /* Gdc2.h */, 34D1B3C021748A2800BC6B58 /* GPath.cpp */, 3477C3211CC04DA00028B84B /* GColour.cpp */, 3477C2BA1CBF97C80028B84B /* GdcCommon.cpp */, 3477C2EA1CC04B890028B84B /* GFilter.cpp */, 3477C3121CC04CB10028B84B /* GRect.cpp */, 3477C28B1CBF08C10028B84B /* Gdc2.mm */, 3477C2BE1CBF97E20028B84B /* Applicators */, 3477C2BD1CBF97DA0028B84B /* Fonts */, 3477C2BC1CBF97D10028B84B /* Surfaces */, ); name = Graphics; sourceTree = ""; }; 3477C2931CBF09240028B84B /* General */ = { isa = PBXGroup; children = ( 3477C34C1CC0ACED0028B84B /* md5.c */, 3477C3421CC0A6B90028B84B /* GDocView.cpp */, 3477C3401CC0A68E0028B84B /* LDateTime.cpp */, 3477C3271CC04E020028B84B /* GVariant.cpp */, 3477C3231CC04DD70028B84B /* GObject.cpp */, 3477C2E81CC04B5D0028B84B /* LgiRand.cpp */, 3477C2951CBF09320028B84B /* GMem.mm */, 3477C2961CBF09320028B84B /* ShowFileProp_Mac.mm */, ); name = General; sourceTree = ""; }; 3477C29A1CBF0A700028B84B /* Headers */ = { isa = PBXGroup; children = ( 34114C8A23091E6E00F342B1 /* LgiClasses.h */, 3477C26B1CBF020F0028B84B /* LgiProject.h */, 3477C5161CC303B70028B84B /* LgiClass.h */, 3477C35C1CC2253E0028B84B /* LgiInterfaces.h */, 3477C35A1CC1AEEA0028B84B /* LgiInc.h */, 3477C2C21CC045840028B84B /* GMem.h */, 3477C2A71CBF0AAF0028B84B /* Lgi.h */, 3477C29B1CBF0A920028B84B /* GMem.h */, 3477C29C1CBF0A920028B84B /* GSymLookup.h */, 3477C29D1CBF0A920028B84B /* LgiMac.h */, 3477C29E1CBF0A920028B84B /* LgiOs.h */, 3477C29F1CBF0A920028B84B /* LgiOsClasses.h */, 3477C2A01CBF0A920028B84B /* LgiOsDefs.h */, ); name = Headers; sourceTree = ""; }; 3477C2AD1CBF96AA0028B84B /* Resources */ = { isa = PBXGroup; children = ( 3477C2B01CBF96C40028B84B /* Res.cpp */, 3477C2AE1CBF96B90028B84B /* LgiRes.cpp */, ); name = Resources; sourceTree = ""; }; 3477C2B21CBF96E60028B84B /* Dialogs */ = { isa = PBXGroup; children = ( 3413170D23068FFE008CE982 /* GFileSelect.cpp */, 3477C46C1CC26DEB0028B84B /* GAlert.cpp */, 3477C3481CC0AA7E0028B84B /* GProgressDlg.cpp */, 3477C3441CC0A9DE0028B84B /* GInput.cpp */, 3477C30C1CC04C560028B84B /* GFindReplace.cpp */, 3477C2E01CC04A3C0028B84B /* GFontSelect.cpp */, 3477C2B31CBF96F20028B84B /* LgiMsg.cpp */, ); name = Dialogs; sourceTree = ""; }; 3477C2B51CBF972B0028B84B /* Interface_XP */ = { isa = PBXGroup; children = ( 34B531D722F65734002B50F7 /* LMenu.h */, 34A3ACE920568D9700B1D62A /* LMenuCommon.cpp */, 346FACE61D3C720B00FFEBCE /* GMessage.h */, 3477C4EC1CC27F1C0028B84B /* GTrayIcon.cpp */, 3477C34A1CC0AB0B0028B84B /* GToolTip.cpp */, 3477C3461CC0AA220028B84B /* GWindowCommon.cpp */, 3477C2E41CC04A7F0028B84B /* GViewCommon.cpp */, 3477C2B81CBF977F0028B84B /* LgiCommon.cpp */, 3477C2B61CBF973F0028B84B /* GGuiUtils.cpp */, ); name = Interface_XP; sourceTree = ""; }; 3477C2BC1CBF97D10028B84B /* Surfaces */ = { isa = PBXGroup; children = ( 3477C2E61CC04B1E0028B84B /* GSurface.cpp */, 3477C28E1CBF08C10028B84B /* GScreenDC.cpp */, 3477C28C1CBF08C10028B84B /* GMemDC.cpp */, 3477C28D1CBF08C10028B84B /* GPrintDC.cpp */, ); name = Surfaces; sourceTree = ""; }; 3477C2BD1CBF97DA0028B84B /* Fonts */ = { isa = PBXGroup; children = ( 347D192021B1F5700008C4CB /* GFont_W.cpp */, 34A3ACE720568D5800B1D62A /* LStringLayout.cpp */, 345920FC1F25649000098DFD /* GFont.h */, 345920FD1F25649000098DFD /* GFontCache.h */, 345920FE1F25649000098DFD /* GFontSelect.h */, 3477C2D81CC048F90028B84B /* GDisplayString.cpp */, 3477C2D91CC048F90028B84B /* GFont.cpp */, 3477C2DA1CC048F90028B84B /* GFontSystem.cpp */, 3477C2CD1CC047BE0028B84B /* GFontCodePages.cpp */, ); name = Fonts; sourceTree = ""; }; 3477C2BE1CBF97E20028B84B /* Applicators */ = { isa = PBXGroup; children = ( 3477C3291CC04E120028B84B /* 8Bit.cpp */, 3477C32A1CC04E120028B84B /* 15Bit.cpp */, 3477C32B1CC04E120028B84B /* 16Bit.cpp */, 3477C32C1CC04E120028B84B /* 24Bit.cpp */, 3477C32D1CC04E120028B84B /* 32Bit.cpp */, 3477C32E1CC04E120028B84B /* 48Bit.cpp */, 3477C32F1CC04E120028B84B /* 64Bit.cpp */, 3477C3301CC04E120028B84B /* Alpha.cpp */, ); name = Applicators; sourceTree = ""; }; 3477C2BF1CBF99F00028B84B /* Text */ = { isa = PBXGroup; children = ( 3477C33E1CC0A6780028B84B /* GToken.cpp */, 3477C30E1CC04C790028B84B /* GCss.cpp */, 3477C30F1CC04C790028B84B /* GCssTools.cpp */, 3477C2C51CC046310028B84B /* GUnicode.cpp */, 3477C2C61CC046310028B84B /* GUtf8.cpp */, 3477C2C71CC046310028B84B /* GXmlTree.cpp */, 3477C2C01CBF9A040028B84B /* GString.cpp */, ); name = Text; sourceTree = ""; }; 3477C2CC1CC046370028B84B /* Widgets */ = { isa = PBXGroup; children = ( 3477C2F21CC04BF00028B84B /* GBitmap.cpp */, 3477C2F31CC04BF00028B84B /* GBox.cpp */, 3477C2F41CC04BF00028B84B /* GButton.cpp */, 3477C2F51CC04BF00028B84B /* GCheckBox.cpp */, 3477C2F61CC04BF00028B84B /* GCombo.cpp */, 3477C2F71CC04BF00028B84B /* GEdit.cpp */, 3477C2F81CC04BF00028B84B /* GPanel.cpp */, 3477C2F91CC04BF00028B84B /* GProgress.cpp */, 3477C2FA1CC04BF00028B84B /* GRadioGroup.cpp */, 3477C2FB1CC04BF00028B84B /* GSplitter.cpp */, 3477C2FC1CC04BF00028B84B /* GTableLayout.cpp */, 3477C2FD1CC04BF00028B84B /* GTabView.cpp */, 3477C2FE1CC04BF00028B84B /* GTextLabel.cpp */, 3477C2EC1CC04BBB0028B84B /* GItemContainer.cpp */, 3477C2ED1CC04BBB0028B84B /* LList.cpp */, 3477C2EE1CC04BBB0028B84B /* GTree.cpp */, 3477C2DE1CC04A030028B84B /* GScrollBar.cpp */, 3477C2D61CC048390028B84B /* GPopup.cpp */, 3477C2CF1CC047F50028B84B /* GToolBar.cpp */, 3477C2C41CC046310028B84B /* GTextView3.cpp */, ); name = Widgets; sourceTree = ""; }; 3477C2D11CC048000028B84B /* Memory */ = { isa = PBXGroup; children = ( 3477C2D41CC0481B0028B84B /* GArray.h */, 3477C2D21CC048100028B84B /* GContainers.cpp */, 3477C4391CC234750028B84B /* GMemStream.cpp */, 3477C2E21CC04A5C0028B84B /* GStream.cpp */, 348362411F233A77003B2A6D /* GStream.h */, ); name = Memory; sourceTree = ""; }; 3477C3141CC04CC00028B84B /* Libraries */ = { isa = PBXGroup; children = ( 3477C3151CC04CCB0028B84B /* GLibrary.cpp */, ); name = Libraries; sourceTree = ""; }; 3477C3171CC04CDE0028B84B /* Threads */ = { isa = PBXGroup; children = ( 34D21CEB217981AE003D1EA6 /* GEventTargetThread.h */, 3477C27E1CBF086A0028B84B /* LThread.mm */, 3477C3251CC04DE20028B84B /* LMutex.cpp */, 3477C31F1CC04D630028B84B /* LThreadEvent.cpp */, 3477C3181CC04CF10028B84B /* LThreadCommon.cpp */, ); name = Threads; sourceTree = ""; }; 3477C31A1CC04D290028B84B /* Network */ = { isa = PBXGroup; children = ( 346FACE91D3C75AE00FFEBCE /* GUri.cpp */, 346FACEA1D3C75AE00FFEBCE /* MDStringToDigest.cpp */, 3477C31B1CC04D3F0028B84B /* INet.cpp */, 3477C31C1CC04D3F0028B84B /* INetTools.cpp */, ); name = Network; sourceTree = ""; }; 3477C33B1CC0881E0028B84B /* Files */ = { isa = PBXGroup; children = ( 3477C33C1CC088590028B84B /* GFileCommon.cpp */, 3477C2A91CBF22A00028B84B /* GFile.h */, 3477C2941CBF09320028B84B /* GFile.mm */, ); name = Files; sourceTree = ""; }; 3477C34E1CC0C3A30028B84B /* Link */ = { isa = PBXGroup; children = ( 3477C34F1CC0C3D60028B84B /* Cocoa.framework */, ); name = Link; sourceTree = ""; }; 3477C4051CC22F920028B84B /* Process */ = { isa = PBXGroup; children = ( ); name = Process; sourceTree = ""; }; /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ 3477C2651CBF020F0028B84B /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( 343874B8230F46B200CF96B4 /* GLayout.h in Headers */, 3477C2AC1CBF72170028B84B /* GViewPriv.h in Headers */, 3477C35D1CC2253E0028B84B /* LgiInterfaces.h in Headers */, 3477C2A51CBF0A920028B84B /* LgiOsClasses.h in Headers */, 34B531D822F65734002B50F7 /* LMenu.h in Headers */, 34114C8B23091E6E00F342B1 /* LgiClasses.h in Headers */, 3477C35B1CC1AEEA0028B84B /* LgiInc.h in Headers */, 348362421F233A77003B2A6D /* GStream.h in Headers */, 3477C2A61CBF0A920028B84B /* LgiOsDefs.h in Headers */, 34D21CEC217981AE003D1EA6 /* GEventTargetThread.h in Headers */, 3477C2A11CBF0A920028B84B /* GMem.h in Headers */, 3477C2D51CC0481B0028B84B /* GArray.h in Headers */, 3477C5171CC303B70028B84B /* LgiClass.h in Headers */, 3477C2AA1CBF22A00028B84B /* GFile.h in Headers */, 343874B5230F46B200CF96B4 /* GWindow.h in Headers */, 3477C2A21CBF0A920028B84B /* GSymLookup.h in Headers */, 34D6AA1722D3749A005D739E /* Gdc2.h in Headers */, 3477C2A41CBF0A920028B84B /* LgiOs.h in Headers */, 343874B7230F46B200CF96B4 /* GApp.h in Headers */, 3477C26C1CBF020F0028B84B /* LgiProject.h in Headers */, 345921011F25649000098DFD /* GFontSelect.h in Headers */, 346FACE71D3C720B00FFEBCE /* GMessage.h in Headers */, 3477C2A31CBF0A920028B84B /* LgiMac.h in Headers */, 343874B6230F46B200CF96B4 /* GView.h in Headers */, 345920FF1F25649000098DFD /* GFont.h in Headers */, 3477C2A81CBF0AAF0028B84B /* Lgi.h in Headers */, 345921001F25649000098DFD /* GFontCache.h in Headers */, 3477C2C31CC045840028B84B /* GMem.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 = 0930; ORGANIZATIONNAME = Memecode; TargetAttributes = { 3477C2671CBF020F0028B84B = { CreatedOnToolsVersion = 7.3; }; }; }; buildConfigurationList = 3477C2621CBF020F0028B84B /* Build configuration list for PBXProject "LgiCocoa" */; compatibilityVersion = "Xcode 3.2"; developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( en, ); 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 = ( 3477C2CE1CC047BE0028B84B /* GFontCodePages.cpp in Sources */, 3477C3111CC04C790028B84B /* GCssTools.cpp in Sources */, 34A3ACE820568D5800B1D62A /* LStringLayout.cpp in Sources */, 3477C2DB1CC048F90028B84B /* GDisplayString.cpp in Sources */, 3477C33A1CC04ED90028B84B /* GDragAndDrop.mm in Sources */, 3477C2DC1CC048F90028B84B /* GFont.cpp in Sources */, 3477C2831CBF086A0028B84B /* GLayout.mm in Sources */, 3477C34D1CC0ACED0028B84B /* md5.c in Sources */, 3477C2C81CC046310028B84B /* GTextView3.cpp in Sources */, 3477C2861CBF086A0028B84B /* LThread.mm in Sources */, 3477C2821CBF086A0028B84B /* GGeneral.mm in Sources */, 3477C3131CC04CB10028B84B /* GRect.cpp in Sources */, 3477C3451CC0A9DE0028B84B /* GInput.cpp in Sources */, 3477C31D1CC04D3F0028B84B /* INet.cpp in Sources */, 3477C28F1CBF08C10028B84B /* Gdc2.mm in Sources */, 3477C30A1CC04BF00028B84B /* GTabView.cpp in Sources */, 3477C33F1CC0A6780028B84B /* GToken.cpp in Sources */, 3477C2D01CC047F50028B84B /* GToolBar.cpp in Sources */, 3477C3011CC04BF00028B84B /* GButton.cpp in Sources */, 3477C3061CC04BF00028B84B /* GProgress.cpp in Sources */, 347D192121B1F5700008C4CB /* GFont_W.cpp in Sources */, 3477C3001CC04BF00028B84B /* GBox.cpp in Sources */, 3477C2871CBF086A0028B84B /* GView.mm in Sources */, 3477C3021CC04BF00028B84B /* GCheckBox.cpp in Sources */, 3477C2BB1CBF97C80028B84B /* GdcCommon.cpp in Sources */, 3477C2E51CC04A7F0028B84B /* GViewCommon.cpp in Sources */, 34131710230694D1008CE982 /* Gel.cpp in Sources */, 3477C2D71CC048390028B84B /* GPopup.cpp in Sources */, 3477C3091CC04BF00028B84B /* GTableLayout.cpp in Sources */, 3477C2E11CC04A3C0028B84B /* GFontSelect.cpp in Sources */, 3477C2DF1CC04A030028B84B /* GScrollBar.cpp in Sources */, 3477C2F11CC04BBB0028B84B /* GTree.cpp in Sources */, 3413170E23068FFE008CE982 /* GFileSelect.cpp in Sources */, 3477C3281CC04E020028B84B /* GVariant.cpp in Sources */, 3477C2AF1CBF96B90028B84B /* LgiRes.cpp in Sources */, 3477C3161CC04CCB0028B84B /* GLibrary.cpp in Sources */, 3477C3051CC04BF00028B84B /* GPanel.cpp in Sources */, 3477C2901CBF08C10028B84B /* GMemDC.cpp in Sources */, 3477C30D1CC04C560028B84B /* GFindReplace.cpp in Sources */, 3477C34B1CC0AB0B0028B84B /* GToolTip.cpp in Sources */, 3477C3201CC04D630028B84B /* LThreadEvent.cpp in Sources */, 3477C3031CC04BF00028B84B /* GCombo.cpp in Sources */, 3477C30B1CC04BF00028B84B /* GTextLabel.cpp in Sources */, 3477C2B71CBF973F0028B84B /* GGuiUtils.cpp in Sources */, 3477C2911CBF08C10028B84B /* GPrintDC.cpp in Sources */, 3477C2B91CBF977F0028B84B /* LgiCommon.cpp in Sources */, 34D1B3C121748A2800BC6B58 /* GPath.cpp in Sources */, 3477C2CA1CC046310028B84B /* GUtf8.cpp in Sources */, 3477C2971CBF09320028B84B /* GFile.mm in Sources */, 3477C43A1CC234750028B84B /* GMemStream.cpp in Sources */, 3477C3191CC04CF10028B84B /* LThreadCommon.cpp in Sources */, 3477C2781CBF08050028B84B /* GClipBoard.mm in Sources */, 346FACEC1D3C75AE00FFEBCE /* MDStringToDigest.cpp in Sources */, 3477C3491CC0AA7E0028B84B /* GProgressDlg.cpp in Sources */, 346FACEB1D3C75AE00FFEBCE /* GUri.cpp in Sources */, 3477C2B11CBF96C40028B84B /* Res.cpp in Sources */, 3477C4ED1CC27F1C0028B84B /* GTrayIcon.cpp in Sources */, 3477C2991CBF09320028B84B /* ShowFileProp_Mac.mm in Sources */, 3477C2921CBF08C10028B84B /* GScreenDC.cpp in Sources */, 3477C2981CBF09320028B84B /* GMem.mm in Sources */, 3477C2CB1CC046310028B84B /* GXmlTree.cpp in Sources */, 3477C2EF1CC04BBB0028B84B /* GItemContainer.cpp in Sources */, 3477C3081CC04BF00028B84B /* GSplitter.cpp in Sources */, 34109857217A9805007020CE /* LCocoaView.mm in Sources */, 3477C46D1CC26DEB0028B84B /* GAlert.cpp in Sources */, 3477C3381CC04E120028B84B /* Alpha.cpp in Sources */, 3477C2EB1CC04B890028B84B /* GFilter.cpp in Sources */, 3477C3321CC04E120028B84B /* 15Bit.cpp in Sources */, 3477C3041CC04BF00028B84B /* GEdit.cpp in Sources */, 3477C3361CC04E120028B84B /* 48Bit.cpp in Sources */, 3477C3261CC04DE20028B84B /* LMutex.cpp in Sources */, 3477C2851CBF086A0028B84B /* GPrinter.mm in Sources */, 3477C33D1CC088590028B84B /* GFileCommon.cpp in Sources */, 3477C3471CC0AA220028B84B /* GWindowCommon.cpp in Sources */, 3477C3071CC04BF00028B84B /* GRadioGroup.cpp in Sources */, 3477C2FF1CC04BF00028B84B /* GBitmap.cpp in Sources */, 3477C2E91CC04B5D0028B84B /* LgiRand.cpp in Sources */, 3477C2E71CC04B1E0028B84B /* GSurface.cpp in Sources */, 3477C3371CC04E120028B84B /* 64Bit.cpp in Sources */, 3477C3241CC04DD70028B84B /* GObject.cpp in Sources */, 3477C2E31CC04A5C0028B84B /* GStream.cpp in Sources */, 34A3ACEA20568D9700B1D62A /* LMenuCommon.cpp in Sources */, 3477C3341CC04E120028B84B /* 24Bit.cpp in Sources */, 3477C3351CC04E120028B84B /* 32Bit.cpp in Sources */, 3477C31E1CC04D3F0028B84B /* INetTools.cpp in Sources */, 3477C2881CBF086A0028B84B /* GWidgets.mm in Sources */, 3477C2891CBF086A0028B84B /* GWindow.mm in Sources */, 3477C3431CC0A6B90028B84B /* GDocView.cpp in Sources */, 3477C2841CBF086A0028B84B /* LMenu.mm in Sources */, 3477C2B41CBF96F20028B84B /* LgiMsg.cpp in Sources */, 3477C3311CC04E120028B84B /* 8Bit.cpp in Sources */, 3477C2DD1CC048F90028B84B /* GFontSystem.cpp in Sources */, 3477C3101CC04C790028B84B /* GCss.cpp in Sources */, 3477C2C91CC046310028B84B /* GUnicode.cpp in Sources */, 3477C3221CC04DA00028B84B /* GColour.cpp in Sources */, 3477C2D31CC048100028B84B /* GContainers.cpp in Sources */, 3477C2F01CC04BBB0028B84B /* LList.cpp in Sources */, 3477C3331CC04E120028B84B /* 16Bit.cpp in Sources */, 3477C2751CBF07DD0028B84B /* GApp.mm in Sources */, 3477C3411CC0A68E0028B84B /* LDateTime.cpp in Sources */, 3477C2C11CBF9A040028B84B /* GString.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 = "gnu++0x"; 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_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 = "-"; COPY_PHASE_STRIP = NO; CURRENT_PROJECT_VERSION = 1; 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.9; 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 = "gnu++0x"; 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_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 = "-"; COPY_PHASE_STRIP = NO; CURRENT_PROJECT_VERSION = 1; 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.9; 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_ARC = YES; CLANG_ENABLE_OBJC_WEAK = YES; COMBINE_HIDPI_IMAGES = YES; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; FRAMEWORK_VERSION = A; HEADER_SEARCH_PATHS = ( ../../../include/common, ../../../include/mac/cocoa, ); INFOPLIST_FILE = Lgi/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; MACOSX_DEPLOYMENT_TARGET = 10.10; OTHER_CFLAGS = ( "-DMAC", "-DLGI_COCOA=1", "-DLGI_LIBRARY", "-D_DEBUG", ); OTHER_CPLUSPLUSFLAGS = ( "-DMAC", "-DLGI_COCOA=1", "-DLGI_LIBRARY", "-D_DEBUG", ); PRODUCT_BUNDLE_IDENTIFIER = com.memecode.Lgi; PRODUCT_NAME = LgiCocoa; SDKROOT = macosx; SKIP_INSTALL = YES; VALID_ARCHS = x86_64; WARNING_CFLAGS = "-Wno-nullability-completeness"; }; name = Debug; }; 3477C2721CBF020F0028B84B /* Release */ = { isa = XCBuildConfiguration; buildSettings = { CLANG_ANALYZER_NONNULL = YES_NONAGGRESSIVE; + CLANG_ENABLE_OBJC_ARC = YES; CLANG_ENABLE_OBJC_WEAK = YES; COMBINE_HIDPI_IMAGES = YES; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; FRAMEWORK_VERSION = A; HEADER_SEARCH_PATHS = ( ../../../include/common, ../../../include/mac/cocoa, ); INFOPLIST_FILE = Lgi/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; MACOSX_DEPLOYMENT_TARGET = 10.10; OTHER_CFLAGS = ( "-DMAC", "-DLGI_COCOA=1", "-DLGI_LIBRARY", ); OTHER_CPLUSPLUSFLAGS = ( "-DMAC", "-DLGI_COCOA=1", "-DLGI_LIBRARY", ); PRODUCT_BUNDLE_IDENTIFIER = com.memecode.Lgi; PRODUCT_NAME = LgiCocoa; SDKROOT = macosx; SKIP_INSTALL = YES; VALID_ARCHS = x86_64; 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/common/GMemDC.cpp b/src/mac/common/GMemDC.cpp --- a/src/mac/common/GMemDC.cpp +++ b/src/mac/common/GMemDC.cpp @@ -1,702 +1,702 @@ /*hdr ** FILE: GMemDC.h ** AUTHOR: Matthew Allen ** DATE: 27/11/2001 ** DESCRIPTION: GDC v2.xx header ** ** Copyright (C) 2001, Matthew Allen ** fret@memecode.com */ #include #include #include "Gdc2.h" #include "GdiLeak.h" #include "GPalette.h" #import #define AlphaType kCGImageAlphaPremultipliedLast ///////////////////////////////////////////////////////////////////////////////////////////////////// class CGImgPriv { public: CGImageRef Img; CGColorSpaceRef Cs; CGDataProviderRef Prov; CGImgPriv() { Img = 0; Cs = 0; Prov = 0; } ~CGImgPriv() { if (Img) { CGImageRelease(Img); Img = 0; } if (Cs) { CGColorSpaceRelease(Cs); Cs = 0; } if (Prov) { CGDataProviderRelease(Prov); Prov = 0; } } }; void ReleaseCGImg(void *info, const void *data, size_t size) { } CGImg::CGImg(GSurface *pDC) { d = new CGImgPriv; if (pDC) { uchar *a = (*pDC)[0]; uchar *b = (*pDC)[1]; if (a && b) Create(pDC->X(), pDC->Y(), pDC->GetBits(), (int)(b - a), a, 0, 0); } } CGImg::CGImg(int x, int y, int Bits, ssize_t Line, uchar *data, uchar *palette, GRect *r) { d = new CGImgPriv; Create(x, y, Bits, Line, data, palette, r); } void CGImg::Create(int x, int y, int Bits, ssize_t Line, uchar *data, uchar *palette, GRect *r) { GRect All(0, 0, x-1, y-1); GRect B; if (r) { B = *r; B.Bound(&All); } else { B = All; } int Bytes = Bits / 8; uchar *Base = data + (Line * B.y1) + (Bytes * B.x1); if (Bits <= 8) { int Entries = 1 << Bits; CGColorSpaceRef Rgb = CGColorSpaceCreateDeviceRGB(); if (Rgb) { d->Cs = CGColorSpaceCreateIndexed(Rgb, Entries - 1, palette); CGColorSpaceRelease(Rgb); } } else { d->Cs = CGColorSpaceCreateWithName(kCGColorSpaceSRGB); } if (d->Cs) { d->Prov = CGDataProviderCreateWithData(d, Base, Line * y, ReleaseCGImg); if (d->Prov) { d->Img = CGImageCreate ( B.X(), B.Y(), Bits == 16 ? 5 : 8, Bits, ABS(Line), d->Cs, Bits == 32 ? AlphaType : kCGImageAlphaNone, d->Prov, 0, false, kCGRenderingIntentDefault ); if (!d->Img) { printf("%s:%i - CGImageCreate(%i, %i, %i, %i, " LPrintfSSizeT ", ...) failed.\n", _FL, B.X(), B.Y(), Bits == 16 ? 5 : 8, Bits, Line ); } } else { // printf("%s:%i - CGDataProviderCreateWithData failed.\n", _FL); } } else { printf("%s:%i - ColourSpace creation failed.\n", _FL); } } CGImg::~CGImg() { DeleteObj(d); } CGImg::operator CGImageRef() { return d->Img; } ///////////////////////////////////////////////////////////////////////////////////////////////////// class GMemDCPrivate { public: uchar *Data; CGContextRef Bmp; CGColorSpaceRef Cs; GRect Client; GAutoPtr BitsMem; GMemDCPrivate() { Cs = NULL; Data = NULL; Bmp = NULL; } ~GMemDCPrivate() { Empty(); } void Empty() { if (Bmp) { CGContextRelease(Bmp); Bmp = 0; } if (Cs) { CGColorSpaceRelease(Cs); Cs = 0; } BitsMem.Reset(); Data = NULL; } }; GMemDC::GMemDC(int x, int y, GColourSpace cs, int flags) { d = new GMemDCPrivate; pMem = 0; if (x && y && cs) { Create(x, y, cs, flags); } } GMemDC::GMemDC(GSurface *pDC) { d = new GMemDCPrivate; pMem = 0; if (pDC && Create(pDC->X(), pDC->Y(), pDC->GetColourSpace()) ) { if (pDC->Palette()) { Palette(new GPalette(pDC->Palette())); } Blt(0, 0, pDC); if (pDC->AlphaDC() && HasAlpha(true)) { pAlphaDC->Blt(0, 0, pDC->AlphaDC()); } } } GMemDC::~GMemDC() { Empty(); DeleteObj(d); } void MemRelease(void * __nullable info, const void * data, size_t size) { uint8_t *p = (uint8_t*)data; DeleteArray(p); } #if LGI_COCOA NSImage *GMemDC::NsImage(GRect *rc) { if (!pMem || !pMem->Base) return nil; GRect r; if (rc) r = *rc; else r = Bounds(); size_t bitsPerComponent = 8; size_t bitsPerPixel = GetBits(); size_t bytesPerRow = (bitsPerPixel * r.X() + 7) / bitsPerComponent; CGDataProviderRef provider = nil; GArray Mem; if (rc) { GAutoPtr Sub(SubImage(r)); if (!Sub) return nil; auto p = Sub->pMem; // Need to collect all the image data into one place. if (!Mem.Length(p->y * bytesPerRow)) return nil; auto dst = Mem.AddressOf(); for (int y=0; yy; y++) { auto src = p->Base + (y * p->Line); LgiAssert(dst + bytesPerRow <= Mem.AddressOf() + Mem.Length()); LgiAssert(src + bytesPerRow <= pMem->Base + (pMem->y * pMem->Line)); memcpy(dst, src, bytesPerRow); dst += bytesPerRow; } auto len = Mem.Length(); provider = CGDataProviderCreateWithData(NULL, Mem.Release(), len, MemRelease); } else { // Just use the existing data... provider = CGDataProviderCreateWithData(NULL, pMem->Base, pMem->y * pMem->Line, NULL); } CGColorSpaceRef colorSpaceRef = CGColorSpaceCreateDeviceRGB(); // CGBitmapInfo bitmapInfo = kCGBitmapByteOrderDefault | kCGImageAlphaPremultipliedLast; CGBitmapInfo bitmapInfo = kCGBitmapByteOrderDefault | kCGImageAlphaLast; CGColorRenderingIntent renderingIntent = kCGRenderingIntentDefault; CGImageRef iref = CGImageCreate(r.X(), r.Y(), bitsPerComponent, bitsPerPixel, bytesPerRow, colorSpaceRef, bitmapInfo, provider, // data provider NULL, // decode YES, // should interpolate renderingIntent); auto img = [[NSImage alloc] initWithCGImage:iref size:NSMakeSize(r.X(), r.Y())]; CGImageRelease(iref); return img; } #endif void GMemDC::Empty() { DeleteObj(pMem); } bool GMemDC::SupportsAlphaCompositing() { return true; } GRect GMemDC::ClipRgn(GRect *Rgn) { GRect Old = Clip; if (Rgn) { GRect Dc(0, 0, X()-1, Y()-1); Clip = *Rgn; Clip.Offset(-OriginX, -OriginY); Clip.Bound(&Dc); } else { Clip.ZOff(X()-1, Y()-1); } return Old; } CGImg *GMemDC::GetImg(GRect *Sub) { if (!pMem) return 0; uchar *rgb = pPalette ? (uchar*)((*pPalette)[0]) : 0; return new CGImg ( pMem->x, pMem->y, pMem->GetBits(), pMem->Line, d->Data, rgb, Sub ); } OsBitmap GMemDC::GetBitmap() { return 0; } OsPainter GMemDC::Handle() { return d->Bmp; } bool GMemDC::Lock() { return true; } bool GMemDC::Unlock() { return true; } bool GMemDC::Create(int x, int y, GColourSpace Cs, int Flags) { bool Status = false; d->Empty(); if (x > 0 && y > 0 && Cs != CsNone) { int Bits = GColourSpaceToBits(Cs); size_t LineLen = ((Bits * x + 31) / 32) * 4; if (Bits > 16) { d->Cs = CGColorSpaceCreateDeviceRGB(); d->Bmp = CGBitmapContextCreate ( NULL, x, y, 8, 0, d->Cs, Bits == 32 ? AlphaType : kCGImageAlphaNoneSkipLast ); if (d->Bmp) { LineLen = CGBitmapContextGetBytesPerRow(d->Bmp); d->Data = (uint8*) CGBitmapContextGetData(d->Bmp); } } pMem = new GBmpMem; if (pMem) { pMem->Flags = 0; pMem->x = x; pMem->y = y; if (d->Bmp && d->Data) { pMem->Base = (uchar*)d->Data; pMem->Line = LineLen; switch (CGBitmapContextGetBitsPerPixel(d->Bmp)) { case 24: case 32: { CGImageAlphaInfo ai = CGBitmapContextGetAlphaInfo(d->Bmp); switch (ai) { case kCGImageAlphaNone: pMem->Cs = CsRgb24; break; case kCGImageAlphaLast: /* For example, non-premultiplied RGBA */ case kCGImageAlphaNoneSkipLast: /* For example, RGBX. */ pMem->Cs = CsRgba32; break; case kCGImageAlphaPremultipliedLast: /* For example, premultiplied RGBA */ pMem->Cs = CsRgba32; pMem->Flags |= GBmpMem::BmpPreMulAlpha; break; case kCGImageAlphaFirst: /* For example, non-premultiplied ARGB */ case kCGImageAlphaNoneSkipFirst: /* For example, XRGB. */ pMem->Cs = CsArgb32; break; case kCGImageAlphaPremultipliedFirst: /* For example, premultiplied ARGB */ pMem->Cs = CsArgb32; pMem->Flags |= GBmpMem::BmpPreMulAlpha; break; default: LgiAssert(0); break; } break; } default: { LgiAssert(0); break; } } if (pMem->Cs != Cs && Flags == GSurface::SurfaceRequireExactCs) { // Surface type mismatch... throw away the system bitmap and allocate // the exact type just in our memory. d->Empty(); pMem->Base = NULL; } } if (!pMem->Base) { pMem->Line = ((Bits * x + 31) / 32) * 4; pMem->Base = new uint8[pMem->Line * y]; pMem->Flags |= GBmpMem::BmpOwnMemory; pMem->Cs = Cs; } ColourSpace = pMem->Cs; int NewOp = (pApp) ? Op() : GDC_SET; if ((Flags & GDC_OWN_APPLICATOR) && !(Flags & GDC_CACHED_APPLICATOR)) { DeleteObj(pApp); } for (int i=0; iCs; } void GMemDC::Blt(int x, int y, GSurface *Src, GRect *a) { if (!Src) return; if (Src->IsScreen()) { CGRect r; if (a) r = *a; else r = Src->Bounds(); CGImageRef Img = CGWindowListCreateImage(r, kCGWindowListOptionOnScreenOnly, kCGNullWindowID, kCGWindowImageDefault); if (Img) { GRect dr(0, 0, (int)CGImageGetWidth(Img)-1, (int)CGImageGetHeight(Img)-1); CGContextDrawImage(d->Bmp, dr, Img); CGImageRelease(Img); // Overlay any effects between the screen and cursor layers... OnCaptureScreen(); // Do we need to capture the cursor as well? if (TestFlag(Flags, GDC_CAPTURE_CURSOR)) { // Capture the cursor as well.. NSImage *cursor = [[[NSCursor currentSystemCursor] image] copy]; if (cursor) { #if LGI_COCOA #warning "Impl cursor blt" #else // NSPoint hotSpot = [[NSCursor currentSystemCursor] hotSpot]; HIPoint p; HIGetMousePosition(kHICoordSpaceScreenPixel, NULL, &p); GRect msr(0, 0, (int)cursor.size.width-1, (int)cursor.size.height-1); msr.Offset(p.x - (int)r.origin.x, p.y - (int)r.origin.y); printf("msr=%s\n", msr.GetStr()); CGContextDrawImage(d->Bmp, msr, [cursor CGImageForProposedRect: NULL context: NULL hints: NULL]); #endif - [cursor release]; + // [cursor release]; } } } else printf("%s:%i - CGWindowListCreateImage failed.\n", _FL); } else { GSurface::Blt(x, y, Src, a); } } void GMemDC::StretchBlt(GRect *d, GSurface *Src, GRect *s) { if (Src) { GRect DestR; if (d) { DestR = *d; } else { DestR.ZOff(X()-1, Y()-1); } GRect SrcR; if (s) { SrcR = *s; } else { SrcR.ZOff(Src->X()-1, Src->Y()-1); } } } void GMemDC::HorzLine(int x1, int x2, int y, COLOUR a, COLOUR b) { if (x1 > x2) LgiSwap(x1, x2); if (x1 < Clip.x1) x1 = Clip.x1; if (x2 > Clip.x2) x2 = Clip.x2; if ( x1 <= x2 && y >= Clip.y1 && y <= Clip.y2) { COLOUR Prev = pApp->c; pApp->SetPtr(x1, y); for (; x1 <= x2; x1++) { if (x1 & 1) { pApp->c = a; } else { pApp->c = b; } pApp->Set(); pApp->IncX(); } pApp->c = Prev; } } void GMemDC::VertLine(int x, int y1, int y2, COLOUR a, COLOUR b) { if (y1 > y2) LgiSwap(y1, y2); if (y1 < Clip.y1) y1 = Clip.y1; if (y2 > Clip.y2) y2 = Clip.y2; if (y1 <= y2 && x >= Clip.x1 && x <= Clip.x2) { COLOUR Prev = pApp->c; pApp->SetPtr(x, y1); for (; y1 <= y2; y1++) { if (y1 & 1) { pApp->c = a; } else { pApp->c = b; } pApp->Set(); pApp->IncY(); } pApp->c = Prev; } } void GMemDC::SetOrigin(int x, int y) { GSurface::SetOrigin(x, y); } void GMemDC::SetClient(GRect *c) { if (c) { GRect Doc = Bounds(); d->Client = *c; d->Client.Bound(&Doc); Clip = d->Client; OriginX = -d->Client.x1; OriginY = -d->Client.y1; } else { d->Client.ZOff(-1, -1); OriginX = 0; OriginY = 0; Clip.ZOff(pMem->x-1, pMem->y-1); } }