diff options
author | 2009-07-08 19:39:26 -0400 | |
---|---|---|
committer | 2009-07-08 19:39:26 -0400 | |
commit | a8e87e8efd47676ff0f04fbfba14be189b169ebb (patch) | |
tree | e04ec88b6ad70d43b39e0c2700a86affc316fa88 /core/ext | |
parent | 9827462bc8ac4ecc6009f2285c2397bf6ff64777 (diff) | |
download | textadept-a8e87e8efd47676ff0f04fbfba14be189b169ebb.tar.gz textadept-a8e87e8efd47676ff0f04fbfba14be189b169ebb.zip |
Replace lua_dialog with gcocoadialog.
Diffstat (limited to 'core/ext')
-rw-r--r-- | core/ext/find.lua | 25 | ||||
-rw-r--r-- | core/ext/pm/file_browser.lua | 13 | ||||
-rw-r--r-- | core/ext/pm/modules_browser.lua | 42 |
3 files changed, 40 insertions, 40 deletions
diff --git a/core/ext/find.lua b/core/ext/find.lua index c97cefd3..1f3dfa99 100644 --- a/core/ext/find.lua +++ b/core/ext/find.lua @@ -79,13 +79,13 @@ local function find_(text, next, flags, nowrap, wrapped) else -- find in files local utf8_dir = - cocoa_dialog('fileselect', { - title = locale.FIND_IN_FILES_TITLE, - text = locale.FIND_IN_FILES_TEXT, - ['select-only-directories'] = true, - ['with-directory'] = (buffer.filename or ''):match('^.+[/\\]'), - ['no-newline'] = true - }) + textadept.dialog('fileselect', + '--title', locale.FIND_IN_FILES_TITLE, + '--text', locale.FIND_IN_FILES_TEXT, + '--select-only-directories', + '--with-directory', + (buffer.filename or ''):match('^.+[/\\]') or '', + '--no-newline') if #utf8_dir > 0 then if not find.lua then text = text:gsub('([().*+?^$%%[%]-])', '%%%1') end if not find.match_case then text = text:lower() end @@ -182,12 +182,11 @@ local function replace(rtext) function(code) local ret, val = pcall(loadstring('return '..code)) if not ret then - cocoa_dialog('ok-msgbox', { - title = locale.FIND_ERROR_DIALOG_TITLE, - text = locale.FIND_ERROR_DIALOG_TEXT, - ['informative-text'] = val:gsub('"', '\\"'), - ['no-cancel'] = true - }) + textadept.dialog('ok-msgbox', + '--title', locale.FIND_ERROR_DIALOG_TITLE, + '--text', locale.FIND_ERROR_DIALOG_TEXT, + '--informative-text', val:gsub('"', '\\"'), + '--no-cancel') error() end return val diff --git a/core/ext/pm/file_browser.lua b/core/ext/pm/file_browser.lua index 8bff30f0..95587500 100644 --- a/core/ext/pm/file_browser.lua +++ b/core/ext/pm/file_browser.lua @@ -77,13 +77,12 @@ function perform_menu_action(menu_id, selected_item) os.date(date_format, attr.access), os.date(date_format, attr.modification), os.date(date_format, attr.change)) - cocoa_dialog('textbox', { - ['informative-text'] = - string.format(locale.PM_BROWSER_FILE_INFO_TEXT, utf8_filepath), - text = out, - button1 = locale.PM_BROWSER_FILE_INFO_OK, - editable = false - }) + textadept.dialog('textbox', + '--informative-text', + string.format(locale.PM_BROWSER_FILE_INFO_TEXT, + utf8_filepath), + '--text', out, + '--button1', locale.PM_BROWSER_FILE_INFO_OK) elseif menu_id == ID.SHOW_DOT_FILES then show_dot_files = not show_dot_files textadept.pm.activate() diff --git a/core/ext/pm/modules_browser.lua b/core/ext/pm/modules_browser.lua index 8472ee0d..839fbce9 100644 --- a/core/ext/pm/modules_browser.lua +++ b/core/ext/pm/modules_browser.lua @@ -133,16 +133,18 @@ end function perform_menu_action(menu_id, selected_item) if menu_id == ID.NEW then local status, module_name = - cocoa_dialog('standard-inputbox', { - ['title'] = locale.PM_BROWSER_MODULE_NEW_TITLE, - ['informative-text'] = locale.PM_BROWSER_MODULE_NEW_INFO_TEXT - }):match('^(%d)%s+([^\n]+)%s+$') + textadept.dialog('standard-inputbox', + '--title', locale.PM_BROWSER_MODULE_NEW_TITLE, + '--informative-text', + locale.PM_BROWSER_MODULE_NEW_INFO_TEXT + ):match('^(%d)%s+([^\n]+)%s+$') if status ~= '1' then return end local status, lang_name = - cocoa_dialog('standard-inputbox', { - ['title'] = locale.PM_BROWSER_MODULE_NEW_LANG_TITLE, - ['informative-text'] = locale.PM_BROWSER_MODULE_NEW_LANG_INFO_TEXT - }):match('^(%d)%s+([^\n]+)%s+$') + textadept.dialog('standard-inputbox', + '--title', locale.PM_BROWSER_MODULE_NEW_LANG_TITLE, + '--informative-text', + locale.PM_BROWSER_MODULE_NEW_LANG_INFO_TEXT + ):match('^(%d)%s+([^\n]+)%s+$') if status ~= '1' then return end local module_dir = _HOME..'/modules/'..module_name if lfs.mkdir(module_dir) then @@ -162,22 +164,22 @@ function perform_menu_action(menu_id, selected_item) f:write(out) f:close() else - cocoa_dialog('ok-msgbox', { - ['text'] = locale.PM_BROWSER_MODULE_NEW_ERROR, - ['informative-text'] = locale.PM_BROWSER_MODULE_NEW_ERROR_TEXT, - ['no-cancel'] = true - }) + textadept.dialog('ok-msgbox', + '--text', locale.PM_BROWSER_MODULE_NEW_ERROR, + '--informative-text', + locale.PM_BROWSER_MODULE_NEW_ERROR_TEXT, + '--no-cancel') return end elseif menu_id == ID.DELETE then local module_name = selected_item[2] - if cocoa_dialog('yesno-msgbox', { - ['text'] = locale.PM_BROWSER_MODULE_DELETE_TITLE, - ['informative-text'] = - string.format(locale.PM_BROWSER_MODULE_DELETE_TEXT, module_name), - ['no-cancel'] = true, - ['no-newline'] = true - }) == '1' then + if textadept.dialog('yesno-msgbox', + '--text', locale.PM_BROWSER_MODULE_DELETE_TITLE, + '--informative-text', + string.format(locale.PM_BROWSER_MODULE_DELETE_TEXT, + module_name), + '--no-cancel', + '--no-newline') == '1' then local function remove_directory(dirpath) for name in lfs.dir(dirpath) do if not name:find('^%.%.?$') then os.remove(dirpath..'/'..name) end |