diff options
author | 2010-06-11 18:51:16 -0400 | |
---|---|---|
committer | 2010-06-11 18:51:16 -0400 | |
commit | 8e66381a040f695f4203b28bc3f1d6818d0da7a2 (patch) | |
tree | e30e8115d27b423b579e60178f36a151dc795f50 /core/ext/menu.lua | |
parent | 7a4800f05f26067a1cef77e5431256aab4c3d675 (diff) | |
download | textadept-8e66381a040f695f4203b28bc3f1d6818d0da7a2.tar.gz textadept-8e66381a040f695f4203b28bc3f1d6818d0da7a2.zip |
Removed _G.textadept.
Created new _SCINTILLA core module.
Renamed textadept.constants to _SCINTILLA.constants
Renamed textadept.buffer_functions to _SCINTILLA.functions
Renamed textadept.buffer_properties to _SCINTILLA.properties
Created new gui core module.
Renamed textadept._print() to gui._print().
Renamed textadept.check_focused_buffer() to gui.check_focused_buffer().
Renamed textadept.clipboard_text to gui.clipboard_text.
Renamed textadept.context_menu to gui.context_menu
Renamed textadept.command_entry to gui.command_entry.
Renamed textadept.dialog to gui.dialog.
Renamed textadept.docstatusbar_text to gui.docstatusbar_text.
Renamed textadept.find to gui.find.
Renamed textadept.focused_doc_pointer to gui.focused_doc_pointer.
Renamed textadept.get_split_table() to gui.get_split_table().
Renamed textadept.gtkmenu() to gui.gtkmenu().
Renamed textadept.goto_view() to gui.goto_view().
Renamed textadept.menubar to gui.menubar.
Renamed textadept.print() to gui.print().
Renamed textadept.size to gui.size.
Renamed textadept.statusbar_text to gui.statusbar_text.
Renamed textadept.switch_buffer() to gui.switch_buffer().
Renamed textadept.title to gui.title.
Renamed textadept.buffers to _G._BUFFERS.
Renamed textadept.new_buffer() to _G.new_buffer().
Renamed textadept.quit() to _G.quit().
Renamed textadept.reset() to _G.reset().
Renamed textadept.views to _G._VIEWS.
Renamed textadept.user_dofile() to _G.user_dofile().
Renamed textadept.iconv to string.iconv.
Renamed textadept.session_file to _SESSIONFILE.
Renamed appropriate C functions.
Diffstat (limited to 'core/ext/menu.lua')
-rw-r--r-- | core/ext/menu.lua | 81 |
1 files changed, 40 insertions, 41 deletions
diff --git a/core/ext/menu.lua b/core/ext/menu.lua index ee60bc60..60e5679c 100644 --- a/core/ext/menu.lua +++ b/core/ext/menu.lua @@ -1,17 +1,16 @@ -- Copyright 2007-2010 Mitchell mitchell<att>caladbolg.net. See LICENSE. -local textadept = _G.textadept local locale = _G.locale local events = _G.events --- -- Provides dynamic menus for Textadept. -- This module, like ext/key_commands, should be 'require'ed last. -module('textadept.menu', package.seeall) +module('menu', package.seeall) -local t = textadept +local gui = gui local l = locale -local gtkmenu = textadept.gtkmenu +local gtkmenu = gui.gtkmenu local SEPARATOR = 'separator' local ID = { @@ -282,7 +281,7 @@ for _, lexer in ipairs(_m.textadept.mime_types.lexers) do lexer_menu[#lexer_menu + 1] = { lexer, ID.LEXER_START + #lexer_menu } end table.insert(menubar, #menubar, gtkmenu(lexer_menu)) -- before 'Help' -t.menubar = menubar +gui.menubar = menubar local b, v = 'buffer', 'view' local m_snippets = _m.textadept.snippets @@ -327,7 +326,7 @@ end local actions = { -- File - [ID.NEW] = { t.new_buffer }, + [ID.NEW] = { new_buffer }, [ID.OPEN] = { io.open_file }, [ID.RELOAD] = { 'reload', b }, [ID.SAVE] = { 'save', b }, @@ -337,34 +336,34 @@ local actions = { [ID.LOAD_SESSION] = { function() local utf8_filename = - t.dialog('fileselect', - '--title', l.MENU_LOAD_SESSION_TITLE, - '--with-directory', - (textadept.session_file or ''):match('.+[/\\]') or '', - '--with-file', - (textadept.session_file or ''):match('[^/\\]+$') or '', - '--no-newline') + gui.dialog('fileselect', + '--title', l.MENU_LOAD_SESSION_TITLE, + '--with-directory', + (_SESSIONFILE or ''):match('.+[/\\]') or '', + '--with-file', + (_SESSIONFILE or ''):match('[^/\\]+$') or '', + '--no-newline') if #utf8_filename > 0 then - _m.textadept.session.load(t.iconv(utf8_filename, _CHARSET, 'UTF-8')) + _m.textadept.session.load(utf8_filename:iconv(_CHARSET, 'UTF-8')) end end }, [ID.SAVE_SESSION] = { function() local utf8_filename = - t.dialog('filesave', - '--title', l.MENU_SAVE_SESSION_TITLE, - '--with-directory', - (textadept.session_file or ''):match('.+[/\\]') or '', - '--with-file', - (textadept.session_file or ''):match('[^/\\]+$') or '', - '--no-newline') + gui.dialog('filesave', + '--title', l.MENU_SAVE_SESSION_TITLE, + '--with-directory', + (_SESSIONFILE or ''):match('.+[/\\]') or '', + '--with-file', + (_SESSIONFILE or ''):match('[^/\\]+$') or '', + '--no-newline') if #utf8_filename > 0 then - _m.textadept.session.save(t.iconv(utf8_filename, _CHARSET, 'UTF-8')) + _m.textadept.session.save(utf8_filename:iconv(_CHARSET, 'UTF-8')) end end }, - [ID.QUIT] = { t.quit }, + [ID.QUIT] = { quit }, -- Edit [ID.UNDO] = { 'undo', b }, [ID.REDO] = { 'redo', b }, @@ -405,23 +404,23 @@ local actions = { [ID.SELECT_IN_INDENTED_BLOCK] = { m_editing.select_indented_block }, [ID.SELECT_IN_SCOPE] = { m_editing.select_scope }, -- Tools - [ID.FIND] = { t.find.focus }, - [ID.FIND_NEXT] = { t.find.call_find_next }, - [ID.FIND_PREV] = { t.find.call_find_prev }, - [ID.FIND_AND_REPLACE] = { t.find.focus }, - [ID.REPLACE] = { t.find.call_replace }, - [ID.REPLACE_ALL] = { t.find.call_replace_all }, - [ID.FIND_INCREMENTAL] = { t.find.find_incremental }, + [ID.FIND] = { gui.find.focus }, + [ID.FIND_NEXT] = { gui.find.call_find_next }, + [ID.FIND_PREV] = { gui.find.call_find_prev }, + [ID.FIND_AND_REPLACE] = { gui.find.focus }, + [ID.REPLACE] = { gui.find.call_replace }, + [ID.REPLACE_ALL] = { gui.find.call_replace_all }, + [ID.FIND_INCREMENTAL] = { gui.find.find_incremental }, [ID.FIND_IN_FILES] = { function() - t.find.in_files = true - t.find.focus() + gui.find.in_files = true + gui.find.focus() end }, - [ID.GOTO_NEXT_FILE_FOUND] = { t.find.goto_file_in_list, true }, - [ID.GOTO_PREV_FILE_FOUND] = { t.find.goto_file_in_list, false }, + [ID.GOTO_NEXT_FILE_FOUND] = { gui.find.goto_file_in_list, true }, + [ID.GOTO_PREV_FILE_FOUND] = { gui.find.goto_file_in_list, false }, [ID.GOTO_LINE] = { m_editing.goto_line }, - [ID.FOCUS_COMMAND_ENTRY] = { t.command_entry.focus }, + [ID.FOCUS_COMMAND_ENTRY] = { gui.command_entry.focus }, [ID.RUN] = { m_run.run }, [ID.COMPILE] = { m_run.compile }, -- Tools -> Snippets @@ -452,10 +451,10 @@ local actions = { [ID.ENCODING_MACROMAN] = { set_encoding, 'MacRoman' }, [ID.ENCODING_UTF16] = { set_encoding, 'UTF-16LE' }, [ID.REFRESH_SYNTAX_HIGHLIGHTING] = { 'colourise', b, 0, -1 }, - [ID.SWITCH_BUFFER] = { t.switch_buffer }, + [ID.SWITCH_BUFFER] = { gui.switch_buffer }, -- View - [ID.NEXT_VIEW] = { t.goto_view, 1, false }, - [ID.PREV_VIEW] = { t.goto_view, -1, false }, + [ID.NEXT_VIEW] = { gui.goto_view, 1, false }, + [ID.PREV_VIEW] = { gui.goto_view, -1, false }, [ID.SPLIT_VIEW_VERTICAL] = { 'split', v }, [ID.SPLIT_VIEW_HORIZONTAL] = { 'split', v, false }, [ID.UNSPLIT_VIEW] = { function() view:unsplit() end }, @@ -470,8 +469,8 @@ local actions = { [ID.MANUAL] = { open_webpage, _HOME..'/doc/manual/1_Introduction.html' }, [ID.LUADOC] = { open_webpage, _HOME..'/doc/index.html' }, [ID.ABOUT] = { - t.dialog, 'ok-msgbox', '--title', 'Textadept', '--informative-text', - _RELEASE, '--no-cancel' + gui.dialog, 'ok-msgbox', '--title', 'Textadept', '--informative-text', + _RELEASE, '--no-cancel' }, } @@ -506,7 +505,7 @@ events.connect('menu_clicked', end) -- Right-click context menu. -t.context_menu = gtkmenu { +gui.context_menu = gtkmenu { { l.MENU_EDIT_UNDO, ID.UNDO }, { l.MENU_EDIT_REDO, ID.REDO }, { SEPARATOR, ID.SEPARATOR }, |