diff options
author | 2008-03-05 03:09:43 -0500 | |
---|---|---|
committer | 2008-03-05 03:09:43 -0500 | |
commit | 3f77607923f4666c85bf60b0cf8dd53c1859dc63 (patch) | |
tree | e819ee53a7091a19fcfb9b2c8ba9ea9cee4731fb /osx.patch | |
parent | f74d57eaadb80a996a63c39c52acf8543902bb86 (diff) | |
download | textadept-3f77607923f4666c85bf60b0cf8dd53c1859dc63.tar.gz textadept-3f77607923f4666c85bf60b0cf8dd53c1859dc63.zip |
Updated osx.patch.
Diffstat (limited to 'osx.patch')
-rw-r--r-- | osx.patch | 485 |
1 files changed, 280 insertions, 205 deletions
@@ -1,204 +1,288 @@ -diff -r 8c3e7e659b6f core/events.lua ---- a/core/events.lua Fri Nov 16 19:17:44 2007 -0500 -+++ b/core/events.lua Sat Nov 17 23:19:41 2007 -0500 -@@ -372,11 +372,11 @@ add_handler('quit', - end - end - if any then -- list = list..'\nQuit without saving?' -- if os.execute('zenity --question --title Alert '.. -- '--text "'..list..'"') ~= 0 then -- return false -- end -+ if tonumber( cocoa_dialog( 'yesno-msgbox', { -+ title = 'Save?', -+ text = 'Save changes before quitting?', -+ ['informative-text'] = 'You will have to save changes manually.' -+ } ) ) ~= 2 then return false end - end - textadept.io.save_session() - return true -diff -r 8c3e7e659b6f core/ext/find.lua ---- a/core/ext/find.lua Fri Nov 16 19:17:44 2007 -0500 -+++ b/core/ext/find.lua Sat Nov 17 23:19:41 2007 -0500 -@@ -96,7 +96,11 @@ function find.replace(rtext) - function(code) - local ret, val = pcall( loadstring('return '..code) ) - if not ret then -- os.execute('zenity --error --text "'..val:gsub('"', '\\"')..'"') -+ cocoa_dialog( 'msgbox', { -+ title = 'Error', -+ text = 'An error ocurred:', -+ ['informative-text'] = val:gsub('"', '\\"') -+ } ) - error() - end - return val -diff -r 8c3e7e659b6f core/file_io.lua ---- a/core/file_io.lua Fri Nov 16 19:17:44 2007 -0500 -+++ b/core/file_io.lua Sat Nov 17 23:19:41 2007 -0500 -@@ -44,11 +44,12 @@ end - -- specified, the user is prompted to open files from a dialog. - -- @usage textadept.io.open(filename) - function open(filenames) -- if not filenames then -- local directory = '--filename="'..(buffer.filename or '')..'"' -- filenames = io.popen('zenity --file-selection --multiple '.. -- directory):read('*all') -- end -+ filenames = filenames or cocoa_dialog( 'fileselect', { -+ title = 'Open', -+ text = 'Select a file(s) to open', -+ ['select-multiple'] = true, -+ --['with-directory'] = (buffer.filename or ''):match('.+/') -+ } ) - for filename in filenames:gmatch('[^|\n]+') do open_helper(filename) end - end - -@@ -100,8 +101,9 @@ function save_as(buffer, filename) - textadept.check_focused_buffer(buffer) - if not filename then - local directory = '--filename="'..(buffer.filename or '')..'"' -- filename = io.popen('zenity --file-selection --save '.. -- directory..' --confirm-overwrite'):read('*all') -+ filename = cocoa_dialog( 'filesave', { -+ title = 'Save' -+ } ) - end - if #filename > 0 then - buffer.filename = filename:sub(1, -2) -- chomp -@@ -133,10 +135,11 @@ end - -- @usage buffer:close() - function close(buffer) - textadept.check_focused_buffer(buffer) -- if buffer.dirty and os.execute('zenity --question --title Alert '.. -- '--text "Close without saving?"') ~= 0 then -- return false -- end -+ if buffer.dirty and tonumber( cocoa_dialog( 'yesno-msgbox', { -+ title = 'Save?', -+ text = 'Save changes before closing?', -+ ['informative-text'] = 'You will have to save changes manually.' -+ } ) ) ~= 2 then return false end - buffer:delete() - return true - end -diff -r 8c3e7e659b6f core/init.lua ---- a/core/init.lua Fri Nov 16 19:17:44 2007 -0500 -+++ b/core/init.lua Sat Nov 17 23:19:41 2007 -0500 -@@ -14,6 +14,23 @@ function textadept.check_focused_buffer( - end - end +diff -r 809aab656589 core/init.lua +--- a/core/init.lua Tue Mar 04 23:06:41 2008 -0500 ++++ b/core/init.lua Tue Mar 04 20:56:03 2008 -0500 +@@ -6,7 +6,6 @@ require 'iface' + require 'iface' + require 'events' + require 'file_io' +-require 'lua_dialog' -+--- -+-- Displays a CocoaDialog of a specified type with given arguments returning -+-- the result. -+-- @param kind The CocoaDialog type. -+-- @param ... A table of key, value arguments. Each key is a --key switch with -+-- a "value" value. If value is nil, it is omitted and just the switch is -+-- used. -+-- @return string CocoaDialog result. -+function cocoa_dialog(kind, opts) + --- + -- Checks if the buffer being indexed is the currently focused buffer. +@@ -31,10 +30,13 @@ end + -- used. + -- @return string CocoaDialog result. + function cocoa_dialog(kind, opts) +- local args = { kind } + local args = '' -+ for k, v in pairs(opts) do + for k, v in pairs(opts) do +- args[#args + 1] = '--'..k +- if type(v) == 'string' then args[#args + 1] = v end + args = args..' --'..k + if type(v) == 'string' then args = args..' "'..v..'"' end -+ end -+ return io.popen('CocoaDialog '..kind..args):read('*all') -+end -+ - package.path = package.path..';'.._HOME..'/core/?.lua' - - require 'iface' -diff -r 8c3e7e659b6f modules/textadept/editing.lua ---- a/modules/textadept/editing.lua Fri Nov 16 19:17:44 2007 -0500 -+++ b/modules/textadept/editing.lua Sat Nov 17 23:19:41 2007 -0500 -@@ -219,9 +219,12 @@ function goto_line(line) - function goto_line(line) - local buffer = buffer - if not line then -- line = io.popen('zenity --entry --title "Go To" '.. -- '--text "Line Number:"'):read('*all') -- if line == '' then return end -+ line = cocoa_dialog( 'standard-inputbox', { -+ title = 'Go To', -+ text = 'Line Number:', -+ ['no-newline'] = true -+ } ):match('%d+$') -+ if not line then return end - line = tonumber(line) - end - buffer:ensure_visible_enforce_policy(line - 1) -diff -r 8c3e7e659b6f modules/textadept/macros.lua ---- a/modules/textadept/macros.lua Fri Nov 16 19:17:44 2007 -0500 -+++ b/modules/textadept/macros.lua Sat Nov 17 23:19:41 2007 -0500 -@@ -66,9 +66,12 @@ function stop_recording() - recording = false - local textadept = textadept - local bf, bp = textadept.buffer_functions, textadept.buffer_properties -- local macro_name = -- io.popen('zenity --entry --text "Macro name:"'):read('*all'):sub(1, -2) -- if #macro_name > 0 then -+ local macro_name = cocoa_dialog( 'standard-inputbox', { -+ title = 'Save Macro', -+ text = 'Macro name:', -+ ['no-newline'] = true -+ } ) -+ if macro_name:match('^%d') ~= '2' then - for _, command in ipairs(current) do - command.type = 'function' - local msg = command[1] -@@ -82,7 +85,7 @@ function stop_recording() - end - end - end -- list[macro_name] = current -+ list[ macro_name:match('[^\n]+$') ] = current - save() - textadept.statusbar_text = 'Macro saved' - textadept.events.handle('macro_saved') -@@ -104,9 +107,13 @@ function play(macro_name) - function play(macro_name) - if not macro_name then - local macro_list = '' -- for name in pairs(list) do macro_list = macro_list..name..' ' end -- macro_name = io.popen('zenity --list --text "Select a Macro" '.. -- '--column Name '..macro_list):read('*all'):sub(1, -2) -+ for name in pairs(list) do macro_list = macro_list..'"'..name..'" ' end -+ macro_name = cocoa_dialog( 'standard-dropdown', { -+ title = 'Select a Macro', -+ text = 'Macro name:', -+ items = macro_list, -+ ['no-newline'] = true -+ } ) end - local macro = list[macro_name] - if not macro then return end -diff -r 8c3e7e659b6f src/Makefile ---- a/src/Makefile Fri Nov 16 19:17:44 2007 -0500 -+++ b/src/Makefile Sat Nov 17 23:19:41 2007 -0500 -@@ -2,7 +2,7 @@ - - .SUFFIXES: .c .o .h .a +- return lua_dialog.run(args) ++ local p = io.popen('CocoaDialog '..kind..args) ++ local out = p:read('*all') ++ p:close() ++ return out + end +diff -r 809aab656589 osx.patch +--- a/osx.patch Tue Mar 04 23:06:41 2008 -0500 ++++ b/osx.patch Tue Mar 04 20:56:03 2008 -0500 +@@ -1,231 +0,0 @@ +-diff -r 8c3e7e659b6f core/events.lua +---- a/core/events.lua Fri Nov 16 19:17:44 2007 -0500 +-+++ b/core/events.lua Sat Nov 17 23:19:41 2007 -0500 +-@@ -372,11 +372,11 @@ add_handler('quit', +- end +- end +- if any then +-- list = list..'\nQuit without saving?' +-- if os.execute('zenity --question --title Alert '.. +-- '--text "'..list..'"') ~= 0 then +-- return false +-- end +-+ if tonumber( cocoa_dialog( 'yesno-msgbox', { +-+ title = 'Save?', +-+ text = 'Save changes before quitting?', +-+ ['informative-text'] = 'You will have to save changes manually.' +-+ } ) ) ~= 2 then return false end +- end +- textadept.io.save_session() +- return true +-diff -r 8c3e7e659b6f core/ext/find.lua +---- a/core/ext/find.lua Fri Nov 16 19:17:44 2007 -0500 +-+++ b/core/ext/find.lua Sat Nov 17 23:19:41 2007 -0500 +-@@ -96,7 +96,11 @@ function find.replace(rtext) +- function(code) +- local ret, val = pcall( loadstring('return '..code) ) +- if not ret then +-- os.execute('zenity --error --text "'..val:gsub('"', '\\"')..'"') +-+ cocoa_dialog( 'msgbox', { +-+ title = 'Error', +-+ text = 'An error ocurred:', +-+ ['informative-text'] = val:gsub('"', '\\"') +-+ } ) +- error() +- end +- return val +-diff -r 8c3e7e659b6f core/file_io.lua +---- a/core/file_io.lua Fri Nov 16 19:17:44 2007 -0500 +-+++ b/core/file_io.lua Sat Nov 17 23:19:41 2007 -0500 +-@@ -44,11 +44,12 @@ end +- -- specified, the user is prompted to open files from a dialog. +- -- @usage textadept.io.open(filename) +- function open(filenames) +-- if not filenames then +-- local directory = '--filename="'..(buffer.filename or '')..'"' +-- filenames = io.popen('zenity --file-selection --multiple '.. +-- directory):read('*all') +-- end +-+ filenames = filenames or cocoa_dialog( 'fileselect', { +-+ title = 'Open', +-+ text = 'Select a file(s) to open', +-+ ['select-multiple'] = true, +-+ --['with-directory'] = (buffer.filename or ''):match('.+/') +-+ } ) +- for filename in filenames:gmatch('[^|\n]+') do open_helper(filename) end +- end +- +-@@ -100,8 +101,9 @@ function save_as(buffer, filename) +- textadept.check_focused_buffer(buffer) +- if not filename then +- local directory = '--filename="'..(buffer.filename or '')..'"' +-- filename = io.popen('zenity --file-selection --save '.. +-- directory..' --confirm-overwrite'):read('*all') +-+ filename = cocoa_dialog( 'filesave', { +-+ title = 'Save' +-+ } ) +- end +- if #filename > 0 then +- buffer.filename = filename:sub(1, -2) -- chomp +-@@ -133,10 +135,11 @@ end +- -- @usage buffer:close() +- function close(buffer) +- textadept.check_focused_buffer(buffer) +-- if buffer.dirty and os.execute('zenity --question --title Alert '.. +-- '--text "Close without saving?"') ~= 0 then +-- return false +-- end +-+ if buffer.dirty and tonumber( cocoa_dialog( 'yesno-msgbox', { +-+ title = 'Save?', +-+ text = 'Save changes before closing?', +-+ ['informative-text'] = 'You will have to save changes manually.' +-+ } ) ) ~= 2 then return false end +- buffer:delete() +- return true +- end +-diff -r 8c3e7e659b6f core/init.lua +---- a/core/init.lua Fri Nov 16 19:17:44 2007 -0500 +-+++ b/core/init.lua Sat Nov 17 23:19:41 2007 -0500 +-@@ -14,6 +14,23 @@ function textadept.check_focused_buffer( +- end +- end +- +-+--- +-+-- Displays a CocoaDialog of a specified type with given arguments returning +-+-- the result. +-+-- @param kind The CocoaDialog type. +-+-- @param ... A table of key, value arguments. Each key is a --key switch with +-+-- a "value" value. If value is nil, it is omitted and just the switch is +-+-- used. +-+-- @return string CocoaDialog result. +-+function cocoa_dialog(kind, opts) +-+ local args = '' +-+ for k, v in pairs(opts) do +-+ args = args..' --'..k +-+ if type(v) == 'string' then args = args..' "'..v..'"' end +-+ end +-+ return io.popen('CocoaDialog '..kind..args):read('*all') +-+end +-+ +- package.path = package.path..';'.._HOME..'/core/?.lua' +- +- require 'iface' +-diff -r 8c3e7e659b6f modules/textadept/editing.lua +---- a/modules/textadept/editing.lua Fri Nov 16 19:17:44 2007 -0500 +-+++ b/modules/textadept/editing.lua Sat Nov 17 23:19:41 2007 -0500 +-@@ -219,9 +219,12 @@ function goto_line(line) +- function goto_line(line) +- local buffer = buffer +- if not line then +-- line = io.popen('zenity --entry --title "Go To" '.. +-- '--text "Line Number:"'):read('*all') +-- if line == '' then return end +-+ line = cocoa_dialog( 'standard-inputbox', { +-+ title = 'Go To', +-+ text = 'Line Number:', +-+ ['no-newline'] = true +-+ } ):match('%d+$') +-+ if not line then return end +- line = tonumber(line) +- end +- buffer:ensure_visible_enforce_policy(line - 1) +-diff -r 8c3e7e659b6f modules/textadept/macros.lua +---- a/modules/textadept/macros.lua Fri Nov 16 19:17:44 2007 -0500 +-+++ b/modules/textadept/macros.lua Sat Nov 17 23:19:41 2007 -0500 +-@@ -66,9 +66,12 @@ function stop_recording() +- recording = false +- local textadept = textadept +- local bf, bp = textadept.buffer_functions, textadept.buffer_properties +-- local macro_name = +-- io.popen('zenity --entry --text "Macro name:"'):read('*all'):sub(1, -2) +-- if #macro_name > 0 then +-+ local macro_name = cocoa_dialog( 'standard-inputbox', { +-+ title = 'Save Macro', +-+ text = 'Macro name:', +-+ ['no-newline'] = true +-+ } ) +-+ if macro_name:match('^%d') ~= '2' then +- for _, command in ipairs(current) do +- command.type = 'function' +- local msg = command[1] +-@@ -82,7 +85,7 @@ function stop_recording() +- end +- end +- end +-- list[macro_name] = current +-+ list[ macro_name:match('[^\n]+$') ] = current +- save() +- textadept.statusbar_text = 'Macro saved' +- textadept.events.handle('macro_saved') +-@@ -104,9 +107,13 @@ function play(macro_name) +- function play(macro_name) +- if not macro_name then +- local macro_list = '' +-- for name in pairs(list) do macro_list = macro_list..name..' ' end +-- macro_name = io.popen('zenity --list --text "Select a Macro" '.. +-- '--column Name '..macro_list):read('*all'):sub(1, -2) +-+ for name in pairs(list) do macro_list = macro_list..'"'..name..'" ' end +-+ macro_name = cocoa_dialog( 'standard-dropdown', { +-+ title = 'Select a Macro', +-+ text = 'Macro name:', +-+ items = macro_list, +-+ ['no-newline'] = true +-+ } ) +- end +- local macro = list[macro_name] +- if not macro then return end +-diff -r 8c3e7e659b6f src/Makefile +---- a/src/Makefile Fri Nov 16 19:17:44 2007 -0500 +-+++ b/src/Makefile Sat Nov 17 23:19:41 2007 -0500 +-@@ -2,7 +2,7 @@ +- +- .SUFFIXES: .c .o .h .a +- +--INCLUDEDIRS=-Iscintilla-st/include +-+INCLUDEDIRS=-Iscintilla-st/include -I/opt/local/include +- ifdef DEBUG +- CXXFLAGS=-DDEBUG -g -DGTK -DSCI_LEXER -W -Wall +- else +-@@ -14,7 +14,7 @@ all: textadept +- +- .c.o: +- g++ `pkg-config --cflags gtk+-2.0` $(INCLUDEDIRS) $(CXXFLAGS) -c $< -o $@ +--textadept: textadept.o lua_interface.o pm.o find_replace.o $(LEXEROBJS) scintilla-st/bin/scintilla.a -llua +-- g++ `pkg-config --libs gtk+-2.0 gthread-2.0` -lstdc++ -DGTK $^ -o $@ +-+textadept: textadept.o lua_interface.o pm.o find_replace.o $(LEXEROBJS) scintilla-st/bin/scintilla.a +-+ g++ `pkg-config --libs gtk+-2.0 gthread-2.0` -lstdc++ -DGTK -L/opt/local/lib -llua $^ -o $@ +- clean: +- rm -rf textadept *.o +-diff -r 8c3e7e659b6f src/properties.h +---- a/src/properties.h Fri Nov 16 19:17:44 2007 -0500 +-+++ b/src/properties.h Sat Nov 17 23:19:41 2007 -0500 +-@@ -32,7 +32,7 @@ void set_default_editor_properties(Scint +- SS(sci, SCI_SETFOLDFLAGS, 16); +- SS(sci, SCI_SETMODEVENTMASK, SC_MOD_CHANGEFOLD); +- +-- SS(sci, SCI_SETMARGINWIDTHN, 0, 4 + 2 * // line number margin +-+ SS(sci, SCI_SETMARGINWIDTHN, 0, 4 + 3 * // line number margin +- SS(sci, SCI_TEXTWIDTH, STYLE_LINENUMBER, reinterpret_cast<long>("9"))); +- +- SS(sci, SCI_SETMARGINWIDTHN, 1, 0); // marker margin invisible +-diff -r 8c3e7e659b6f src/textadept.c +---- a/src/textadept.c Fri Nov 16 19:17:44 2007 -0500 +-+++ b/src/textadept.c Sat Nov 17 23:19:41 2007 -0500 +-@@ -29,7 +29,7 @@ int main(int argc, char **argv) { +- +- void create_ui() { +- window = gtk_window_new(GTK_WINDOW_TOPLEVEL); +-- gtk_window_set_default_size(GTK_WINDOW(window), 500, 400); +-+ gtk_window_set_default_size(GTK_WINDOW(window), 700, 1000); +- signal(window, "delete_event", w_exit); +- signal(window, "focus-in-event", w_focus); +- signal(window, "key_press_event", w_keypress); +-@@ -106,7 +106,7 @@ void new_scintilla_buffer(ScintillaObjec +- // Setup default styling and properties. +- SS(sci, SCI_STYLESETFONT, 32, +- reinterpret_cast<long>("!Bitstream Vera Sans Mono")); +-- SS(sci, SCI_STYLESETSIZE, 32, 8); +-+ SS(sci, SCI_STYLESETSIZE, 32, 11); +- SS(sci, SCI_STYLESETFORE, 32, 0xAA | (0xAA << 8) | (0xAA << 16)); +- SS(sci, SCI_STYLESETBACK, 32, 0x33 | (0x33 << 8) | (0x33 << 16)); +- SS(sci, SCI_SETSTYLEBITS, 8, 0); +diff -r 809aab656589 src/Makefile +--- a/src/Makefile Tue Mar 04 23:06:41 2008 -0500 ++++ b/src/Makefile Tue Mar 04 20:56:03 2008 -0500 +@@ -15,12 +15,12 @@ LUAOBJS=\ + lopcodes.o lparser.o lstate.o lstring.o ltable.o ltm.o lundump.o lvm.o \ + lzio.o lauxlib.o lbaselib.o ldblib.o liolib.o lmathlib.o loslib.o ltablib.o \ + lstrlib.o loadlib.o linit.o +-EXPORTLUASYMS=-rdynamic -Wl,--retain-symbols-file -Wl,lua.sym ++EXPORTLUASYMS=-rdynamic -Wl,-exported_symbols_list -Wl,lua.sym --INCLUDEDIRS=-Iscintilla-st/include -+INCLUDEDIRS=-Iscintilla-st/include -I/opt/local/include - ifdef DEBUG - CXXFLAGS=-DDEBUG -g -DGTK -DSCI_LEXER -W -Wall - else -@@ -14,7 +14,7 @@ all: textadept + all: textadept + $(LUAOBJS): lua/*.c +- gcc $(INCLUDEDIRS) -DLUA_USE_LINUX $(CXXFLAGS) -c lua/*.c ++ gcc $(INCLUDEDIRS) -DLUA_USE_MACOSX $(CXXFLAGS) -c lua/*.c .c.o: - g++ `pkg-config --cflags gtk+-2.0` $(INCLUDEDIRS) $(CXXFLAGS) -c $< -o $@ --textadept: textadept.o lua_interface.o pm.o find_replace.o $(LEXEROBJS) scintilla-st/bin/scintilla.a -llua -- g++ `pkg-config --libs gtk+-2.0 gthread-2.0` -lstdc++ -DGTK $^ -o $@ -+textadept: textadept.o lua_interface.o pm.o find_replace.o $(LEXEROBJS) scintilla-st/bin/scintilla.a -+ g++ `pkg-config --libs gtk+-2.0 gthread-2.0` -lstdc++ -DGTK -L/opt/local/lib -llua $^ -o $@ - clean: - rm -rf textadept *.o -diff -r 8c3e7e659b6f src/properties.h ---- a/src/properties.h Fri Nov 16 19:17:44 2007 -0500 -+++ b/src/properties.h Sat Nov 17 23:19:41 2007 -0500 + g++ $(GTKFLAGS) $(INCLUDEDIRS) $(CXXFLAGS) -c $< -o $@ + textadept:\ +diff -r 809aab656589 src/properties.h +--- a/src/properties.h Tue Mar 04 23:06:41 2008 -0500 ++++ b/src/properties.h Tue Mar 04 20:56:03 2008 -0500 @@ -32,7 +32,7 @@ void set_default_editor_properties(Scint SS(sci, SCI_SETFOLDFLAGS, 16); SS(sci, SCI_SETMODEVENTMASK, SC_MOD_CHANGEFOLD); @@ -208,18 +292,9 @@ diff -r 8c3e7e659b6f src/properties.h SS(sci, SCI_TEXTWIDTH, STYLE_LINENUMBER, reinterpret_cast<long>("9"))); SS(sci, SCI_SETMARGINWIDTHN, 1, 0); // marker margin invisible -diff -r 8c3e7e659b6f src/textadept.c ---- a/src/textadept.c Fri Nov 16 19:17:44 2007 -0500 -+++ b/src/textadept.c Sat Nov 17 23:19:41 2007 -0500 -@@ -29,7 +29,7 @@ int main(int argc, char **argv) { - - void create_ui() { - window = gtk_window_new(GTK_WINDOW_TOPLEVEL); -- gtk_window_set_default_size(GTK_WINDOW(window), 500, 400); -+ gtk_window_set_default_size(GTK_WINDOW(window), 700, 1000); - signal(window, "delete_event", w_exit); - signal(window, "focus-in-event", w_focus); - signal(window, "key_press_event", w_keypress); +diff -r 809aab656589 src/textadept.c +--- a/src/textadept.c Tue Mar 04 23:06:41 2008 -0500 ++++ b/src/textadept.c Tue Mar 04 20:56:03 2008 -0500 @@ -106,7 +106,7 @@ void new_scintilla_buffer(ScintillaObjec // Setup default styling and properties. SS(sci, SCI_STYLESETFONT, 32, |