From ef27dd85a00687a8b4a21b56a6ea9170b1c146b5 Mon Sep 17 00:00:00 2001 From: mitchell <70453897+667e-11@users.noreply.github.com> Date: Thu, 28 Oct 2010 17:52:35 -0400 Subject: Rename MAC variable in to OSX in Lua, __OSX__ in C. --- core/._G.luadoc | 2 +- core/args.lua | 2 +- core/events.lua | 2 +- modules/lua/commands.lua | 2 +- modules/textadept/keys.lua | 6 +++--- modules/textadept/menu.lua | 2 +- src/textadept.c | 20 ++++++++++---------- themes/dark/lexer.lua | 2 +- themes/light/lexer.lua | 2 +- themes/scite/lexer.lua | 2 +- 10 files changed, 21 insertions(+), 21 deletions(-) diff --git a/core/._G.luadoc b/core/._G.luadoc index dfac3e30..94c6dfa4 100644 --- a/core/._G.luadoc +++ b/core/._G.luadoc @@ -19,7 +19,7 @@ module('_G') -- * `RESETTING`: If [`reset()`][reset] has been called, -- this flag is `true` while the Lua state is being re-initialized. -- * `WIN32`: If Textadept is running on Windows, this flag is `true`. --- * `MAC`: If Textadept is running on Mac OSX, this flag is `true`. +-- * `OSX`: If Textadept is running on Mac OSX, this flag is `true`. -- -- [package_path]: http://www.lua.org/manual/5.1/manual.html#pdf-package.path -- [theme]: ../manual/6_Startup.html diff --git a/core/args.lua b/core/args.lua index d145008d..c7027e0d 100644 --- a/core/args.lua +++ b/core/args.lua @@ -72,7 +72,7 @@ if WIN32 and #arg[0] > 0 then end -- For Mac, remove junk parameter if necessary. -if MAC and arg[1] and arg[1]:find('^%-psn_0') then table.remove(arg, 1) end +if OSX and arg[1] and arg[1]:find('^%-psn_0') then table.remove(arg, 1) end -- Set _G._USERHOME. local userhome = os.getenv(not WIN32 and 'HOME' or 'USERPROFILE')..'/.textadept' diff --git a/core/events.lua b/core/events.lua index a7068dcd..2157f58d 100644 --- a/core/events.lua +++ b/core/events.lua @@ -427,7 +427,7 @@ connect('quit', return true end) -if MAC then +if OSX then connect('appleevent_odoc', function(uri) return emit('uri_dropped', 'file://'..uri) end) diff --git a/modules/lua/commands.lua b/modules/lua/commands.lua index fef5713f..c6a65bcb 100644 --- a/modules/lua/commands.lua +++ b/modules/lua/commands.lua @@ -248,7 +248,7 @@ if type(keys) == 'table' then g = { goto_required }, }, ['s\n'] = { try_to_autocomplete_end }, - [not MAC and 'c\n' or 'esc'] = { function() -- complete API + [not OSX and 'c\n' or 'esc'] = { function() -- complete API local part = prev_word('[%w_]', buffer.current_pos) local pos = buffer.current_pos - #part - 1 if pos > 0 then diff --git a/modules/textadept/keys.lua b/modules/textadept/keys.lua index a8c09656..baea06a8 100644 --- a/modules/textadept/keys.lua +++ b/modules/textadept/keys.lua @@ -134,7 +134,7 @@ local gui = gui -- Control, Shift, Alt, and 'a' = 'caA' -- Control, Shift, Alt, and '\t' = 'csa\t' -if not MAC then +if not OSX then -- Windows and Linux key commands. --[[ @@ -496,7 +496,7 @@ local pcall = _G.pcall local next = _G.next local type = _G.type local unpack = _G.unpack -local MAC = _G.MAC +local OSX = _G.OSX --- -- Lookup table for key values higher than 255. @@ -594,7 +594,7 @@ local function keypress(code, shift, control, alt) if code < 256 then key = string_char(code) shift = false -- for printable characters, key is upper case - if MAC and not shift and not control and not alt then + if OSX and not shift and not control and not alt then local ch = string_char(code) -- work around native GTK-OSX's handling of Alt key if ch:find('[%p%d]') and #keychain == 0 then diff --git a/modules/textadept/menu.lua b/modules/textadept/menu.lua index daf3f6df..40e2c516 100644 --- a/modules/textadept/menu.lua +++ b/modules/textadept/menu.lua @@ -329,7 +329,7 @@ local function open_webpage(url) local p = io.popen(cmd) if not p then error(L('Error loading webpage:')..url) end else - cmd = string.format(MAC and 'open "file://%s"' or 'xdg-open "%s" &', url) + cmd = string.format(OSX and 'open "file://%s"' or 'xdg-open "%s" &', url) if os.execute(cmd) ~= 0 then error(L('Error loading webpage:')..url) end end end diff --git a/src/textadept.c b/src/textadept.c index 64d85f9c..59d2ca4b 100644 --- a/src/textadept.c +++ b/src/textadept.c @@ -19,7 +19,7 @@ #if __WIN32__ #include #define main main_ -#elif MAC +#elif __OSX__ #include #include "ige-mac-menu.h" #define GDK_MOD1_MASK GDK_META_MASK @@ -65,7 +65,7 @@ static gbool s_buttonpress(GtkWidget *, GdkEventButton *, gpointer); static gbool w_focus(GtkWidget *, GdkEventFocus *, gpointer); static gbool w_keypress(GtkWidget *, GdkEventKey *, gpointer); static gbool w_exit(GtkWidget *, GdkEventAny *, gpointer); -#if MAC +#if __OSX__ static OSErr w_ae_open(const AppleEvent *, AppleEvent *, long); static OSErr w_ae_quit(const AppleEvent *, AppleEvent *, long); #endif @@ -146,9 +146,9 @@ static int l_cf_buffer_delete(lua_State *), l_cf_buffer_text_range(lua_State *), * @param argv The array of command line params. */ int main(int argc, char **argv) { -#if !(__WIN32__ || MAC || __BSD__) +#if !(__WIN32__ || __OSX__ || __BSD__) textadept_home = g_file_read_link("/proc/self/exe", NULL); -#elif MAC +#elif __OSX__ CFURLRef bundle = CFBundleCopyBundleURL(CFBundleGetMainBundle()); if (bundle) { CFStringRef path = CFURLCopyFileSystemPath(bundle, kCFURLPOSIXPathStyle); @@ -222,7 +222,7 @@ void create_ui() { signal(window, "focus-in-event", w_focus); signal(window, "key-press-event", w_keypress); -#if MAC +#if __OSX__ AEInstallEventHandler(kCoreEventClass, kAEOpenDocuments, NewAEEventHandlerUPP(w_ae_open), 0, FALSE); AEInstallEventHandler(kCoreEventClass, kAEQuitApplication, @@ -272,7 +272,7 @@ void create_ui() { statusbar[1] = gtk_statusbar_new(); gtk_statusbar_push(GTK_STATUSBAR(statusbar[1]), 0, ""); g_object_set(G_OBJECT(statusbar[1]), "width-request", 400, NULL); -#if MAC +#if __OSX__ gtk_statusbar_set_has_resize_grip(GTK_STATUSBAR(statusbar[1]), FALSE); #endif gtk_box_pack_start(GTK_BOX(hboxs), statusbar[1], FALSE, FALSE, 0); @@ -456,7 +456,7 @@ void set_menubar(GtkWidget *new_menubar) { gtk_box_pack_start(GTK_BOX(vbox), menubar, FALSE, FALSE, 0); gtk_box_reorder_child(GTK_BOX(vbox), menubar, 0); gtk_widget_show_all(menubar); -#if MAC +#if __OSX__ ige_mac_menu_set_menu_bar(GTK_MENU_SHELL(menubar)); gtk_widget_hide(menubar); #endif @@ -574,7 +574,7 @@ static gbool w_exit(GtkWidget *window, GdkEventAny *event, gpointer udata) { return FALSE; } -#if MAC +#if __OSX__ /** * Signal for an Open Document AppleEvent. * Generates a 'appleevent_odoc' event for each document sent. @@ -919,9 +919,9 @@ int l_init(int argc, char **argv, int reinit) { #if __WIN32__ lua_pushboolean(lua, 1); lua_setglobal(lua, "WIN32"); -#elif MAC +#elif __OSX__ lua_pushboolean(lua, 1); - lua_setglobal(lua, "MAC"); + lua_setglobal(lua, "OSX"); #endif const char *charset = 0; g_get_charset(&charset); diff --git a/themes/dark/lexer.lua b/themes/dark/lexer.lua index 9e8fa9e9..5338747e 100644 --- a/themes/dark/lexer.lua +++ b/themes/dark/lexer.lua @@ -41,7 +41,7 @@ local font_face = '!Bitstream Vera Sans Mono' local font_size = 10 if WIN32 then font_face = '!Courier New' -elseif MAC then +elseif OSX then font_face = '!Monaco' font_size = 12 end diff --git a/themes/light/lexer.lua b/themes/light/lexer.lua index 8b059210..30140535 100644 --- a/themes/light/lexer.lua +++ b/themes/light/lexer.lua @@ -48,7 +48,7 @@ local font_face = '!Bitstream Vera Sans Mono' local font_size = 10 if WIN32 then font_face = '!Courier New' -elseif MAC then +elseif OSX then font_face = '!Monaco' font_size = 12 end diff --git a/themes/scite/lexer.lua b/themes/scite/lexer.lua index 6ea97b32..2eeed7b2 100644 --- a/themes/scite/lexer.lua +++ b/themes/scite/lexer.lua @@ -40,7 +40,7 @@ local font_face = '!Monospace' local font_size = 11 if WIN32 then font_face = '!Courier New' -elseif MAC then +elseif OSX then font_face = '!Monaco' font_size = 12 end -- cgit v1.2.3