├── .gitignore ├── data ├── test │ ├── chardet │ │ ├── empty.txt │ │ ├── empty - utf8 bom.txt │ │ ├── big5.txt │ │ ├── gb18030.txt │ │ ├── gb2312.txt │ │ ├── utf16be.txt │ │ ├── utf16le.txt │ │ ├── shift_js.txt │ │ ├── latin1.txt │ │ ├── utf8.txt │ │ └── utf8 bom.txt │ ├── ff │ │ ├── none.txt │ │ ├── mac.txt │ │ ├── unix.txt │ │ └── win.txt │ ├── ft_samples │ │ ├── README.txt │ │ └── lua │ │ │ └── test.lua │ └── performance │ │ └── README.md └── jilfiles │ ├── theme │ └── Desert │ │ └── image │ │ ├── high │ │ ├── tab_close.png │ │ ├── tab_expand.png │ │ ├── fp_reversely.png │ │ ├── fp_use_regex.png │ │ ├── fp_add_folder.png │ │ ├── fp_match_word.png │ │ ├── fp_case_sensitive.png │ │ ├── fp_location_page.png │ │ ├── fp_location_folders.png │ │ ├── fp_match_word_hover.png │ │ ├── fp_reversely_hover.png │ │ ├── fp_use_regex_hover.png │ │ ├── tab_expand_disabled.png │ │ ├── fp_location_all_pages.png │ │ ├── fp_match_word_disabled.png │ │ ├── fp_reversely_disabled.png │ │ └── fp_case_sensitive_hover.png │ │ └── normal │ │ ├── tab_close.png │ │ ├── tab_expand.png │ │ ├── fp_add_folder.png │ │ ├── fp_match_word.png │ │ ├── fp_reversely.png │ │ ├── fp_use_regex.png │ │ ├── fp_case_sensitive.png │ │ ├── fp_location_page.png │ │ ├── fp_reversely_hover.png │ │ ├── fp_use_regex_hover.png │ │ ├── fp_location_folders.png │ │ ├── fp_match_word_hover.png │ │ ├── tab_expand_disabled.png │ │ ├── fp_case_sensitive_hover.png │ │ ├── fp_location_all_pages.png │ │ ├── fp_match_word_disabled.png │ │ └── fp_reversely_disabled.png │ ├── ftplugin │ ├── cue │ │ ├── options.cfg │ │ └── lex.cfg │ ├── go │ │ ├── options.cfg │ │ └── lex.cfg │ ├── vb │ │ └── options.cfg │ ├── xml │ │ ├── options.cfg │ │ └── lex.cfg │ ├── python │ │ ├── options.cfg │ │ └── lex.cfg │ ├── txt │ │ └── options.cfg │ ├── cmake │ │ ├── options.cfg │ │ └── lex.cfg │ ├── lua │ │ ├── options.cfg │ │ └── lex.cfg │ ├── rust │ │ ├── options.cfg │ │ └── lex.cfg │ ├── cfg │ │ ├── options.cfg │ │ ├── lex.cfg │ │ └── indent.lua │ ├── c │ │ ├── options.cfg │ │ ├── indent.lua │ │ └── lex.cfg │ ├── cpp │ │ ├── options.cfg │ │ └── lex.cfg │ ├── jil-find_result │ │ └── options.cfg │ └── __default │ │ └── options.cfg │ ├── status_fields.cfg │ ├── options.cfg │ └── ft.cfg ├── third_party ├── src │ ├── lua │ │ ├── README.txt │ │ ├── lua.hpp │ │ ├── lapi.h │ │ ├── CMakeLists.txt │ │ ├── lundump.h │ │ ├── lprefix.h │ │ ├── lualib.h │ │ ├── lstring.h │ │ ├── ldebug.h │ │ ├── ldo.h │ │ ├── lfunc.h │ │ ├── lzio.h │ │ ├── ltable.h │ │ ├── lzio.c │ │ ├── linit.c │ │ ├── ltm.h │ │ ├── lvm.h │ │ └── lctype.h │ ├── uchardet │ │ ├── readme.txt │ │ ├── CMakeLists.txt │ │ ├── prmem.h │ │ └── nscore.h │ ├── gtest │ │ ├── CMakeLists.txt │ │ ├── gtest_main.cc │ │ └── gtest-all.cc │ ├── pugixml │ │ ├── CMakeLists.txt │ │ └── foreach.hpp │ └── libconfig │ │ ├── CMakeLists.txt │ │ ├── strbuf.h │ │ ├── parsectx.h │ │ ├── strbuf.c │ │ └── scanctx.h ├── win32 │ ├── bin │ │ ├── dbghelp.dll │ │ ├── vld_x86.dll │ │ └── Microsoft.DTfW.DHL.manifest │ └── lib │ │ └── debug │ │ └── vld.lib └── include │ └── LuaBridge │ └── detail │ └── dump.h ├── setup └── win32 │ ├── make.bat │ └── setup.ico ├── doc ├── Plan.odt ├── Design.odt ├── Icons.odt ├── Performance.odt ├── design │ ├── Jil.asta │ ├── images │ │ ├── refresh_add_delete_lines.png │ │ └── refresh_add_delete_lines_2.png │ └── TextBuffer.md ├── Requirements.odt ├── ref │ ├── asciifull.gif │ └── crowley98data.pdf ├── screenshots │ ├── main.png │ ├── pref_general.png │ ├── ft_pref_indent.png │ └── ft_pref_general.png └── build │ ├── cmake │ ├── cmake.png │ ├── cmake_64.png │ ├── cmake_boost_64.png │ ├── cmake_gen_x64.png │ ├── vc_command_x64.png │ ├── vc_configuration.png │ ├── boost_install_lib_x64.png │ ├── cmake_cannot_find_wx.png │ ├── cmake_install_prefix.png │ ├── vc_target_machine_x64.png │ └── vc_configuration_manager.png │ ├── Build Instructions (Windows).odt │ └── Build Instructions (Windows 64bit).odt ├── src ├── jil │ ├── app.aps │ ├── icon │ │ ├── editor.icns │ │ ├── editor.ico │ │ ├── editor128.ico │ │ ├── editor16.ico │ │ ├── editor256.ico │ │ ├── editor32.ico │ │ ├── editor48.ico │ │ ├── png │ │ │ ├── editor16.png │ │ │ ├── editor32.png │ │ │ ├── editor48.png │ │ │ ├── editor128.png │ │ │ └── editor256.png │ │ ├── editor_icon_bundle.xcf │ │ └── README.txt │ ├── option.cc │ ├── compile_config.h │ ├── i18n_util.h │ ├── defs.cc │ ├── lex_config.h │ ├── about_dialog.h │ ├── status_fields_config.h │ ├── goto_dialog.h │ ├── log.cc │ ├── theme_config.h │ ├── resource.h │ ├── pref │ │ ├── editor_dialog.h │ │ ├── dialog_base.h │ │ ├── global_dialog.h │ │ ├── editor_comment_page.h │ │ ├── global_theme_page.h │ │ ├── editor_dialog.cc │ │ ├── editor_indent_page.h │ │ ├── editor_general_page.h │ │ ├── dialog_base.cc │ │ ├── global_general_page.h │ │ ├── global_dialog.cc │ │ ├── common.h │ │ ├── editor_comment_page.cc │ │ ├── global_font_page.h │ │ └── common.cc │ ├── log.h │ ├── option_config.h │ ├── binding_config.h │ ├── tool_book.h │ ├── page_window.h │ ├── Info.plist.in │ ├── save.h │ ├── option.h │ ├── font_util.h │ ├── about_dialog.cc │ ├── goto_dialog.cc │ ├── find_thread.h │ ├── book_page.h │ ├── navigation_dialog.h │ └── find_result_page.h ├── editor │ ├── CMakeLists.txt │ ├── text_point.cc │ ├── tab.h │ ├── file_io.h │ ├── lua_proxy.h │ ├── line_nr_area.h │ ├── text_area.h │ ├── compile_config.h │ ├── tab.cc │ ├── text_listener.h │ ├── style.cc │ ├── line_nr_area.cc │ ├── option.cc │ ├── selection.h │ ├── text_point.h │ ├── theme.h │ ├── file_io.cc │ ├── renderer.h │ └── text_extent.h ├── base │ ├── string_util.cc │ ├── CMakeLists.txt │ ├── math_util.cc │ ├── math_util.h │ └── string_util.h ├── CMakeLists.txt ├── editor_unittest │ ├── CMakeLists.txt │ ├── tab_util_unittest.cc │ ├── text_range_unittest.cc │ ├── indent_test_base.h │ └── indent_test_base.cc └── ui │ ├── button_style.cc │ ├── CMakeLists.txt │ ├── util.h │ ├── static_box.h │ ├── text_button.h │ ├── bitmap_button.h │ ├── label.h │ ├── bitmap_button.cc │ ├── button_style.h │ ├── separator.h │ ├── bitmap_button_base.h │ ├── util.cc │ ├── bitmap_toggle_button.cc │ ├── bitmap_toggle_button.h │ ├── text_button.cc │ ├── label.cc │ ├── static_box.cc │ ├── bitmap_button_base.cc │ └── string_list_ctrl.h ├── CPPLINT.cfg ├── .gitattributes └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /data/test/chardet/empty.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /data/test/chardet/empty - utf8 bom.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /data/test/ff/none.txt: -------------------------------------------------------------------------------- 1 | no line ending 2 | -------------------------------------------------------------------------------- /third_party/src/lua/README.txt: -------------------------------------------------------------------------------- 1 | 5.3.0 2 | -------------------------------------------------------------------------------- /setup/win32/make.bat: -------------------------------------------------------------------------------- 1 | makensis.exe jil.nsi 2 | -------------------------------------------------------------------------------- /data/test/ff/mac.txt: -------------------------------------------------------------------------------- 1 | test unix file format line ending = CR -------------------------------------------------------------------------------- /data/test/ff/unix.txt: -------------------------------------------------------------------------------- 1 | test unix file format 2 | line ending = L 3 | -------------------------------------------------------------------------------- /data/test/ff/win.txt: -------------------------------------------------------------------------------- 1 | test unix file format 2 | line ending = CRLF 3 | -------------------------------------------------------------------------------- /doc/Plan.odt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sprinfall/jil/HEAD/doc/Plan.odt -------------------------------------------------------------------------------- /data/test/ft_samples/README.txt: -------------------------------------------------------------------------------- 1 | Sample text files for each file type. 2 | 3 | -------------------------------------------------------------------------------- /doc/Design.odt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sprinfall/jil/HEAD/doc/Design.odt -------------------------------------------------------------------------------- /doc/Icons.odt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sprinfall/jil/HEAD/doc/Icons.odt -------------------------------------------------------------------------------- /src/jil/app.aps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sprinfall/jil/HEAD/src/jil/app.aps -------------------------------------------------------------------------------- /doc/Performance.odt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sprinfall/jil/HEAD/doc/Performance.odt -------------------------------------------------------------------------------- /doc/design/Jil.asta: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sprinfall/jil/HEAD/doc/design/Jil.asta -------------------------------------------------------------------------------- /doc/Requirements.odt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sprinfall/jil/HEAD/doc/Requirements.odt -------------------------------------------------------------------------------- /doc/ref/asciifull.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sprinfall/jil/HEAD/doc/ref/asciifull.gif -------------------------------------------------------------------------------- /setup/win32/setup.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sprinfall/jil/HEAD/setup/win32/setup.ico -------------------------------------------------------------------------------- /src/editor/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB SRCS *.cc *.h) 2 | 3 | add_library(editor ${SRCS}) 4 | -------------------------------------------------------------------------------- /doc/screenshots/main.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sprinfall/jil/HEAD/doc/screenshots/main.png -------------------------------------------------------------------------------- /src/jil/icon/editor.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sprinfall/jil/HEAD/src/jil/icon/editor.icns -------------------------------------------------------------------------------- /src/jil/icon/editor.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sprinfall/jil/HEAD/src/jil/icon/editor.ico -------------------------------------------------------------------------------- /data/test/chardet/big5.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sprinfall/jil/HEAD/data/test/chardet/big5.txt -------------------------------------------------------------------------------- /doc/build/cmake/cmake.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sprinfall/jil/HEAD/doc/build/cmake/cmake.png -------------------------------------------------------------------------------- /doc/ref/crowley98data.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sprinfall/jil/HEAD/doc/ref/crowley98data.pdf -------------------------------------------------------------------------------- /src/jil/icon/editor128.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sprinfall/jil/HEAD/src/jil/icon/editor128.ico -------------------------------------------------------------------------------- /src/jil/icon/editor16.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sprinfall/jil/HEAD/src/jil/icon/editor16.ico -------------------------------------------------------------------------------- /src/jil/icon/editor256.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sprinfall/jil/HEAD/src/jil/icon/editor256.ico -------------------------------------------------------------------------------- /src/jil/icon/editor32.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sprinfall/jil/HEAD/src/jil/icon/editor32.ico -------------------------------------------------------------------------------- /src/jil/icon/editor48.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sprinfall/jil/HEAD/src/jil/icon/editor48.ico -------------------------------------------------------------------------------- /src/jil/option.cc: -------------------------------------------------------------------------------- 1 | #include "jil/option.h" 2 | 3 | namespace jil { 4 | 5 | } // namespace jil 6 | -------------------------------------------------------------------------------- /data/test/chardet/gb18030.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sprinfall/jil/HEAD/data/test/chardet/gb18030.txt -------------------------------------------------------------------------------- /data/test/chardet/gb2312.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sprinfall/jil/HEAD/data/test/chardet/gb2312.txt -------------------------------------------------------------------------------- /data/test/chardet/utf16be.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sprinfall/jil/HEAD/data/test/chardet/utf16be.txt -------------------------------------------------------------------------------- /data/test/chardet/utf16le.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sprinfall/jil/HEAD/data/test/chardet/utf16le.txt -------------------------------------------------------------------------------- /doc/build/cmake/cmake_64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sprinfall/jil/HEAD/doc/build/cmake/cmake_64.png -------------------------------------------------------------------------------- /src/base/string_util.cc: -------------------------------------------------------------------------------- 1 | #include "base/string_util.h" 2 | 3 | namespace base { 4 | } // namespace base 5 | -------------------------------------------------------------------------------- /src/jil/icon/png/editor16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sprinfall/jil/HEAD/src/jil/icon/png/editor16.png -------------------------------------------------------------------------------- /src/jil/icon/png/editor32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sprinfall/jil/HEAD/src/jil/icon/png/editor32.png -------------------------------------------------------------------------------- /src/jil/icon/png/editor48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sprinfall/jil/HEAD/src/jil/icon/png/editor48.png -------------------------------------------------------------------------------- /data/test/chardet/shift_js.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sprinfall/jil/HEAD/data/test/chardet/shift_js.txt -------------------------------------------------------------------------------- /doc/screenshots/pref_general.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sprinfall/jil/HEAD/doc/screenshots/pref_general.png -------------------------------------------------------------------------------- /src/jil/icon/png/editor128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sprinfall/jil/HEAD/src/jil/icon/png/editor128.png -------------------------------------------------------------------------------- /src/jil/icon/png/editor256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sprinfall/jil/HEAD/src/jil/icon/png/editor256.png -------------------------------------------------------------------------------- /third_party/src/uchardet/readme.txt: -------------------------------------------------------------------------------- 1 | http://mxr.mozilla.org/mozilla/source/extensions/universalchardet/src/ 2 | -------------------------------------------------------------------------------- /doc/build/cmake/cmake_boost_64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sprinfall/jil/HEAD/doc/build/cmake/cmake_boost_64.png -------------------------------------------------------------------------------- /doc/build/cmake/cmake_gen_x64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sprinfall/jil/HEAD/doc/build/cmake/cmake_gen_x64.png -------------------------------------------------------------------------------- /doc/build/cmake/vc_command_x64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sprinfall/jil/HEAD/doc/build/cmake/vc_command_x64.png -------------------------------------------------------------------------------- /doc/screenshots/ft_pref_indent.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sprinfall/jil/HEAD/doc/screenshots/ft_pref_indent.png -------------------------------------------------------------------------------- /third_party/win32/bin/dbghelp.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sprinfall/jil/HEAD/third_party/win32/bin/dbghelp.dll -------------------------------------------------------------------------------- /third_party/win32/bin/vld_x86.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sprinfall/jil/HEAD/third_party/win32/bin/vld_x86.dll -------------------------------------------------------------------------------- /doc/build/cmake/vc_configuration.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sprinfall/jil/HEAD/doc/build/cmake/vc_configuration.png -------------------------------------------------------------------------------- /doc/screenshots/ft_pref_general.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sprinfall/jil/HEAD/doc/screenshots/ft_pref_general.png -------------------------------------------------------------------------------- /src/jil/icon/editor_icon_bundle.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sprinfall/jil/HEAD/src/jil/icon/editor_icon_bundle.xcf -------------------------------------------------------------------------------- /third_party/win32/lib/debug/vld.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sprinfall/jil/HEAD/third_party/win32/lib/debug/vld.lib -------------------------------------------------------------------------------- /doc/build/Build Instructions (Windows).odt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sprinfall/jil/HEAD/doc/build/Build Instructions (Windows).odt -------------------------------------------------------------------------------- /doc/build/cmake/boost_install_lib_x64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sprinfall/jil/HEAD/doc/build/cmake/boost_install_lib_x64.png -------------------------------------------------------------------------------- /doc/build/cmake/cmake_cannot_find_wx.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sprinfall/jil/HEAD/doc/build/cmake/cmake_cannot_find_wx.png -------------------------------------------------------------------------------- /doc/build/cmake/cmake_install_prefix.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sprinfall/jil/HEAD/doc/build/cmake/cmake_install_prefix.png -------------------------------------------------------------------------------- /doc/build/cmake/vc_target_machine_x64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sprinfall/jil/HEAD/doc/build/cmake/vc_target_machine_x64.png -------------------------------------------------------------------------------- /doc/build/cmake/vc_configuration_manager.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sprinfall/jil/HEAD/doc/build/cmake/vc_configuration_manager.png -------------------------------------------------------------------------------- /doc/design/images/refresh_add_delete_lines.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sprinfall/jil/HEAD/doc/design/images/refresh_add_delete_lines.png -------------------------------------------------------------------------------- /doc/build/Build Instructions (Windows 64bit).odt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sprinfall/jil/HEAD/doc/build/Build Instructions (Windows 64bit).odt -------------------------------------------------------------------------------- /doc/design/images/refresh_add_delete_lines_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sprinfall/jil/HEAD/doc/design/images/refresh_add_delete_lines_2.png -------------------------------------------------------------------------------- /data/jilfiles/theme/Desert/image/high/tab_close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sprinfall/jil/HEAD/data/jilfiles/theme/Desert/image/high/tab_close.png -------------------------------------------------------------------------------- /data/jilfiles/theme/Desert/image/high/tab_expand.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sprinfall/jil/HEAD/data/jilfiles/theme/Desert/image/high/tab_expand.png -------------------------------------------------------------------------------- /data/jilfiles/theme/Desert/image/high/fp_reversely.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sprinfall/jil/HEAD/data/jilfiles/theme/Desert/image/high/fp_reversely.png -------------------------------------------------------------------------------- /data/jilfiles/theme/Desert/image/high/fp_use_regex.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sprinfall/jil/HEAD/data/jilfiles/theme/Desert/image/high/fp_use_regex.png -------------------------------------------------------------------------------- /data/jilfiles/theme/Desert/image/normal/tab_close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sprinfall/jil/HEAD/data/jilfiles/theme/Desert/image/normal/tab_close.png -------------------------------------------------------------------------------- /data/jilfiles/theme/Desert/image/normal/tab_expand.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sprinfall/jil/HEAD/data/jilfiles/theme/Desert/image/normal/tab_expand.png -------------------------------------------------------------------------------- /CPPLINT.cfg: -------------------------------------------------------------------------------- 1 | set noparent 2 | root=src 3 | filter=+build,+readability,+runtime,+whitespace,-whitespace/indent,-legal/copyright,-readability/todo 4 | linelength=80 -------------------------------------------------------------------------------- /data/jilfiles/theme/Desert/image/high/fp_add_folder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sprinfall/jil/HEAD/data/jilfiles/theme/Desert/image/high/fp_add_folder.png -------------------------------------------------------------------------------- /data/jilfiles/theme/Desert/image/high/fp_match_word.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sprinfall/jil/HEAD/data/jilfiles/theme/Desert/image/high/fp_match_word.png -------------------------------------------------------------------------------- /data/jilfiles/theme/Desert/image/normal/fp_add_folder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sprinfall/jil/HEAD/data/jilfiles/theme/Desert/image/normal/fp_add_folder.png -------------------------------------------------------------------------------- /data/jilfiles/theme/Desert/image/normal/fp_match_word.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sprinfall/jil/HEAD/data/jilfiles/theme/Desert/image/normal/fp_match_word.png -------------------------------------------------------------------------------- /data/jilfiles/theme/Desert/image/normal/fp_reversely.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sprinfall/jil/HEAD/data/jilfiles/theme/Desert/image/normal/fp_reversely.png -------------------------------------------------------------------------------- /data/jilfiles/theme/Desert/image/normal/fp_use_regex.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sprinfall/jil/HEAD/data/jilfiles/theme/Desert/image/normal/fp_use_regex.png -------------------------------------------------------------------------------- /data/jilfiles/theme/Desert/image/high/fp_case_sensitive.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sprinfall/jil/HEAD/data/jilfiles/theme/Desert/image/high/fp_case_sensitive.png -------------------------------------------------------------------------------- /data/jilfiles/theme/Desert/image/high/fp_location_page.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sprinfall/jil/HEAD/data/jilfiles/theme/Desert/image/high/fp_location_page.png -------------------------------------------------------------------------------- /src/base/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(SRCS 2 | math_util.cc 3 | math_util.h 4 | string_util.cc 5 | string_util.h 6 | ) 7 | 8 | add_library(base ${SRCS}) 9 | -------------------------------------------------------------------------------- /data/jilfiles/theme/Desert/image/high/fp_location_folders.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sprinfall/jil/HEAD/data/jilfiles/theme/Desert/image/high/fp_location_folders.png -------------------------------------------------------------------------------- /data/jilfiles/theme/Desert/image/high/fp_match_word_hover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sprinfall/jil/HEAD/data/jilfiles/theme/Desert/image/high/fp_match_word_hover.png -------------------------------------------------------------------------------- /data/jilfiles/theme/Desert/image/high/fp_reversely_hover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sprinfall/jil/HEAD/data/jilfiles/theme/Desert/image/high/fp_reversely_hover.png -------------------------------------------------------------------------------- /data/jilfiles/theme/Desert/image/high/fp_use_regex_hover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sprinfall/jil/HEAD/data/jilfiles/theme/Desert/image/high/fp_use_regex_hover.png -------------------------------------------------------------------------------- /data/jilfiles/theme/Desert/image/high/tab_expand_disabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sprinfall/jil/HEAD/data/jilfiles/theme/Desert/image/high/tab_expand_disabled.png -------------------------------------------------------------------------------- /data/jilfiles/theme/Desert/image/normal/fp_case_sensitive.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sprinfall/jil/HEAD/data/jilfiles/theme/Desert/image/normal/fp_case_sensitive.png -------------------------------------------------------------------------------- /data/jilfiles/theme/Desert/image/normal/fp_location_page.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sprinfall/jil/HEAD/data/jilfiles/theme/Desert/image/normal/fp_location_page.png -------------------------------------------------------------------------------- /data/jilfiles/theme/Desert/image/normal/fp_reversely_hover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sprinfall/jil/HEAD/data/jilfiles/theme/Desert/image/normal/fp_reversely_hover.png -------------------------------------------------------------------------------- /data/jilfiles/theme/Desert/image/normal/fp_use_regex_hover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sprinfall/jil/HEAD/data/jilfiles/theme/Desert/image/normal/fp_use_regex_hover.png -------------------------------------------------------------------------------- /data/jilfiles/theme/Desert/image/high/fp_location_all_pages.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sprinfall/jil/HEAD/data/jilfiles/theme/Desert/image/high/fp_location_all_pages.png -------------------------------------------------------------------------------- /data/jilfiles/theme/Desert/image/high/fp_match_word_disabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sprinfall/jil/HEAD/data/jilfiles/theme/Desert/image/high/fp_match_word_disabled.png -------------------------------------------------------------------------------- /data/jilfiles/theme/Desert/image/high/fp_reversely_disabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sprinfall/jil/HEAD/data/jilfiles/theme/Desert/image/high/fp_reversely_disabled.png -------------------------------------------------------------------------------- /data/jilfiles/theme/Desert/image/normal/fp_location_folders.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sprinfall/jil/HEAD/data/jilfiles/theme/Desert/image/normal/fp_location_folders.png -------------------------------------------------------------------------------- /data/jilfiles/theme/Desert/image/normal/fp_match_word_hover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sprinfall/jil/HEAD/data/jilfiles/theme/Desert/image/normal/fp_match_word_hover.png -------------------------------------------------------------------------------- /data/jilfiles/theme/Desert/image/normal/tab_expand_disabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sprinfall/jil/HEAD/data/jilfiles/theme/Desert/image/normal/tab_expand_disabled.png -------------------------------------------------------------------------------- /data/jilfiles/theme/Desert/image/high/fp_case_sensitive_hover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sprinfall/jil/HEAD/data/jilfiles/theme/Desert/image/high/fp_case_sensitive_hover.png -------------------------------------------------------------------------------- /data/jilfiles/theme/Desert/image/normal/fp_case_sensitive_hover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sprinfall/jil/HEAD/data/jilfiles/theme/Desert/image/normal/fp_case_sensitive_hover.png -------------------------------------------------------------------------------- /data/jilfiles/theme/Desert/image/normal/fp_location_all_pages.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sprinfall/jil/HEAD/data/jilfiles/theme/Desert/image/normal/fp_location_all_pages.png -------------------------------------------------------------------------------- /data/jilfiles/theme/Desert/image/normal/fp_match_word_disabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sprinfall/jil/HEAD/data/jilfiles/theme/Desert/image/normal/fp_match_word_disabled.png -------------------------------------------------------------------------------- /data/jilfiles/theme/Desert/image/normal/fp_reversely_disabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sprinfall/jil/HEAD/data/jilfiles/theme/Desert/image/normal/fp_reversely_disabled.png -------------------------------------------------------------------------------- /third_party/src/gtest/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(SRCS 2 | gtest-all.cc 3 | gtest_main.cc 4 | ) 5 | 6 | add_library(gtest ${SRCS}) 7 | 8 | install(TARGETS gtest DESTINATION .) 9 | -------------------------------------------------------------------------------- /data/jilfiles/ftplugin/cue/options.cfg: -------------------------------------------------------------------------------- 1 | // Options for Cue 2 | 3 | wrap = false; 4 | 5 | expand_tab = false; 6 | tab_stop = 4; 7 | 8 | rulers = []; 9 | 10 | indent_keys = []; 11 | -------------------------------------------------------------------------------- /data/jilfiles/ftplugin/go/options.cfg: -------------------------------------------------------------------------------- 1 | // Options for Go 2 | 3 | wrap = false; 4 | 5 | expand_tab = false; 6 | tab_stop = 4; 7 | 8 | rulers = []; 9 | 10 | indent_keys = []; 11 | -------------------------------------------------------------------------------- /data/jilfiles/ftplugin/vb/options.cfg: -------------------------------------------------------------------------------- 1 | // Options for VB 2 | 3 | wrap = false; 4 | 5 | expand_tab = false; 6 | tab_stop = 4; 7 | 8 | rulers = []; 9 | 10 | indent_keys = []; 11 | -------------------------------------------------------------------------------- /data/jilfiles/ftplugin/xml/options.cfg: -------------------------------------------------------------------------------- 1 | // Options for XML 2 | 3 | wrap = false; 4 | 5 | expand_tab = false; 6 | tab_stop = 4; 7 | 8 | rulers = []; 9 | 10 | indent_keys = []; 11 | -------------------------------------------------------------------------------- /src/jil/icon/README.txt: -------------------------------------------------------------------------------- 1 | 2 | [ Windows ] 3 | 4 | Icon editor.ico is a bundle which consists of several different size icons. 5 | It is exported from editor_icon_bundle.xcf with Gimp. 6 | 7 | -------------------------------------------------------------------------------- /data/jilfiles/ftplugin/python/options.cfg: -------------------------------------------------------------------------------- 1 | // Options for Python 2 | 3 | wrap = false; 4 | 5 | expand_tab = true; 6 | tab_stop = 4; 7 | 8 | rulers = []; 9 | 10 | indent_keys = []; 11 | -------------------------------------------------------------------------------- /data/jilfiles/ftplugin/txt/options.cfg: -------------------------------------------------------------------------------- 1 | // Options for Plain Text 2 | 3 | wrap = true; 4 | 5 | expand_tab = false; 6 | tab_stop = 4; 7 | 8 | rulers = []; 9 | 10 | indent_keys = []; 11 | -------------------------------------------------------------------------------- /data/test/performance/README.md: -------------------------------------------------------------------------------- 1 | # Performance 2 | 3 | ## v8-objects.cc 4 | A very large C++ source file from Google V8 javascript engine. 5 | Used test the loading and lex scanning performance. 6 | -------------------------------------------------------------------------------- /data/jilfiles/ftplugin/cmake/options.cfg: -------------------------------------------------------------------------------- 1 | // Options for CMake 2 | 3 | wrap = false; 4 | 5 | expand_tab = true; 6 | tab_stop = 4; 7 | 8 | rulers = []; 9 | 10 | indent_keys = []; 11 | 12 | -------------------------------------------------------------------------------- /data/jilfiles/ftplugin/lua/options.cfg: -------------------------------------------------------------------------------- 1 | // Options for Lua 2 | 3 | wrap = false; 4 | 5 | expand_tab = true; 6 | tab_stop = 2; 7 | 8 | rulers = [ 80 ]; 9 | 10 | indent_keys = [ "end" ]; 11 | -------------------------------------------------------------------------------- /data/test/chardet/latin1.txt: -------------------------------------------------------------------------------- 1 | ascii 2 | 3 | zfnsdlgk 4 | s 5 | gvkd;jd;gjmd;'bgjdb 6 | df 7 | s;dlbg 8 | sd 9 | ;lk 10 | ergljke6iu70693456 11 | 765756&%^&*^$%&*$&&^*&^*%&&&&&&& 12 | 13 | 14 | -------------------------------------------------------------------------------- /data/jilfiles/ftplugin/rust/options.cfg: -------------------------------------------------------------------------------- 1 | // Options for Rust 2 | 3 | wrap = false; 4 | 5 | expand_tab = true; 6 | tab_stop = 4; 7 | 8 | rulers = []; 9 | 10 | indent_keys = [ "{", "}" ]; 11 | 12 | -------------------------------------------------------------------------------- /src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if(JIL_ENABLE_UT) 2 | add_subdirectory(editor_unittest) 3 | endif() 4 | 5 | add_subdirectory(base) 6 | add_subdirectory(editor) 7 | add_subdirectory(ui) 8 | add_subdirectory(jil) 9 | -------------------------------------------------------------------------------- /src/jil/compile_config.h: -------------------------------------------------------------------------------- 1 | #ifndef JIL_COMPILE_CONFIG_H_ 2 | #define JIL_COMPILE_CONFIG_H_ 3 | 4 | // Allow only one instance of Jil. 5 | #define JIL_SINGLE_INSTANCE 1 6 | 7 | #endif // JIL_COMPILE_CONFIG_H_ 8 | -------------------------------------------------------------------------------- /data/jilfiles/ftplugin/cfg/options.cfg: -------------------------------------------------------------------------------- 1 | // Options for Cfg (libconfig) 2 | 3 | wrap = false; 4 | 5 | expand_tab = true; 6 | tab_stop = 4; 7 | 8 | rulers = [ 80 ]; 9 | 10 | indent_keys = [ "}", "]", ")" ]; 11 | -------------------------------------------------------------------------------- /third_party/src/lua/lua.hpp: -------------------------------------------------------------------------------- 1 | // lua.hpp 2 | // Lua header files for C++ 3 | // <> not supplied automatically because Lua also compiles as C++ 4 | 5 | extern "C" { 6 | #include "lua.h" 7 | #include "lualib.h" 8 | #include "lauxlib.h" 9 | } 10 | -------------------------------------------------------------------------------- /data/jilfiles/ftplugin/c/options.cfg: -------------------------------------------------------------------------------- 1 | // Options for C 2 | 3 | wrap = false; 4 | 5 | expand_tab = true; 6 | tab_stop = 2; 7 | 8 | rulers = [ 80 ]; 9 | 10 | indent_keys = [ "{", "}", "case" ]; 11 | 12 | indent = { 13 | indent_case = false; 14 | indent_macro_body = true; 15 | }; 16 | -------------------------------------------------------------------------------- /data/jilfiles/ftplugin/c/indent.lua: -------------------------------------------------------------------------------- 1 | -- Indent function for C 2 | 3 | -- All functions are defined under this "namespace" to avoid conflict 4 | -- among different file types. 5 | c = c or {} 6 | 7 | dofile('../cpp/indent.lua') 8 | 9 | -- Reuse cpp indent function. 10 | c.indent = cpp.indent 11 | -------------------------------------------------------------------------------- /third_party/src/pugixml/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(pugixml) 2 | 3 | cmake_minimum_required(VERSION 2.8) 4 | 5 | set(HEADERS pugixml.hpp pugiconfig.hpp) 6 | set(SOURCES ${HEADERS} pugixml.cpp) 7 | 8 | add_library(pugixml STATIC ${SOURCES}) 9 | 10 | set_target_properties(pugixml PROPERTIES VERSION 1.2 SOVERSION 1.2) 11 | -------------------------------------------------------------------------------- /data/jilfiles/ftplugin/cpp/options.cfg: -------------------------------------------------------------------------------- 1 | // Options for C++ 2 | 3 | wrap = false; 4 | 5 | expand_tab = true; 6 | tab_stop = 2; 7 | 8 | rulers = [ 80 ]; 9 | 10 | indent_keys = [ "{", "}", ":" ]; 11 | 12 | indent = { 13 | indent_namespace = true; 14 | indent_case = false; 15 | indent_preproc_body = true; 16 | }; 17 | -------------------------------------------------------------------------------- /src/base/math_util.cc: -------------------------------------------------------------------------------- 1 | #include "base/math_util.h" 2 | #include 3 | 4 | namespace base { 5 | 6 | int GetDigits(int number) { 7 | assert(number >= 0); 8 | 9 | int digits = 0; 10 | 11 | do { 12 | ++digits; 13 | number /= 10; 14 | } while (number > 0); 15 | 16 | return digits; 17 | } 18 | 19 | } // namespace base 20 | -------------------------------------------------------------------------------- /src/editor_unittest/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if(JIL_ENABLE_UT) 2 | file(GLOB UT_SRCS *.cc) 3 | 4 | set(UT_TARGET_NAME editor_unittest) 5 | 6 | add_executable(${UT_TARGET_NAME} ${UT_SRCS}) 7 | target_link_libraries(${UT_TARGET_NAME} ${wxWidgets_LIBRARIES} base editor uchardet gtest lua) 8 | 9 | add_test(${UT_TARGET_NAME} ${UT_TARGET_NAME}) 10 | endif() 11 | -------------------------------------------------------------------------------- /third_party/win32/bin/Microsoft.DTfW.DHL.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /data/jilfiles/ftplugin/jil-find_result/options.cfg: -------------------------------------------------------------------------------- 1 | // Options for Find Result 2 | 3 | wrap = false; 4 | 5 | // The text inside find result page all starts with a line number. If the 6 | // page itself also displays line numbers, it won't be clear for the user 7 | // to view the find result. 8 | show_number = false; 9 | 10 | show_space = false; 11 | 12 | show_hscrollbar = false; 13 | 14 | rulers = []; 15 | -------------------------------------------------------------------------------- /src/ui/button_style.cc: -------------------------------------------------------------------------------- 1 | #include "ui/button_style.h" 2 | 3 | namespace ui { 4 | 5 | void ButtonStyle::Fix() { 6 | // If any non-NORMAL is not available, use NORMAL. 7 | for (int i = 0; i < PARTS; ++i) { 8 | for (int j = 1; j < STATES; ++j) { 9 | if (!colors_[i][j].IsOk()) { 10 | colors_[i][j] = colors_[i][j-1]; 11 | } 12 | } 13 | } 14 | } 15 | 16 | } // namespace ui 17 | -------------------------------------------------------------------------------- /src/jil/i18n_util.h: -------------------------------------------------------------------------------- 1 | #ifndef JIL_I18N_UTIL_H_ 2 | #define JIL_I18N_UTIL_H_ 3 | 4 | #include "wx/intl.h" 5 | #include "wx/string.h" 6 | 7 | #define kTrColon _(":") 8 | 9 | namespace jil { 10 | 11 | // Append a translated colon to the given string. 12 | inline wxString TrColon(const wxChar* tr_str) { 13 | return wxString(tr_str) + kTrColon; 14 | } 15 | 16 | } // namespace jil 17 | 18 | #endif // JIL_I18N_UTIL_H_ 19 | -------------------------------------------------------------------------------- /third_party/src/libconfig/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(SRCS 2 | grammar.c 3 | grammar.h 4 | libconfig.c 5 | libconfig.h 6 | parsectx.h 7 | scanctx.c 8 | scanctx.h 9 | scanner.c 10 | scanner.h 11 | strbuf.c 12 | strbuf.h 13 | wincompat.h 14 | ) 15 | 16 | add_library(libconfig ${SRCS}) 17 | 18 | if(MSVC) 19 | set_target_properties(libconfig PROPERTIES COMPILE_FLAGS "/wd4290") 20 | endif() 21 | -------------------------------------------------------------------------------- /src/editor/text_point.cc: -------------------------------------------------------------------------------- 1 | #include "editor/text_point.h" 2 | 3 | namespace editor { 4 | 5 | bool operator<(const TextPoint& lhs, const TextPoint& rhs) { 6 | if (lhs.y < rhs.y) { 7 | return true; 8 | } 9 | if (lhs.y == rhs.y) { 10 | if (rhs.x == kInvCoord) { 11 | return lhs.x != kInvCoord; 12 | } else { 13 | return lhs.x < rhs.x; 14 | } 15 | } 16 | return false; 17 | } 18 | 19 | } // namespace editor 20 | -------------------------------------------------------------------------------- /src/jil/defs.cc: -------------------------------------------------------------------------------- 1 | #include "jil/defs.h" 2 | #include "jil/i18n_strings.h" 3 | 4 | namespace jil { 5 | 6 | const wxString kInternalFtIdPrefix = wxT("jil-"); 7 | 8 | // Internal file type IDs. 9 | // Format: "jil-xxx_yyy_zzz" 10 | const wxString kFindResultFtId = wxT("jil-find_result"); 11 | 12 | const wxString kTxtFtId = wxT("txt"); 13 | 14 | const editor::FileType kTxtFt(kTxtFtId, kTrPlainText); 15 | 16 | } // namespace jil 17 | 18 | -------------------------------------------------------------------------------- /src/jil/lex_config.h: -------------------------------------------------------------------------------- 1 | #ifndef JIL_LEX_CONFIG_H_ 2 | #define JIL_LEX_CONFIG_H_ 3 | 4 | // Load lex file. 5 | 6 | class wxString; 7 | 8 | namespace editor { 9 | class FtPlugin; 10 | } // namespace editor 11 | 12 | namespace jil { 13 | 14 | // Parse the lex file, set lex data to file type. 15 | bool LoadLexFile(const wxString& lex_cfg_file, editor::FtPlugin* ft_plugin); 16 | 17 | } // namespace jil 18 | 19 | #endif // JIL_LEX_CONFIG_H_ 20 | -------------------------------------------------------------------------------- /src/jil/about_dialog.h: -------------------------------------------------------------------------------- 1 | #ifndef JIL_ABOUT_DIALOG_H_ 2 | #define JIL_ABOUT_DIALOG_H_ 3 | 4 | #include "wx/dialog.h" 5 | 6 | class wxStaticText; 7 | 8 | namespace jil { 9 | 10 | class AboutDialog : public wxDialog { 11 | public: 12 | explicit AboutDialog(wxWindow* parent); 13 | 14 | virtual ~AboutDialog(); 15 | 16 | private: 17 | wxStaticText* NewLabel(const wxString& str); 18 | }; 19 | 20 | } // namespace jil 21 | 22 | #endif // JIL_ABOUT_DIALOG_H_ 23 | -------------------------------------------------------------------------------- /src/jil/status_fields_config.h: -------------------------------------------------------------------------------- 1 | #ifndef JIL_STATUS_FIELDS_CONFIG_H_ 2 | #define JIL_STATUS_FIELDS_CONFIG_H_ 3 | 4 | // Parse status bar fields. 5 | 6 | #include 7 | 8 | #include "jil/config.h" 9 | #include "jil/status_bar.h" 10 | 11 | namespace jil { 12 | 13 | typedef std::vector FieldInfos; 14 | 15 | bool ParseStatusFields(Setting fields_setting, FieldInfos* field_infos); 16 | 17 | } // namespace jil 18 | 19 | #endif // JIL_STATUS_FIELDS_CONFIG_H_ 20 | -------------------------------------------------------------------------------- /data/jilfiles/status_fields.cfg: -------------------------------------------------------------------------------- 1 | list = ( 2 | { id = "caret"; align = "left"; size_type = "stretch"; size_value = 1; }, 3 | { id = "tab_options"; align = "center"; size_type = "fit"; size_value = 0; min_size = 12; }, 4 | { id = "encoding"; align = "center"; size_type = "fit"; size_value = 0; min_size = 14; }, 5 | { id = "file_format"; align = "center"; size_type = "fit"; size_value = 0; min_size = 8; }, 6 | { id = "file_type"; align = "right"; size_type = "fit"; size_value = 0; min_size = 14; } 7 | ); 8 | -------------------------------------------------------------------------------- /src/jil/goto_dialog.h: -------------------------------------------------------------------------------- 1 | #ifndef JIL_GOTO_DIALOG_H_ 2 | #define JIL_GOTO_DIALOG_H_ 3 | 4 | #include "wx/dialog.h" 5 | 6 | class wxTextCtrl; 7 | 8 | namespace jil { 9 | 10 | // GotoDialog is used for the user to input a line number to go to. 11 | class GotoDialog : public wxDialog { 12 | public: 13 | GotoDialog(wxWindow* parent, wxWindowID id); 14 | virtual ~GotoDialog(); 15 | 16 | int line() const { return line_; } 17 | 18 | private: 19 | wxTextCtrl* line_text_ctrl_; 20 | int line_; 21 | }; 22 | 23 | } // namespace jil 24 | 25 | #endif // JIL_GOTO_DIALOG_H_ 26 | -------------------------------------------------------------------------------- /src/editor/tab.h: -------------------------------------------------------------------------------- 1 | #ifndef EDITOR_TAB_H_ 2 | #define EDITOR_TAB_H_ 3 | 4 | #include 5 | 6 | #include "editor/text_point.h" 7 | 8 | namespace editor { 9 | 10 | // Fast version of tab expanding. 11 | // Suppose tab stop is 4, given "a\tbc" you will get "a bc ". 12 | void TabbedLineFast(int tab_stop, std::wstring* line); 13 | 14 | // Return the tabbed length of line.substr(0, count). 15 | Coord TabbedLineLength(int tab_stop, const std::wstring& line, 16 | Coord count = kInvCoord); 17 | 18 | } // namespace editor 19 | 20 | #endif // EDITOR_TAB_H_ 21 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | *.sln merge=union 7 | *.csproj merge=union 8 | *.vbproj merge=union 9 | *.fsproj merge=union 10 | *.dbproj merge=union 11 | 12 | # Standard to msysgit 13 | *.doc diff=astextplain 14 | *.DOC diff=astextplain 15 | *.docx diff=astextplain 16 | *.DOCX diff=astextplain 17 | *.dot diff=astextplain 18 | *.DOT diff=astextplain 19 | *.pdf diff=astextplain 20 | *.PDF diff=astextplain 21 | *.rtf diff=astextplain 22 | *.RTF diff=astextplain 23 | -------------------------------------------------------------------------------- /src/jil/log.cc: -------------------------------------------------------------------------------- 1 | #include "jil/log.h" 2 | 3 | namespace jil { 4 | 5 | // static 6 | LogBuffer* LogBuffer::Get() { 7 | static std::auto_ptr buffer(new LogBuffer); 8 | return buffer.get(); 9 | } 10 | 11 | bool LogBuffer::Add(const wxString& log) { 12 | logs_.push_back(log); 13 | return true; 14 | } 15 | 16 | //////////////////////////////////////////////////////////////////////////////// 17 | 18 | LogUser::LogUser() { 19 | } 20 | 21 | LogUser::~LogUser() { 22 | } 23 | 24 | void LogUser::Log(const wxString& log) { 25 | LogBuffer::Get()->Add(log); 26 | } 27 | 28 | } // namespace jil 29 | -------------------------------------------------------------------------------- /src/ui/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(SRCS 2 | bitmap_button.cc 3 | bitmap_button.h 4 | bitmap_button_base.cc 5 | bitmap_button_base.h 6 | bitmap_toggle_button.cc 7 | bitmap_toggle_button.h 8 | button_base.cc 9 | button_base.h 10 | button_style.cc 11 | button_style.h 12 | color.cc 13 | color.h 14 | label.cc 15 | label.h 16 | separator.h 17 | static_box.cc 18 | static_box.h 19 | string_list_ctrl.cc 20 | string_list_ctrl.h 21 | text_button.cc 22 | text_button.h 23 | util.cc 24 | util.h 25 | ) 26 | 27 | add_library(ui ${SRCS}) 28 | -------------------------------------------------------------------------------- /src/jil/theme_config.h: -------------------------------------------------------------------------------- 1 | #ifndef JIL_THEME_CONFIG_H_ 2 | #define JIL_THEME_CONFIG_H_ 3 | 4 | #include "editor/theme.h" 5 | 6 | #include "jil/option.h" 7 | 8 | // Load theme file. 9 | 10 | class wxString; 11 | 12 | namespace editor { 13 | class Style; 14 | } 15 | 16 | namespace jil { 17 | 18 | // \param theme_folder The root dir of a theme. 19 | bool LoadThemeFile(const wxString& theme_folder, 20 | Resolution icon_size, 21 | editor::SharedTheme& theme, 22 | editor::Style* style); 23 | 24 | } // namespace jil 25 | 26 | #endif // JIL_THEME_CONFIG_H_ 27 | -------------------------------------------------------------------------------- /data/jilfiles/ftplugin/cfg/lex.cfg: -------------------------------------------------------------------------------- 1 | // Lex for Cfg (libconfig) 2 | // See www.hyperrealm.com/libconfig/ 3 | // Last update: 2015-10-26 4 | 5 | lex = ( 6 | { id = "comment"; quote = [ "/*", "*/" ]; multi_line = true; }, 7 | { id = "comment"; quote = [ "//" ]; }, 8 | { id = "comment"; quote = [ "#" ]; }, 9 | { id = "constant.string"; quote = [ "\"", "\"" ]; }, 10 | 11 | { id = "constant.bool"; anyof = "true false"; }, 12 | 13 | { id = "constant.number"; prefix = "\d"; use_regex = true; }, 14 | 15 | { id = "identifier"; next = "="; }, 16 | { id = "identifier"; next = ":"; } 17 | ); 18 | -------------------------------------------------------------------------------- /data/jilfiles/ftplugin/xml/lex.cfg: -------------------------------------------------------------------------------- 1 | // Lex for XML 2 | // Last update: 2015-10-26 3 | 4 | lex = ( 5 | // Note that the grammar does not allow a comment ending in --->. 6 | // The following example is not well-formed. 7 | // 8 | { id = "comment"; quote = [ "" ]; multi_line = true; }, 9 | 10 | { id = "constant.string"; quote = [ "\"", "\"" ]; }, 11 | 12 | // Example: 16 | { id = "statement"; next = ">"; }, 17 | 18 | // Example: top++; api_check(L->top <= L->ci->top, \ 15 | "stack overflow");} 16 | 17 | #define adjustresults(L,nres) \ 18 | { if ((nres) == LUA_MULTRET && L->ci->top < L->top) L->ci->top = L->top; } 19 | 20 | #define api_checknelems(L,n) api_check((n) < (L->top - L->ci->func), \ 21 | "not enough elements in the stack") 22 | 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /third_party/src/lua/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(SRCS 2 | lapi.c 3 | lcode.c 4 | lctype.c 5 | ldebug.c 6 | ldo.c 7 | ldump.c 8 | lfunc.c 9 | lgc.c 10 | llex.c 11 | lmem.c 12 | lobject.c 13 | lopcodes.c 14 | lparser.c 15 | lstate.c 16 | lstring.c 17 | ltable.c 18 | ltm.c 19 | lundump.c 20 | lvm.c 21 | lzio.c 22 | lauxlib.c 23 | lbaselib.c 24 | lbitlib.c 25 | lcorolib.c 26 | ldblib.c 27 | liolib.c 28 | lmathlib.c 29 | loslib.c 30 | lstrlib.c 31 | ltablib.c 32 | lutf8lib.c 33 | loadlib.c 34 | linit.c 35 | ) 36 | 37 | add_library(lua ${SRCS}) 38 | -------------------------------------------------------------------------------- /data/jilfiles/ftplugin/cue/lex.cfg: -------------------------------------------------------------------------------- 1 | // Lex for Cue 2 | // A cue file, or cue sheet, is a metadata file which describes how the tracks 3 | // of a CD are laid out. 4 | // Last update: 2015-11-17 5 | 6 | ignore_case = true; 7 | 8 | lex = ( 9 | { id = "constant.string"; quote = [ "\"", "\"" ]; }, 10 | { id = "comment"; quote = [ "REM" ]; }, 11 | 12 | { 13 | id = "statement"; 14 | anyof = "FILE TRACK INDEX PREGAP POSTGAP CDTEXTFILE " 15 | "FLAGS CATALOG ISRC TITLE PERFORMER SONGWRITER"; 16 | }, 17 | 18 | { id = "constant"; regex = "\d\d:\d\d:\d\d"; }, 19 | { id = "constant.number"; prefix = "\d"; use_regex = true; } 20 | 21 | ); 22 | -------------------------------------------------------------------------------- /src/jil/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by app.rc 4 | 5 | // Next default values for new objects 6 | // 7 | #ifdef APSTUDIO_INVOKED 8 | #ifndef APSTUDIO_READONLY_SYMBOLS 9 | #define _APS_NEXT_RESOURCE_VALUE 101 10 | #define _APS_NEXT_COMMAND_VALUE 40001 11 | #define _APS_NEXT_CONTROL_VALUE 1001 12 | #define _APS_NEXT_SYMED_VALUE 101 13 | #endif 14 | #endif 15 | 16 | // NOTE: The value order matters! See RC file for details. 17 | //#define IDI_EDITOR 102 // No!!! Don't do this! See RC file. 18 | #define IDI_EDITOR_16 103 19 | #define IDI_EDITOR_32 104 20 | 21 | -------------------------------------------------------------------------------- /src/editor_unittest/tab_util_unittest.cc: -------------------------------------------------------------------------------- 1 | #include "gtest/gtest.h" 2 | 3 | #include "editor/tab.h" 4 | // 5 | //TEST(TextLine, TabbedLineFast) { 6 | // using editor::TabbedLineFast; 7 | // 8 | // std::wstring line; 9 | // EXPECT_EQ(std::wstring(L""), TabbedLineFast(4, line)); 10 | // 11 | // line = L"\t"; 12 | // EXPECT_EQ(std::wstring(L" "), TabbedLineFast(4, line)); 13 | // 14 | // line = L"\t\t"; 15 | // EXPECT_EQ(std::wstring(L" "), TabbedLineFast(4, line)); 16 | // 17 | // line = L"a\t"; 18 | // EXPECT_EQ(std::wstring(L"a "), TabbedLineFast(4, line)); 19 | // 20 | // line = L"ab\tc\tde"; 21 | // EXPECT_EQ(std::wstring(L"ab c de "), TabbedLineFast(4, line)); 22 | //} 23 | -------------------------------------------------------------------------------- /data/test/ft_samples/lua/test.lua: -------------------------------------------------------------------------------- 1 | function printf(...) io.write(string.format(unpack(arg))) end 2 | 3 | function Account:show() 4 | printf("Account balance = $%0.02f\n", self:balance()) 5 | end 6 | 7 | a = Account(100) 8 | b = Account:new(30) 9 | 10 | print('a =', a) 11 | print('b =', b) 12 | print('metatable =', getmetatable(a)) 13 | print('Account =', Account) 14 | table.foreach(Account, print) 15 | 16 | a:show() a:deposit(50.30) a:show() a:withdraw(25.10) a:show() 17 | 18 | parent = {} 19 | 20 | function parent:rob(amount) 21 | amount = amount or self:balance() 22 | self:withdraw(amount) 23 | return amount 24 | end 25 | 26 | getmetatable(Account).__index = parent 27 | 28 | debug.debug() -------------------------------------------------------------------------------- /data/test/chardet/utf8.txt: -------------------------------------------------------------------------------- 1 | UTF-8(8-bit Unicode Transformation Format)是一种针对Unicode的可变长度字符编码(定长码),也是一种前缀码。它可以用来表示Unicode标准中的任何字符,且其编码中的第一个字节仍与ASCII兼容,这使得原来处理ASCII字符的软件无须或只须做少部份修改,即可继续使用。因此,它逐渐成为电子邮件、网页及其他存储或传送文字的应用中,优先采用的编码。 2 | UTF-8使用一至四个字节为每个字符编码: 3 | 128个US-ASCII字符只需一个字节编码(Unicode范围由U+0000至U+007F)。 4 | 带有附加符号的拉丁文、希腊文、西里尔字母、亚美尼亚语、希伯来文、阿拉伯文、叙利亚文及它拿字母则需要二个字节编码(Unicode范围由U+0080至U+07FF)。 5 | 其他基本多文种平面(BMP)中的字符(这包含了大部分常用字)使用三个字节编码。 6 | 其他极少使用的Unicode 辅助平面的字符使用四字节编码。 7 | 对上述提及的第四种字符而言,UTF-8使用四个字节来编码似乎太耗费资源了。但UTF-8对所有常用的字符都可以用三个字节表示,而且它的另一种选择,UTF-16编码,对前述的第四种字符同样需要四个字节来编码,所以要决定UTF-8或UTF-16哪种编码比较有效率,还要视所使用的字符的分布范围而定。不过,如果使用一些传统的压缩系统,比如DEFLATE,则这些不同编码系统间的的差异就变得微不足道了。若顾及传统压缩算法在压缩较短文字上的效果不大,可以考虑使用Unicode标准压缩格式(SCSU)。 8 | 9 | -------------------------------------------------------------------------------- /src/editor/file_io.h: -------------------------------------------------------------------------------- 1 | #ifndef EDITOR_FILE_IO_H_ 2 | #define EDITOR_FILE_IO_H_ 3 | 4 | #include 5 | 6 | #include "wx/string.h" 7 | 8 | namespace editor { 9 | 10 | // Read file in bytes. 11 | // Return 0 on success, 1 on IO error and 2 on exceeding bytes limit. 12 | int ReadBytes(const wxString& filename, 13 | std::string* bytes, 14 | std::size_t max_bytes = std::string::npos); 15 | 16 | // Save file in bytes. 17 | // The bytes could be empty. 18 | // Return 0 on success, 1 on IO error. 19 | int SaveBytes(const wxString& filename, const char* bom, 20 | const std::string& bytes); 21 | 22 | } // namespace editor 23 | 24 | #endif // EDITOR_FILE_IO_H_ 25 | -------------------------------------------------------------------------------- /data/test/chardet/utf8 bom.txt: -------------------------------------------------------------------------------- 1 | UTF-8(8-bit Unicode Transformation Format)是一种针对Unicode的可变长度字符编码(定长码),也是一种前缀码。它可以用来表示Unicode标准中的任何字符,且其编码中的第一个字节仍与ASCII兼容,这使得原来处理ASCII字符的软件无须或只须做少部份修改,即可继续使用。因此,它逐渐成为电子邮件、网页及其他存储或传送文字的应用中,优先采用的编码。 2 | UTF-8使用一至四个字节为每个字符编码: 3 | 128个US-ASCII字符只需一个字节编码(Unicode范围由U+0000至U+007F)。 4 | 带有附加符号的拉丁文、希腊文、西里尔字母、亚美尼亚语、希伯来文、阿拉伯文、叙利亚文及它拿字母则需要二个字节编码(Unicode范围由U+0080至U+07FF)。 5 | 其他基本多文种平面(BMP)中的字符(这包含了大部分常用字)使用三个字节编码。 6 | 其他极少使用的Unicode 辅助平面的字符使用四字节编码。 7 | 对上述提及的第四种字符而言,UTF-8使用四个字节来编码似乎太耗费资源了。但UTF-8对所有常用的字符都可以用三个字节表示,而且它的另一种选择,UTF-16编码,对前述的第四种字符同样需要四个字节来编码,所以要决定UTF-8或UTF-16哪种编码比较有效率,还要视所使用的字符的分布范围而定。不过,如果使用一些传统的压缩系统,比如DEFLATE,则这些不同编码系统间的的差异就变得微不足道了。若顾及传统压缩算法在压缩较短文字上的效果不大,可以考虑使用Unicode标准压缩格式(SCSU)。 8 | 9 | -------------------------------------------------------------------------------- /src/ui/util.h: -------------------------------------------------------------------------------- 1 | #ifndef UI_UTIL_H_ 2 | #define UI_UTIL_H_ 3 | 4 | #include "wx/gdicmn.h" 5 | #include "wx/string.h" 6 | 7 | class wxBitmap; 8 | class wxDC; 9 | 10 | namespace ui { 11 | 12 | extern const wxString kEllipsis; // ... 13 | 14 | std::size_t TailorLabel(const wxDC& dc, const wxString& label, int max_width); 15 | 16 | // Draw text in the rect. 17 | // The text will be truncated and ellipsis will be appended if it's too long. 18 | void DrawTextInRect(wxDC& dc, const wxString& text, const wxRect& rect); 19 | 20 | // Get the size of the given bitmap. 21 | // Return wxDefaultSize if the bitmap is not OK. 22 | wxSize GetBitmapSize(const wxBitmap& bitmap); 23 | 24 | } // namespace ui 25 | 26 | #endif // UI_UTIL_H_ 27 | -------------------------------------------------------------------------------- /src/jil/pref/editor_dialog.h: -------------------------------------------------------------------------------- 1 | #ifndef JIL_PREF_EDITOR_DIALOG_H_ 2 | #define JIL_PREF_EDITOR_DIALOG_H_ 3 | 4 | #include "jil/pref/dialog_base.h" 5 | 6 | namespace editor { 7 | class Options; 8 | } // namespace editor 9 | 10 | namespace jil { 11 | namespace pref { 12 | 13 | // Editor (Syntax specific) preferences dialog. 14 | class EditorDialog : public DialogBase { 15 | public: 16 | explicit EditorDialog(editor::Options* options) : options_(options) { 17 | } 18 | 19 | ~EditorDialog() override = default; 20 | 21 | protected: 22 | void AddPages() override; 23 | 24 | private: 25 | editor::Options* options_; 26 | }; 27 | 28 | } // namespace pref 29 | } // namespace jil 30 | 31 | #endif // JIL_PREF_EDITOR_DIALOG_H_ 32 | -------------------------------------------------------------------------------- /data/jilfiles/options.cfg: -------------------------------------------------------------------------------- 1 | // Global options. 2 | 3 | // Detect CJK file encodings. 4 | cjk = "c"; 5 | 6 | // Encoding for new created file. 7 | file_encoding = "utf-8"; 8 | 9 | // Color scheme. 10 | theme = ""; 11 | 12 | icon_size = "normal"; 13 | 14 | // Fonts. 15 | fonts = { 16 | // Font group example: { name = "Consolas"; size = 10; } 17 | text = {}; 18 | tabs = {}; 19 | status_bar = {}; 20 | find_panel = {}; 21 | }; 22 | 23 | // Spacing at the top and bottom of a line. 24 | line_padding = 1; 25 | 26 | // Switch Current Working Dir when switch text page. 27 | switch_cwd = true; 28 | 29 | // Remember last open files. 30 | restore_files = true; 31 | 32 | // Show file path in the title bar. 33 | show_path = true; 34 | 35 | -------------------------------------------------------------------------------- /src/jil/log.h: -------------------------------------------------------------------------------- 1 | #ifndef JIL_LOG_H_ 2 | #define JIL_LOG_H_ 3 | 4 | #include 5 | #include 6 | 7 | #include "wx/string.h" 8 | 9 | namespace jil { 10 | 11 | //////////////////////////////////////////////////////////////////////////////// 12 | 13 | class LogBuffer { 14 | public: 15 | static LogBuffer* Get(); 16 | 17 | bool Add(const wxString& log); 18 | 19 | private: 20 | LogBuffer() { 21 | } 22 | 23 | private: 24 | std::list logs_; 25 | }; 26 | 27 | //////////////////////////////////////////////////////////////////////////////// 28 | 29 | class LogUser { 30 | public: 31 | LogUser(); 32 | virtual ~LogUser(); 33 | 34 | void Log(const wxString& log); 35 | }; 36 | 37 | } // namespace jil 38 | 39 | #endif // JIL_LOG_H_ 40 | -------------------------------------------------------------------------------- /src/ui/static_box.h: -------------------------------------------------------------------------------- 1 | #ifndef UI_STATIC_BOX_H_ 2 | #define UI_STATIC_BOX_H_ 3 | 4 | // A replacement of wxStaticBox. 5 | 6 | #include "wx/panel.h" 7 | 8 | namespace ui { 9 | 10 | class StaticBox : public wxPanel { 11 | DECLARE_EVENT_TABLE() 12 | 13 | public: 14 | StaticBox(wxWindow* parent, const wxString& label); 15 | virtual ~StaticBox(); 16 | 17 | void set_border_colour(const wxColour& border_colour) { 18 | border_colour_ = border_colour; 19 | } 20 | 21 | // Don't call SetSizer(). 22 | void SetBodySizer(wxSizer* body_sizer); 23 | 24 | protected: 25 | void OnPaint(wxPaintEvent& evt); 26 | 27 | private: 28 | wxSize padding_; 29 | wxColour border_colour_; 30 | }; 31 | 32 | } // namespace ui 33 | 34 | #endif // UI_STATIC_BOX_H_ 35 | -------------------------------------------------------------------------------- /src/jil/pref/dialog_base.h: -------------------------------------------------------------------------------- 1 | #ifndef JIL_PREF_DIALOG_BASE_H_ 2 | #define JIL_PREF_DIALOG_BASE_H_ 3 | 4 | #include "wx/dialog.h" 5 | 6 | class wxNotebook; 7 | 8 | namespace jil { 9 | namespace pref { 10 | 11 | class DialogBase : public wxDialog { 12 | DECLARE_EVENT_TABLE() 13 | 14 | public: 15 | virtual ~DialogBase() = default; 16 | 17 | bool Create(wxWindow* parent, wxWindowID id, const wxString& title); 18 | 19 | protected: 20 | DialogBase() : notebook_(NULL) { 21 | } 22 | 23 | virtual void AddPages() = 0; 24 | 25 | void OnButtonOK(wxCommandEvent& evt); 26 | void OnButtonCancel(wxCommandEvent& evt); 27 | 28 | protected: 29 | wxNotebook* notebook_; 30 | }; 31 | 32 | } // namespace pref 33 | } // namespace jil 34 | 35 | #endif // JIL_PREF_DIALOG_BASE_H_ 36 | -------------------------------------------------------------------------------- /src/jil/pref/global_dialog.h: -------------------------------------------------------------------------------- 1 | #ifndef JIL_PREF_GLOBAL_DIALOG_H_ 2 | #define JIL_PREF_GLOBAL_DIALOG_H_ 3 | 4 | #include "jil/pref/dialog_base.h" 5 | 6 | class wxBookCtrlEvent; 7 | 8 | namespace jil { 9 | 10 | class Options; 11 | 12 | namespace pref { 13 | 14 | // Global preferences dialog. 15 | class GlobalDialog : public DialogBase { 16 | DECLARE_EVENT_TABLE() 17 | 18 | public: 19 | explicit GlobalDialog(Options* options) : options_(options) { 20 | } 21 | 22 | ~GlobalDialog() override = default; 23 | 24 | protected: 25 | void AddPages() override; 26 | 27 | void OnNotebookPageChanged(wxBookCtrlEvent& evt); 28 | 29 | private: 30 | Options* options_; 31 | }; 32 | 33 | } // namespace pref 34 | } // namespace jil 35 | 36 | #endif // JIL_PREF_GLOBAL_DIALOG_H_ 37 | -------------------------------------------------------------------------------- /third_party/include/LuaBridge/detail/dump.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | std::string dumpLuaState(lua_State *L) { 5 | std::stringstream ostr; 6 | int i; 7 | int top = lua_gettop(L); 8 | ostr << "top=" << top << ":\n"; 9 | for (i = 1; i <= top; ++i) { 10 | int t = lua_type(L, i); 11 | switch(t) { 12 | case LUA_TSTRING: 13 | ostr << " " << i << ": '" << lua_tostring(L, i) << "'\n"; 14 | break; 15 | case LUA_TBOOLEAN: 16 | ostr << " " << i << ": " << 17 | (lua_toboolean(L, i) ? "true" : "false") << "\n"; 18 | break; 19 | case LUA_TNUMBER: 20 | ostr << " " << i << ": " << lua_tonumber(L, i) << "\n"; 21 | break; 22 | default: 23 | ostr << " " << i << ": TYPE=" << lua_typename(L, t) << "\n"; 24 | break; 25 | } 26 | } 27 | return ostr.str(); 28 | } 29 | -------------------------------------------------------------------------------- /src/ui/text_button.h: -------------------------------------------------------------------------------- 1 | #ifndef UI_TEXT_BUTTON_H_ 2 | #define UI_TEXT_BUTTON_H_ 3 | 4 | // A button displaying text label. 5 | 6 | #include "ui/button_base.h" 7 | 8 | namespace ui { 9 | 10 | class TextButton : public ButtonBase { 11 | DECLARE_CLASS(TextButton) 12 | DECLARE_NO_COPY_CLASS(TextButton) 13 | 14 | public: 15 | explicit TextButton(SharedButtonStyle style) : ButtonBase(style) { 16 | } 17 | 18 | ~TextButton() override = default; 19 | 20 | bool Create(wxWindow* parent, wxWindowID id, const wxString& label); 21 | 22 | protected: 23 | wxSize DoGetBestSize() const override; 24 | 25 | ButtonStyle::State GetState() const override; 26 | 27 | void DrawFg(wxDC& dc, ButtonStyle::State state) override; 28 | 29 | void PostEvent() override; 30 | }; 31 | 32 | } // namespace ui 33 | 34 | #endif // UI_TEXT_BUTTON_H_ 35 | -------------------------------------------------------------------------------- /src/jil/option_config.h: -------------------------------------------------------------------------------- 1 | #ifndef JIL_OPTION_CONFIG_H_ 2 | #define JIL_OPTION_CONFIG_H_ 3 | 4 | #include 5 | 6 | #include "wx/string.h" 7 | 8 | #include "jil/option.h" 9 | 10 | // Parse option settings. 11 | 12 | namespace editor { 13 | class Options; 14 | } // namespace editor 15 | 16 | namespace jil { 17 | 18 | class Setting; 19 | 20 | class Options; 21 | 22 | std::string ResolutionToStr(Resolution resolution); 23 | 24 | bool LoadGlobalOptionsFile(const wxString& cfg_file, Options* options); 25 | bool SaveGlobalOptionsFile(const wxString& cfg_file, const Options& options); 26 | 27 | bool LoadEditorOptionsFile(const wxString& cfg_file, editor::Options* options); 28 | bool SaveEditorOptionsFile(const wxString& cfg_file, const editor::Options& options); 29 | 30 | } // namespace jil 31 | 32 | #endif // JIL_OPTION_CONFIG_H_ 33 | -------------------------------------------------------------------------------- /src/jil/binding_config.h: -------------------------------------------------------------------------------- 1 | #ifndef JIL_BINDING_CONFIG_H_ 2 | #define JIL_BINDING_CONFIG_H_ 3 | 4 | // Parse binding config. 5 | 6 | #include 7 | #include 8 | 9 | #include "editor/defs.h" 10 | 11 | namespace editor { 12 | class Binding; 13 | } // namespace editor 14 | 15 | namespace jil { 16 | 17 | class Setting; 18 | 19 | class BindingConfig { 20 | public: 21 | explicit BindingConfig(editor::Binding* binding); 22 | ~BindingConfig(); 23 | 24 | bool Load(const wxString& binding_cfg_file); 25 | 26 | private: 27 | // Example: "delete.word.next", "ctrl+delete", kNormalMode 28 | bool ParseBinding(const std::string& cmd, const std::string& key, int modes); 29 | 30 | bool ParseBindingItem(const Setting& setting); 31 | 32 | private: 33 | editor::Binding* binding_; 34 | }; 35 | 36 | } // namespace jil 37 | 38 | #endif // JIL_BINDING_CONFIG_H_ 39 | -------------------------------------------------------------------------------- /src/ui/bitmap_button.h: -------------------------------------------------------------------------------- 1 | #ifndef UI_BITMAP_BUTTON_H_ 2 | #define UI_BITMAP_BUTTON_H_ 3 | 4 | // A replacement of wxBitmapButton. 5 | // Note: 6 | // BitmapButton emits the same event as wxBitmapButton: 7 | // Event type: wxEVT_BUTTON 8 | // Macro: EVT_BUTTON(id, func) 9 | 10 | #include "ui/bitmap_button_base.h" 11 | 12 | #include "wx/button.h" // For wxEVT_BUTTON, etc. 13 | 14 | namespace ui { 15 | 16 | class BitmapButton : public BitmapButtonBase { 17 | DECLARE_CLASS(BitmapButton) 18 | DECLARE_NO_COPY_CLASS(BitmapButton) 19 | 20 | public: 21 | explicit BitmapButton(SharedButtonStyle style); 22 | virtual ~BitmapButton(); 23 | 24 | bool Create(wxWindow* parent, wxWindowID id); 25 | 26 | protected: 27 | ButtonStyle::State GetState() const override; 28 | 29 | void PostEvent() override; 30 | }; 31 | 32 | } // namespace ui 33 | 34 | #endif // UI_BITMAP_BUTTON_H_ 35 | -------------------------------------------------------------------------------- /src/editor/lua_proxy.h: -------------------------------------------------------------------------------- 1 | #ifndef EDITOR_LUA_PROXY_H_ 2 | #define EDITOR_LUA_PROXY_H_ 3 | 4 | #include 5 | 6 | extern "C" { 7 | #include "lua.h" 8 | #include "lauxlib.h" 9 | } 10 | #include "LuaBridge/LuaBridge.h" 11 | 12 | class wxString; 13 | 14 | namespace editor { 15 | 16 | // Bind classes, functions and variables to Lua. 17 | void InitLua(lua_State* lua_state); 18 | 19 | bool LoadLuaFile(lua_State* lua_state, 20 | const wxString& file, 21 | std::string* lua_error = NULL); 22 | 23 | // Get global lua value with the given name. 24 | luabridge::LuaRef GetLuaValue(lua_State* lua_state, const char* name); 25 | 26 | // Get lua value with the given name under the global table 'ns'. 27 | luabridge::LuaRef GetLuaValue(lua_State* lua_state, const char* ns, 28 | const char* name); 29 | 30 | } // namespace editor 31 | 32 | #endif // EDITOR_LUA_PROXY_H_ 33 | -------------------------------------------------------------------------------- /src/jil/tool_book.h: -------------------------------------------------------------------------------- 1 | #ifndef JIL_TOOL_BOOK_H_ 2 | #define JIL_TOOL_BOOK_H_ 3 | 4 | #include "jil/book_ctrl.h" 5 | 6 | namespace jil { 7 | 8 | class ToolBook : public BookCtrl { 9 | DECLARE_EVENT_TABLE() 10 | 11 | public: 12 | ToolBook(); 13 | virtual ~ToolBook(); 14 | 15 | bool Create(wxWindow* parent, wxWindowID id); 16 | 17 | wxPanel* page_area() const { 18 | return page_panel_; 19 | } 20 | 21 | protected: 22 | virtual void HandleTabMouseRightUp(wxMouseEvent& evt) override; 23 | 24 | virtual void DoActivateTab(Tab* tab, bool active) override; 25 | virtual void DoRemoveTab(Tab* tab, bool from_remove_all) override; 26 | 27 | // Handlers for right click menu items on the tab area. 28 | void OnMenuClose(wxCommandEvent& evt); 29 | void OnMenuCloseAll(wxCommandEvent& evt); 30 | void OnMenuCloseAllButThis(wxCommandEvent& evt); 31 | }; 32 | 33 | } // namespace jil 34 | 35 | #endif // JIL_TOOL_BOOK_H_ 36 | -------------------------------------------------------------------------------- /src/editor_unittest/text_range_unittest.cc: -------------------------------------------------------------------------------- 1 | #include "editor/text_range.h" 2 | #include "gtest/gtest.h" 3 | 4 | using namespace editor; 5 | 6 | TEST(LineRange, IntersectWith_Empty) { 7 | LineRange lr1; 8 | LineRange lr2; 9 | EXPECT_FALSE(lr1.IntersectWith(lr2)); 10 | } 11 | 12 | TEST(LineRange, IntersectWith) { 13 | LineRange lr1(1, 3); 14 | LineRange lr2(5, 8); 15 | EXPECT_FALSE(lr1.IntersectWith(lr2)); 16 | 17 | lr2.Set(3, 5); 18 | EXPECT_TRUE(lr1.IntersectWith(lr2)); 19 | 20 | lr1.Set(4, 6); 21 | EXPECT_TRUE(lr1.IntersectWith(lr2)); 22 | } 23 | 24 | TEST(TextRange, IsEmpty) { 25 | TextRange range; 26 | EXPECT_TRUE(range.IsEmpty()); 27 | } 28 | 29 | TEST(TextRange, Set) { 30 | TextRange range; 31 | 32 | TextPoint point_begin(1, 1); 33 | TextPoint point_end(0, 3); 34 | 35 | range.Set(point_begin, point_end); 36 | 37 | EXPECT_EQ(point_begin, range.point_begin()); 38 | EXPECT_EQ(point_end, range.point_end()); 39 | } 40 | -------------------------------------------------------------------------------- /src/base/math_util.h: -------------------------------------------------------------------------------- 1 | #ifndef BASE_MATH_UTIL_H_ 2 | #define BASE_MATH_UTIL_H_ 3 | #pragma once 4 | 5 | #include 6 | 7 | namespace base { 8 | 9 | const double PI = 3.14159265358979323846; 10 | const double PI_1_2 = 1.57079632679489661923; // 1/2 PI 11 | const double PI_3_2 = 4.71238898038468985769; // 3/2 PI 12 | 13 | inline int Round(const double& d) { 14 | return static_cast(std::floor(d + 0.5)); 15 | } 16 | 17 | inline double RadianToDegree(double radians) { 18 | return radians * 180.0 / PI; 19 | } 20 | 21 | inline double DegreeToRadian(double degrees) { 22 | return degrees * PI / 180.0; 23 | } 24 | 25 | const double kRadian0 = 0.0; 26 | const double kRadian90 = PI_1_2; 27 | const double kRadian180 = PI; 28 | const double kRadian270 = PI_3_2; 29 | 30 | // Get the digit count of the number. 31 | // 1 for number 0 ~ 9, 2 for number 10 ~ 99, etc. 32 | int GetDigits(int number); 33 | 34 | } // namespace base 35 | 36 | #endif // BASE_MATH_UTIL_H_ 37 | -------------------------------------------------------------------------------- /src/editor/line_nr_area.h: -------------------------------------------------------------------------------- 1 | #ifndef EDITOR_LINE_NR_AREA_H_ 2 | #define EDITOR_LINE_NR_AREA_H_ 3 | 4 | // Line number area displays the line numbers, fold marks, etc. 5 | 6 | #include "wx/panel.h" 7 | 8 | namespace editor { 9 | 10 | class TextWindow; 11 | 12 | class LineNrArea : public wxPanel { 13 | DECLARE_EVENT_TABLE() 14 | 15 | public: 16 | explicit LineNrArea(TextWindow* text_window); 17 | 18 | virtual ~LineNrArea(); 19 | 20 | bool Create(wxWindow* parent, wxWindowID id); 21 | 22 | // Override to accept no focus. 23 | // Text area should always be focused. 24 | bool AcceptsFocus() const override { 25 | return false; 26 | } 27 | 28 | protected: 29 | void OnPaint(wxPaintEvent& evt); 30 | void OnSize(wxSizeEvent& evt); 31 | void OnMouse(wxMouseEvent& evt); 32 | void OnMouseCaptureLost(wxMouseCaptureLostEvent& evt); 33 | 34 | private: 35 | TextWindow* text_window_; 36 | }; 37 | 38 | } // namespace editor 39 | 40 | #endif // EDITOR_LINE_NR_AREA_H_ 41 | -------------------------------------------------------------------------------- /src/editor/text_area.h: -------------------------------------------------------------------------------- 1 | #ifndef EDITOR_TEXT_AREA_H_ 2 | #define EDITOR_TEXT_AREA_H_ 3 | 4 | #include "wx/panel.h" 5 | 6 | namespace editor { 7 | 8 | class TextWindow; 9 | 10 | class TextArea : public wxPanel { 11 | DECLARE_EVENT_TABLE() 12 | 13 | public: 14 | explicit TextArea(TextWindow* text_window); 15 | bool Create(wxWindow* parent, wxWindowID id); 16 | 17 | // Override to scroll line nr area together. 18 | void ScrollWindow(int dx, int dy, const wxRect* rect = NULL) override; 19 | 20 | protected: 21 | void OnPaint(wxPaintEvent& evt); 22 | void OnSize(wxSizeEvent& evt); 23 | void OnMouse(wxMouseEvent& evt); 24 | void OnKeyDown(wxKeyEvent& evt); 25 | void OnChar(wxKeyEvent& evt); 26 | void OnMouseCaptureLost(wxMouseCaptureLostEvent& evt); 27 | void OnSetFocus(wxFocusEvent& evt); 28 | void OnKillFocus(wxFocusEvent& evt); 29 | 30 | private: 31 | TextWindow* text_window_; 32 | }; 33 | 34 | } // namespace editor 35 | 36 | #endif // EDITOR_TEXT_AREA_H_ 37 | -------------------------------------------------------------------------------- /src/ui/label.h: -------------------------------------------------------------------------------- 1 | #ifndef UI_LABEL_H_ 2 | #define UI_LABEL_H_ 3 | 4 | // A replacement of wxStaticText. 5 | // The difference is that Label emits wxEVT_BUTTON on click. 6 | // So it can be used as button. 7 | 8 | #include "wx/control.h" 9 | 10 | namespace ui { 11 | 12 | class Label : public wxControl { 13 | DECLARE_EVENT_TABLE() 14 | 15 | public: 16 | Label(wxWindow* parent, wxWindowID id, const wxString& label); 17 | virtual ~Label(); 18 | 19 | bool AcceptsFocus() const override { 20 | return accept_focus_; 21 | } 22 | 23 | void set_accept_focus(bool accept_focus) { 24 | accept_focus_ = accept_focus; 25 | } 26 | 27 | protected: 28 | void InitPadding(); 29 | 30 | wxSize DoGetBestSize() const override; 31 | 32 | void OnPaint(wxPaintEvent& evt); 33 | 34 | void OnLeftDown(wxMouseEvent& evt); 35 | void OnLeftUp(wxMouseEvent& evt); 36 | 37 | private: 38 | bool accept_focus_; 39 | wxSize padding_; 40 | }; 41 | 42 | } // namespace ui 43 | 44 | #endif // UI_LABEL_H_ 45 | -------------------------------------------------------------------------------- /third_party/src/lua/lundump.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lundump.h,v 1.44 2014/06/19 18:27:20 roberto Exp $ 3 | ** load precompiled Lua chunks 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef lundump_h 8 | #define lundump_h 9 | 10 | #include "llimits.h" 11 | #include "lobject.h" 12 | #include "lzio.h" 13 | 14 | 15 | /* data to catch conversion errors */ 16 | #define LUAC_DATA "\x19\x93\r\n\x1a\n" 17 | 18 | #define LUAC_INT 0x5678 19 | #define LUAC_NUM cast_num(370.5) 20 | 21 | #define MYINT(s) (s[0]-'0') 22 | #define LUAC_VERSION (MYINT(LUA_VERSION_MAJOR)*16+MYINT(LUA_VERSION_MINOR)) 23 | #define LUAC_FORMAT 0 /* this is the official format */ 24 | 25 | /* load one chunk; from lundump.c */ 26 | LUAI_FUNC LClosure* luaU_undump (lua_State* L, ZIO* Z, Mbuffer* buff, 27 | const char* name); 28 | 29 | /* dump one chunk; from ldump.c */ 30 | LUAI_FUNC int luaU_dump (lua_State* L, const Proto* f, lua_Writer w, 31 | void* data, int strip); 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /src/jil/pref/editor_comment_page.h: -------------------------------------------------------------------------------- 1 | #ifndef JIL_PREF_EDITOR_COMMENT_PAGE_H_ 2 | #define JIL_PREF_EDITOR_COMMENT_PAGE_H_ 3 | 4 | #include 5 | 6 | #include "wx/panel.h" 7 | 8 | class wxCheckBox; 9 | 10 | namespace editor { 11 | class Options; 12 | } // namespace editor 13 | 14 | namespace jil { 15 | 16 | namespace pref { 17 | 18 | class Editor_CommentPage : public wxPanel { 19 | public: 20 | explicit Editor_CommentPage(editor::Options* options) : options_(options) { 21 | } 22 | 23 | ~Editor_CommentPage() override = default; 24 | 25 | bool Create(wxWindow* parent, wxWindowID id = wxID_ANY); 26 | 27 | bool TransferDataToWindow() override; 28 | bool TransferDataFromWindow() override; 29 | 30 | protected: 31 | void CreateControls(); 32 | 33 | private: 34 | editor::Options* options_; 35 | 36 | wxCheckBox* add_space_check_box_; 37 | wxCheckBox* respect_indent_check_box_; 38 | }; 39 | 40 | } // namespace pref 41 | } // namespace jil 42 | 43 | #endif // JIL_PREF_EDITOR_COMMENT_PAGE_H_ 44 | -------------------------------------------------------------------------------- /src/base/string_util.h: -------------------------------------------------------------------------------- 1 | #ifndef BASE_STRING_UTIL_H_ 2 | #define BASE_STRING_UTIL_H_ 3 | #pragma once 4 | 5 | // char, wchar_t, std::string and std::wstring related utilities. 6 | // Please don't put wxString related utilities here. 7 | 8 | #include "boost/lexical_cast.hpp" 9 | 10 | namespace base { 11 | 12 | // Usage: 13 | // LexicalCast("123", 0); 14 | // LexicalCast(123, ""); 15 | template 16 | To LexicalCast(const From& input, const To& default_output) { 17 | try { 18 | return boost::lexical_cast(input); 19 | } catch (boost::bad_lexical_cast&) { 20 | return default_output; 21 | } 22 | } 23 | 24 | // Usage: 25 | // LexicalCast("123"); 26 | // LexicalCast(123); 27 | template 28 | To LexicalCast(const From& input) { 29 | try { 30 | return boost::lexical_cast(input); 31 | } catch (boost::bad_lexical_cast&) { 32 | return To(); 33 | } 34 | } 35 | 36 | } // namespace base 37 | 38 | #endif // BASE_STRING_UTIL_H_ 39 | -------------------------------------------------------------------------------- /src/ui/bitmap_button.cc: -------------------------------------------------------------------------------- 1 | #include "ui/bitmap_button.h" 2 | 3 | namespace ui { 4 | 5 | IMPLEMENT_CLASS(BitmapButton, BitmapButtonBase); 6 | 7 | BitmapButton::BitmapButton(SharedButtonStyle style) 8 | : BitmapButtonBase(style) { 9 | } 10 | 11 | BitmapButton::~BitmapButton() { 12 | } 13 | 14 | bool BitmapButton::Create(wxWindow* parent, wxWindowID id) { 15 | if (!BitmapButtonBase::Create(parent, id)) { 16 | return false; 17 | } 18 | 19 | return true; 20 | } 21 | 22 | ButtonStyle::State BitmapButton::GetState() const { 23 | if (!IsThisEnabled()) { // NOTE: Don't use IsEnabled()! 24 | return ButtonStyle::DISABLED; 25 | } 26 | 27 | if (pressed_) { 28 | return ButtonStyle::PRESSED; 29 | } else if (hover_) { 30 | return ButtonStyle::HOVER; 31 | } else { 32 | return ButtonStyle::NORMAL; 33 | } 34 | } 35 | 36 | void BitmapButton::PostEvent() { 37 | wxCommandEvent evt(wxEVT_BUTTON, GetId()); 38 | evt.SetEventObject(this); 39 | GetParent()->GetEventHandler()->AddPendingEvent(evt); 40 | } 41 | 42 | } // namespace ui 43 | -------------------------------------------------------------------------------- /src/editor/compile_config.h: -------------------------------------------------------------------------------- 1 | #ifndef EDITOR_COMPILE_CONFIG_H_ 2 | #define EDITOR_COMPILE_CONFIG_H_ 3 | 4 | #include "wx/defs.h" 5 | 6 | // Use relite::Regex instead of C++11 regex to scan lex for performance. 7 | // Scan a 2500 lines C++ source file with Release build, 8 | // - C++/Boost regex: 175ms 9 | // - relite::Regex: 16ms 10 | #define JIL_LEX_USE_RELITE 1 11 | 12 | // Rectangle selection. Not fully implemented. 13 | #define JIL_ENABLE_RECT_SELECT 0 14 | 15 | // Use wxCaret or not for TextWindow. 16 | // wxCaret has no native implementation on Mac or GTK, and it's buggy. 17 | // Alternatively, we implement a caret by ourselves. 18 | #define JIL_USE_WX_CARET 0 19 | 20 | // Compound key shortcut (e.g., Ctrl+K,Ctrl+O) support (Windows only). 21 | // Need to disable accelerator (set wxUSE_ACCEL to 0). 22 | #define JIL_ENABLE_LEADER_KEY 0 23 | 24 | #if JIL_ENABLE_LEADER_KEY 25 | 26 | #if wxUSE_ACCEL 27 | #error "ACCEL should be disabled!" 28 | #endif // wxUSE_ACCEL 29 | 30 | #endif // JIL_ENABLE_LEADER_KEY 31 | 32 | #endif // EDITOR_COMPILE_CONFIG_H_ 33 | -------------------------------------------------------------------------------- /third_party/src/lua/lprefix.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lprefix.h,v 1.2 2014/12/29 16:54:13 roberto Exp $ 3 | ** Definitions for Lua code that must come before any other header file 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef lprefix_h 8 | #define lprefix_h 9 | 10 | 11 | /* 12 | ** Allows POSIX/XSI stuff 13 | */ 14 | #if !defined(LUA_USE_C89) /* { */ 15 | 16 | #if !defined(_XOPEN_SOURCE) 17 | #define _XOPEN_SOURCE 600 18 | #elif _XOPEN_SOURCE == 0 19 | #undef _XOPEN_SOURCE /* use -D_XOPEN_SOURCE=0 to undefine it */ 20 | #endif 21 | 22 | /* 23 | ** Allows manipulation of large files in gcc and some other compilers 24 | */ 25 | #if !defined(LUA_32BITS) && !defined(_FILE_OFFSET_BITS) 26 | #define _LARGEFILE_SOURCE 1 27 | #define _FILE_OFFSET_BITS 64 28 | #endif 29 | 30 | #endif /* } */ 31 | 32 | 33 | /* 34 | ** Windows stuff 35 | */ 36 | #if defined(_WIN32) /* { */ 37 | 38 | #if !defined(_CRT_SECURE_NO_WARNINGS) 39 | #define _CRT_SECURE_NO_WARNINGS /* avoid warnings about ISO C functions */ 40 | #endif 41 | 42 | #endif /* } */ 43 | 44 | #endif 45 | 46 | -------------------------------------------------------------------------------- /src/ui/button_style.h: -------------------------------------------------------------------------------- 1 | #ifndef UI_BUTTON_STYLE_H_ 2 | #define UI_BUTTON_STYLE_H_ 3 | 4 | #include 5 | 6 | #include "wx/colour.h" 7 | 8 | namespace ui { 9 | 10 | class ButtonStyle { 11 | public: 12 | enum Part { 13 | FG = 0, 14 | BG, 15 | BORDER, 16 | PARTS, 17 | }; 18 | 19 | enum State { 20 | NORMAL = 0, 21 | HOVER, 22 | PRESSED, 23 | DISABLED, 24 | STATES, 25 | }; 26 | 27 | public: 28 | const wxColour& GetColor(int part, int state) const { 29 | assert(part >= 0 && part < PARTS); 30 | assert(state >= 0 && state < STATES); 31 | return colors_[part][state]; 32 | } 33 | 34 | void SetColor(int part, int state, const wxColour& color) { 35 | assert(part >= 0 && part < PARTS); 36 | assert(state >= 0 && state < STATES); 37 | colors_[part][state] = color; 38 | } 39 | 40 | // Fix missing colors. 41 | void Fix(); 42 | 43 | private: 44 | wxColor colors_[PARTS][STATES]; 45 | }; 46 | 47 | typedef std::shared_ptr SharedButtonStyle; 48 | 49 | } // namespace ui 50 | 51 | #endif // UI_BUTTON_STYLE_H_ 52 | -------------------------------------------------------------------------------- /src/jil/pref/global_theme_page.h: -------------------------------------------------------------------------------- 1 | #ifndef JIL_PREF_GLOBAL_THEME_PAGE_H_ 2 | #define JIL_PREF_GLOBAL_THEME_PAGE_H_ 3 | 4 | #include 5 | 6 | #include "wx/panel.h" 7 | 8 | #include "editor/defs.h" 9 | 10 | class wxCheckBox; 11 | class wxComboBox; 12 | class wxStaticText; 13 | 14 | namespace jil { 15 | 16 | class Options; 17 | 18 | namespace pref { 19 | 20 | class Global_ThemePage : public wxPanel { 21 | public: 22 | explicit Global_ThemePage(Options* options) : options_(options) { 23 | } 24 | 25 | ~Global_ThemePage() override = default; 26 | 27 | bool Create(wxWindow* parent, wxWindowID id = wxID_ANY); 28 | 29 | bool TransferDataToWindow() override; 30 | bool TransferDataFromWindow() override; 31 | 32 | private: 33 | void CreateControls(); 34 | 35 | void LayoutField(wxSizer* top_vsizer, wxStaticText* label, 36 | wxComboBox* combo_box); 37 | 38 | private: 39 | Options* options_; 40 | 41 | wxComboBox* theme_combo_box_; 42 | wxCheckBox* enlarge_icons_check_box_; 43 | }; 44 | 45 | } // namespace pref 46 | } // namespace jil 47 | 48 | #endif // JIL_PREF_GLOBAL_THEME_PAGE_H_ 49 | -------------------------------------------------------------------------------- /data/jilfiles/ftplugin/python/lex.cfg: -------------------------------------------------------------------------------- 1 | // Lex for Python 2 | // Last update: 2015-10-26 3 | 4 | lex = ( 5 | { id = "comment"; quote = [ "#" ]; }, 6 | 7 | // Note: Put """ before " 8 | { id = "constant.string"; quote = [ "\"\"\"", "\"\"\"" ]; multi_line = true; }, 9 | { id = "constant.string"; quote = [ "\"", "\"" ]; }, 10 | { id = "constant.string"; quote = [ "'", "'" ]; }, 11 | 12 | { id = "constant.bool"; anyof = "True False"; }, 13 | { id = "constant.null"; anyof = "None"; }, 14 | { id = "statement"; anyof = "def assert break continue del exec global lambda nonlocal pass return with yield"; }, 15 | { id = "statement.conditional"; anyof = "if else elif and or is not in"; }, 16 | { id = "statement.repeat"; anyof = "for while"; }, 17 | { id = "statement.package"; anyof = "import from as"; }, 18 | { id = "statement.exception"; anyof = "except finally raise try"; }, 19 | { id = "type.struct"; anyof = "class"; }, 20 | // print is a function from Python 3. 21 | { id = "identifier.function"; anyof = "range len print"; }, 22 | 23 | { id = "constant.number"; prefix = "\d"; use_regex = true; } 24 | ); 25 | -------------------------------------------------------------------------------- /src/jil/page_window.h: -------------------------------------------------------------------------------- 1 | #ifndef JIL_PAGE_WINDOW_H_ 2 | #define JIL_PAGE_WINDOW_H_ 3 | 4 | #include "editor/text_window.h" 5 | 6 | namespace jil { 7 | 8 | class PageState; 9 | class TextPage; 10 | 11 | class PageWindow : public editor::TextWindow { 12 | DECLARE_CLASS(PageWindow) 13 | 14 | friend class TextPage; 15 | 16 | public: 17 | explicit PageWindow(TextPage* page); 18 | virtual ~PageWindow(); 19 | 20 | TextPage* page() const { 21 | return page_; 22 | } 23 | 24 | // Switch to the given text page. 25 | void SetPage(TextPage* page); 26 | 27 | bool IsPagePlaceholder() const; 28 | 29 | void GetEditMenu(wxMenu* menu); 30 | bool GetEditMenuState(int menu_id); 31 | bool GetFileMenuState(int menu_id); 32 | bool HandleMenu(int menu_id); 33 | 34 | protected: 35 | virtual void HandleTextRightUp(wxMouseEvent& evt) override; 36 | 37 | void GetState(PageState* state) const; 38 | void SetState(PageState* state); 39 | 40 | private: 41 | void OnPageModifiedStateChange(TextPage* page); 42 | 43 | private: 44 | TextPage* page_; // Always != NULL. 45 | }; 46 | 47 | } // namespace jil 48 | 49 | #endif // JIL_PAGE_WINDOW_H_ 50 | -------------------------------------------------------------------------------- /src/ui/separator.h: -------------------------------------------------------------------------------- 1 | #ifndef UI_SEPARATOR_H_ 2 | #define UI_SEPARATOR_H_ 3 | 4 | // Separator line. 5 | // A replacement of wxStaticLine. 6 | // Usage: 7 | // wxSizer* vsizer = new wxBoxSizer(wxVERTICAL); 8 | // vsizer->Add(new Separator(this, 1), 0, wxEXPAND); 9 | 10 | #include "wx/panel.h" 11 | 12 | namespace ui { 13 | 14 | class Separator: public wxPanel { 15 | public: 16 | explicit Separator(wxWindow* parent, int size = 1, bool horizontal = true) 17 | : wxPanel(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxNO_BORDER) 18 | , size_(size) 19 | , horizontal_(horizontal) { 20 | } 21 | 22 | virtual ~Separator() { 23 | } 24 | 25 | void SetColor(const wxColour& color) { 26 | SetBackgroundColour(color); 27 | } 28 | 29 | // Don't accept focus. 30 | bool AcceptsFocus() const override { 31 | return false; 32 | } 33 | 34 | protected: 35 | wxSize DoGetBestSize() const override { 36 | if (horizontal_) { 37 | return wxSize(-1, size_); 38 | } else { 39 | return wxSize(size_, -1); 40 | } 41 | } 42 | 43 | private: 44 | int size_; 45 | bool horizontal_; 46 | }; 47 | 48 | } // namespace ui 49 | 50 | #endif // UI_SEPARATOR_H_ 51 | -------------------------------------------------------------------------------- /src/editor/tab.cc: -------------------------------------------------------------------------------- 1 | #include "editor/tab.h" 2 | #include "editor/defs.h" 3 | 4 | namespace editor { 5 | 6 | void TabbedLineFast(int tab_stop, std::wstring* line) { 7 | std::size_t tabbed_length = 0; 8 | for (std::size_t x = 0; x < line->size(); ++x) { 9 | if ((*line)[x] == kTabChar) { 10 | tabbed_length += tab_stop - (tabbed_length % tab_stop); 11 | (*line)[x] = kSpaceChar; 12 | } else { 13 | ++tabbed_length; 14 | } 15 | } 16 | 17 | // Append the extra expanded tab spaces at the end of the line. 18 | // This is more efficient. 19 | std::size_t extra_size = tabbed_length - line->size(); 20 | if (extra_size > 0) { 21 | *line += std::wstring(extra_size, kSpaceChar); 22 | } 23 | } 24 | 25 | Coord TabbedLineLength(int tab_stop, const std::wstring& line, Coord count) { 26 | if (count == kInvCoord) { 27 | count = CoordCast(line.length()); 28 | } 29 | 30 | Coord tabbed_length = 0; 31 | 32 | for (Coord x = 0; x < count; ++x) { 33 | if (line[x] == kTabChar) { 34 | tabbed_length += tab_stop - (tabbed_length % tab_stop); 35 | } else { 36 | ++tabbed_length; 37 | } 38 | } 39 | 40 | return tabbed_length; 41 | } 42 | 43 | } // namespace editor 44 | -------------------------------------------------------------------------------- /src/jil/pref/editor_dialog.cc: -------------------------------------------------------------------------------- 1 | #include "jil/pref/editor_dialog.h" 2 | 3 | #include "wx/notebook.h" 4 | 5 | #include "jil/pref/editor_general_page.h" 6 | #include "jil/pref/editor_indent_page.h" 7 | #include "jil/pref/editor_comment_page.h" 8 | 9 | namespace jil { 10 | namespace pref { 11 | 12 | void EditorDialog::AddPages() { 13 | Editor_GeneralPage* general_page = new Editor_GeneralPage(options_); 14 | Editor_IndentPage* indent_page = new Editor_IndentPage(options_); 15 | Editor_CommentPage* comment_page = new Editor_CommentPage(options_); 16 | 17 | wxColour theme_bg_colour = notebook_->GetThemeBackgroundColour(); 18 | if (theme_bg_colour.IsOk()) { 19 | general_page->SetBackgroundColour(theme_bg_colour); 20 | indent_page->SetBackgroundColour(theme_bg_colour); 21 | comment_page->SetBackgroundColour(theme_bg_colour); 22 | } 23 | 24 | general_page->Create(notebook_); 25 | indent_page->Create(notebook_); 26 | comment_page->Create(notebook_); 27 | 28 | notebook_->AddPage(general_page, _("General"), true); 29 | notebook_->AddPage(indent_page, _("Indent"), false); 30 | notebook_->AddPage(comment_page, _("Comment"), false); 31 | } 32 | 33 | } // namespace pref 34 | } // namespace jil 35 | -------------------------------------------------------------------------------- /doc/design/TextBuffer.md: -------------------------------------------------------------------------------- 1 | # Text Buffer 2 | 3 | Text Buffer 对应于 MVC(Model-View-Controller)里的 M。它是文本在内存中的表示。 4 | 你也可以称其为 Text Document,Text Model。因为 Vim 里叫 Buffer,我就沿用了这个名字。 5 | 6 | ## 字符的表示 7 | 8 | `wxString` 是 wxWidgets 提供的字符串类,类似于 MFC 的 `CString`,或 Qt 的 `QString`。 9 | 如果定义了宏 `wxUSE_UNICODE`,`wxString` 内部便以 Unicode 表示,但是有两种: 10 | - `wchar_t*`,由宏 `wxUSE_UNICODE_WCHAR` 控制, 此为缺省行为; 11 | - UTF-8 编码的 `char*`,由宏 `wxUSE_UNICODE_UTF8` 控制。 12 | 13 | 使用 UTF-8,索引相当困难,为了提高性能,可能需要 cache(由宏 `wxUSE_STRING_POS_CACHE` 控制)。 14 | 简单来说,UTF-8 版的 `wxString` 目前还处于不可用状态,随意浏览它的代码,会看到注释里有很多 `FIXME`。 15 | 16 | 就 Text Buffer 来说,用 `wchar_t*` 要比 UTF-8 编码的 `char*` 简单得多,缺点是内存多占了些:VC 一个字符两个字节,GCC 和 Clang 一个字符 4 个字节。 17 | 18 | 虽然 `wxString` 支持 `wchar_t*` 的实现,Text Buffer 却不必使用 `wxString`。考虑到在 Linux 或 MAC 平台,`wxString` 可能(缺省)会以 UTF-8 实现(也许为了与系统 API 更好的结合),Text Buffer 不应该受到这种平台差异的影响,就目前的设计来说,它应该一直都以 `wchar_t*` 实现。 19 | 20 | 所以,Text Buffer 最终采用了 `std::wstring`。 21 | 22 | 并且,后来我意识到,`wxString` 其实只该用来处理界面上的文字,文件路径,等。 23 | 24 | ## 按行管理 25 | 26 | 文本始终按行来管理。 27 | 一个 Text Buffer,包含多行文本。 28 | 29 | ```cpp 30 | class TextBuffer { 31 | 32 | private: 33 | std::deque lines_; 34 | }; 35 | ``` 36 | 37 | 这里没有用 `vector` 或 `list`,而是用 `deque`,是为了兼顾随机访问和插入删除的效率。 38 | -------------------------------------------------------------------------------- /src/editor_unittest/indent_test_base.h: -------------------------------------------------------------------------------- 1 | #ifndef INDENT_TEST_BASE_H_ 2 | #define INDENT_TEST_BASE_H_ 3 | 4 | #include "gtest/gtest.h" 5 | 6 | #include "wx/string.h" 7 | 8 | // Include here for convenience. 9 | 10 | extern "C" { 11 | #include "lualib.h" 12 | } 13 | #include "editor/lua_proxy.h" 14 | 15 | #include "editor/ft_plugin.h" 16 | #include "editor/text_buffer.h" 17 | #include "editor/text_line.h" 18 | #include "editor/util.h" 19 | 20 | class IndentTestBase : public testing::Test { 21 | protected: 22 | static void LoadLua(); 23 | static void SetTextOptions(bool expand_tab, int tab_stop); 24 | static void LoadIndentFunc(const wxString& ft_id); 25 | 26 | // Call this in SetUpTestCase() of sub-class. 27 | static void StaticSetUp(const editor::FileType& ft); 28 | 29 | // Call this in TearDownTestCase() of sub-class. 30 | static void StaticTearDown(); 31 | 32 | virtual void SetUp(); 33 | virtual void TearDown(); 34 | 35 | int GetExpectedIndent(int ln); 36 | 37 | static lua_State* lua_state; 38 | static editor::FtPlugin* ft_plugin; 39 | 40 | editor::TextBuffer* buffer_; 41 | }; 42 | 43 | #define ASSERT_LINE(ln)\ 44 | EXPECT_EQ(buffer_->GetIndent(ln), GetExpectedIndent(ln)); 45 | 46 | #endif // INDENT_TEST_BASE_H_ 47 | -------------------------------------------------------------------------------- /src/ui/bitmap_button_base.h: -------------------------------------------------------------------------------- 1 | #ifndef UI_BITMAP_BUTTON_BASE_H_ 2 | #define UI_BITMAP_BUTTON_BASE_H_ 3 | 4 | #include "wx/bitmap.h" 5 | #include "wx/control.h" 6 | 7 | #include "ui/button_base.h" 8 | 9 | namespace ui { 10 | 11 | class BitmapButtonBase : public ButtonBase { 12 | DECLARE_CLASS(BitmapButtonBase) 13 | DECLARE_NO_COPY_CLASS(BitmapButtonBase) 14 | 15 | public: 16 | explicit BitmapButtonBase(SharedButtonStyle style); 17 | virtual ~BitmapButtonBase(); 18 | 19 | bool Create(wxWindow* parent, wxWindowID id); 20 | 21 | void SetBitmap(ButtonStyle::State state, const wxBitmap& bitmap) { 22 | bitmaps_[state] = bitmap; 23 | } 24 | 25 | void SetBitmaps(const wxBitmap& normal, 26 | const wxBitmap& hover, 27 | const wxBitmap& pressed, 28 | const wxBitmap& disabled); 29 | 30 | void SetBitmaps(const wxBitmap& bitmap); 31 | 32 | void SetBitmapsND(const wxBitmap& normal, const wxBitmap& disabled); 33 | 34 | protected: 35 | wxSize DoGetBestSize() const override; 36 | 37 | void DrawFg(wxDC& dc, ButtonStyle::State state) override; 38 | 39 | protected: 40 | wxBitmap bitmaps_[ButtonStyle::STATES]; 41 | }; 42 | 43 | } // namespace ui 44 | 45 | #endif // UI_BITMAP_BUTTON_BASE_H_ 46 | -------------------------------------------------------------------------------- /src/jil/Info.plist.in: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NSPrincipalClass 6 | wxNSApplication 7 | CFBundleDevelopmentRegion 8 | en 9 | CFBundleExecutable 10 | ${MACOSX_BUNDLE_EXECUTABLE_NAME} 11 | CFBundleIconFile 12 | ${MACOSX_BUNDLE_ICON_FILE} 13 | CFBundleIdentifier 14 | com.github.sprinfall.jil 15 | CFBundleInfoDictionaryVersion 16 | 6.0 17 | CFBundleName 18 | ${MACOSX_BUNDLE_BUNDLE_NAME} 19 | CFBundlePackageType 20 | APPL 21 | CFBundleShortVersionString 22 | ${MACOSX_BUNDLE_SHORT_VERSION_STRING} 23 | CFBundleVersion 24 | ${MACOSX_BUNDLE_BUNDLE_VERSION} 25 | LSMinimumSystemVersion 26 | 10.7 27 | NSHumanReadableCopyright 28 | Copyright © 2017 Chunting Gu. All rights reserved. 29 | CSResourcesFileMapped 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /src/jil/pref/editor_indent_page.h: -------------------------------------------------------------------------------- 1 | #ifndef JIL_PREF_EDITOR_INDENT_PAGE_H_ 2 | #define JIL_PREF_EDITOR_INDENT_PAGE_H_ 3 | 4 | #include 5 | 6 | #include "wx/panel.h" 7 | 8 | class wxCheckBox; 9 | class wxTextCtrl; 10 | 11 | namespace editor { 12 | class Options; 13 | } // namespace editor 14 | 15 | namespace jil { 16 | 17 | namespace pref { 18 | 19 | class OptionListCtrl; 20 | 21 | class Editor_IndentPage : public wxPanel { 22 | public: 23 | explicit Editor_IndentPage(editor::Options* options) : options_(options) { 24 | } 25 | 26 | ~Editor_IndentPage() override = default; 27 | 28 | bool Create(wxWindow* parent, wxWindowID id = wxID_ANY); 29 | 30 | bool TransferDataToWindow() override; 31 | bool TransferDataFromWindow() override; 32 | 33 | protected: 34 | void CreateControls(); 35 | 36 | void CreateTabsSection(wxSizer* top_vsizer); 37 | 38 | void CreateDynamicSection(wxSizer* top_vsizer); 39 | 40 | private: 41 | editor::Options* options_; 42 | 43 | wxTextCtrl* tab_stop_text_ctrl_; 44 | wxCheckBox* expand_tab_check_box_; 45 | wxCheckBox* guess_check_box_; 46 | wxTextCtrl* indent_keys_text_ctrl_; 47 | 48 | OptionListCtrl* option_list_ctrl_; 49 | }; 50 | 51 | } // namespace pref 52 | } // namespace jil 53 | 54 | #endif // JIL_PREF_EDITOR_INDENT_PAGE_H_ 55 | -------------------------------------------------------------------------------- /src/ui/util.cc: -------------------------------------------------------------------------------- 1 | #include "ui/util.h" 2 | 3 | #include "wx/dc.h" 4 | 5 | namespace ui { 6 | 7 | const wxString kEllipsis = wxT("..."); 8 | 9 | std::size_t TailorLabel(const wxDC& dc, const wxString& label, int max_width) { 10 | if (label.IsEmpty()) { 11 | return 0; 12 | } 13 | 14 | int w = 0; 15 | std::size_t i = label.size() - 1; 16 | for (; i > 0; --i) { 17 | dc.GetTextExtent(label.Mid(0, i), &w, NULL); 18 | if (w <= max_width) { 19 | break; 20 | } 21 | } 22 | 23 | return i; 24 | } 25 | 26 | void DrawTextInRect(wxDC& dc, const wxString& text, const wxRect& rect) { 27 | if (text.size() <= 3) { 28 | dc.DrawText(text, rect.x, rect.y); 29 | return; 30 | } 31 | 32 | int w = 0; 33 | dc.GetTextExtent(text, &w, NULL); 34 | if (w <= rect.width) { 35 | dc.DrawText(text, rect.x, rect.y); 36 | return; 37 | } 38 | 39 | int ellipsis_w = 0; 40 | dc.GetTextExtent(kEllipsis, &ellipsis_w, NULL); 41 | 42 | std::size_t i = TailorLabel(dc, text, rect.width - ellipsis_w); 43 | dc.DrawText(text.Mid(0, i) + kEllipsis, rect.x, rect.y); 44 | } 45 | 46 | wxSize GetBitmapSize(const wxBitmap& bitmap) { 47 | if (!bitmap.IsOk()) { 48 | return wxDefaultSize; 49 | } 50 | return wxSize(bitmap.GetWidth(), bitmap.GetHeight()); 51 | } 52 | 53 | } // namespace ui 54 | -------------------------------------------------------------------------------- /src/jil/save.h: -------------------------------------------------------------------------------- 1 | #ifndef JIL_SAVE_H_ 2 | #define JIL_SAVE_H_ 3 | 4 | #include 5 | 6 | class wxWindow; 7 | 8 | namespace editor { 9 | class TextBuffer; 10 | } // namespace editor 11 | 12 | namespace jil { 13 | 14 | class TextPage; 15 | 16 | bool SaveBuffer(editor::TextBuffer* buffer, wxWindow* parent); 17 | bool SaveBufferAs(editor::TextBuffer* buffer, wxWindow* parent); 18 | 19 | // Confirm to save the modified text page. 20 | // Return wxYES, wxNO or wxCANCEL. 21 | int ConfirmSave(TextPage* text_page); 22 | 23 | // Save the modified text pages with confirm message. 24 | // Return false if the save is canceled or failed. 25 | bool SaveModifiedWithConfirm(wxWindow* parent, 26 | const std::vector& text_pages); 27 | 28 | // Save the new created text pages with confirm message. 29 | // Return false if the save is canceled or failed. 30 | bool SaveNewCreatedWithConfirm(wxWindow* parent, 31 | const std::vector& text_pages); 32 | 33 | // Save the given buffer to file. 34 | // If the buffer is new created or read-only, it will be saved as another file. 35 | // Return false on error or canceled (canceled in Save As dialog). 36 | bool Save(editor::TextBuffer* buffer, wxWindow* parent); 37 | 38 | } // namespace jil 39 | 40 | #endif // JIL_SAVE_H_ 41 | -------------------------------------------------------------------------------- /src/ui/bitmap_toggle_button.cc: -------------------------------------------------------------------------------- 1 | #include "ui/bitmap_toggle_button.h" 2 | 3 | namespace ui { 4 | 5 | IMPLEMENT_CLASS(BitmapToggleButton, BitmapButtonBase); 6 | 7 | BitmapToggleButton::BitmapToggleButton(SharedButtonStyle style) 8 | : BitmapButtonBase(style), toggle_(false), auto_switch_(true) { 9 | } 10 | 11 | BitmapToggleButton::~BitmapToggleButton() { 12 | } 13 | 14 | bool BitmapToggleButton::Create(wxWindow* parent, wxWindowID id) { 15 | if (!BitmapButtonBase::Create(parent, id)) { 16 | return false; 17 | } 18 | 19 | return true; 20 | } 21 | 22 | ButtonStyle::State BitmapToggleButton::GetState() const { 23 | if (!IsThisEnabled()) { // NOTE: Don't use IsEnabled()! 24 | return ButtonStyle::DISABLED; 25 | } 26 | 27 | if (toggle_ || pressed_) { 28 | return ButtonStyle::PRESSED; 29 | } else if (hover_) { 30 | return ButtonStyle::HOVER; 31 | } else { 32 | return ButtonStyle::NORMAL; 33 | } 34 | } 35 | 36 | void BitmapToggleButton::PostEvent() { 37 | if (auto_switch_) { 38 | toggle_ = !toggle_; 39 | } 40 | 41 | wxCommandEvent toggle_evt(wxEVT_TOGGLEBUTTON, GetId()); 42 | toggle_evt.SetEventObject(this); 43 | toggle_evt.SetInt(toggle_ ? 1 : 0); // Note: SetInt() affects IsChecked(). 44 | GetParent()->GetEventHandler()->AddPendingEvent(toggle_evt); 45 | } 46 | 47 | } // namespace ui 48 | -------------------------------------------------------------------------------- /third_party/src/uchardet/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(SRCS 2 | CharDistribution.cpp 3 | CharDistribution.h 4 | CMakeLists.txt 5 | JpCntx.cpp 6 | JpCntx.h 7 | LangBulgarianModel.cpp 8 | LangCyrillicModel.cpp 9 | LangGreekModel.cpp 10 | LangHebrewModel.cpp 11 | LangHungarianModel.cpp 12 | LangThaiModel.cpp 13 | Makefile.in 14 | nsBig5Prober.cpp 15 | nsBig5Prober.h 16 | nsCharSetProber.cpp 17 | nsCharSetProber.h 18 | nsCodingStateMachine.h 19 | nsEscCharsetProber.cpp 20 | nsEscCharsetProber.h 21 | nsEscSM.cpp 22 | nsEUCJPProber.cpp 23 | nsEUCJPProber.h 24 | nsEUCKRProber.cpp 25 | nsEUCKRProber.h 26 | nsEUCTWProber.cpp 27 | nsEUCTWProber.h 28 | nsGB2312Prober.cpp 29 | nsGB2312Prober.h 30 | nsHebrewProber.cpp 31 | nsHebrewProber.h 32 | nsLatin1Prober.cpp 33 | nsLatin1Prober.h 34 | nsMBCSGroupProber.cpp 35 | nsMBCSGroupProber.h 36 | nsMBCSSM.cpp 37 | nsPkgInt.h 38 | nsSBCharSetProber.cpp 39 | nsSBCharSetProber.h 40 | nsSBCSGroupProber.cpp 41 | nsSBCSGroupProber.h 42 | nsSJISProber.cpp 43 | nsSJISProber.h 44 | nsUniversalDetector.cpp 45 | nsUniversalDetector.h 46 | nsUTF8Prober.cpp 47 | nsUTF8Prober.h 48 | ) 49 | 50 | #add_definitions() 51 | 52 | add_library(uchardet ${SRCS}) 53 | 54 | #install(TARGETS uchardet DESTINATION .) 55 | -------------------------------------------------------------------------------- /data/jilfiles/ftplugin/__default/options.cfg: -------------------------------------------------------------------------------- 1 | // Editor options. 2 | 3 | //-------------------------------------------------------------------------- 4 | // Text options 5 | 6 | // The number of spaces a tab occupies. 7 | tab_stop = 4; 8 | 9 | // Expand tab with spaces. 10 | expand_tab = false; 11 | 12 | // Guess tab options from existing lines. 13 | guess_tab = true; 14 | 15 | // Word delimiters (exluding ' ' and '\t'). 16 | delimiters = "!@#%^$&*()+-=\\|/?[]{}<>,.;:'\"`~"; 17 | 18 | // A list of keys that, when typed, cause reindenting of the current line. 19 | // Indent keys normally appear at the beginning of a line. 20 | // Similar to Vim option "indentkeys". 21 | // E.g., '}' for C/C++, "endif" for Vim Script, etc. 22 | indent_keys = []; 23 | 24 | // Extra indent options. 25 | // E.g., indent_namespace, indent_case for C++. 26 | indent = { 27 | }; 28 | 29 | // Comment options. 30 | comment = { 31 | add_space = false; 32 | respect_indent = true; 33 | }; 34 | 35 | //-------------------------------------------------------------------------- 36 | // View options 37 | 38 | // Wrap line. 39 | wrap = false; 40 | 41 | // Show line number area. 42 | show_number = true; 43 | 44 | // Show spaces and tabs. 45 | show_space = false; 46 | 47 | // Always show horizontal scroll bar. 48 | show_hscrollbar = false; 49 | 50 | // Display vertical lines at the given columns. 51 | // E.g., rulers = [ 80, 100 ] 52 | rulers = []; 53 | 54 | -------------------------------------------------------------------------------- /third_party/src/lua/lualib.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lualib.h,v 1.44 2014/02/06 17:32:33 roberto Exp $ 3 | ** Lua standard libraries 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | 8 | #ifndef lualib_h 9 | #define lualib_h 10 | 11 | #include "lua.h" 12 | 13 | 14 | 15 | LUAMOD_API int (luaopen_base) (lua_State *L); 16 | 17 | #define LUA_COLIBNAME "coroutine" 18 | LUAMOD_API int (luaopen_coroutine) (lua_State *L); 19 | 20 | #define LUA_TABLIBNAME "table" 21 | LUAMOD_API int (luaopen_table) (lua_State *L); 22 | 23 | #define LUA_IOLIBNAME "io" 24 | LUAMOD_API int (luaopen_io) (lua_State *L); 25 | 26 | #define LUA_OSLIBNAME "os" 27 | LUAMOD_API int (luaopen_os) (lua_State *L); 28 | 29 | #define LUA_STRLIBNAME "string" 30 | LUAMOD_API int (luaopen_string) (lua_State *L); 31 | 32 | #define LUA_UTF8LIBNAME "utf8" 33 | LUAMOD_API int (luaopen_utf8) (lua_State *L); 34 | 35 | #define LUA_BITLIBNAME "bit32" 36 | LUAMOD_API int (luaopen_bit32) (lua_State *L); 37 | 38 | #define LUA_MATHLIBNAME "math" 39 | LUAMOD_API int (luaopen_math) (lua_State *L); 40 | 41 | #define LUA_DBLIBNAME "debug" 42 | LUAMOD_API int (luaopen_debug) (lua_State *L); 43 | 44 | #define LUA_LOADLIBNAME "package" 45 | LUAMOD_API int (luaopen_package) (lua_State *L); 46 | 47 | 48 | /* open all previous libraries */ 49 | LUALIB_API void (luaL_openlibs) (lua_State *L); 50 | 51 | 52 | 53 | #if !defined(lua_assert) 54 | #define lua_assert(x) ((void)0) 55 | #endif 56 | 57 | 58 | #endif 59 | -------------------------------------------------------------------------------- /src/jil/pref/editor_general_page.h: -------------------------------------------------------------------------------- 1 | #ifndef JIL_PREF_EDITOR_GENERAL_PAGE_H_ 2 | #define JIL_PREF_EDITOR_GENERAL_PAGE_H_ 3 | 4 | #include 5 | 6 | #include "wx/panel.h" 7 | 8 | class wxCheckBox; 9 | class wxTextCtrl; 10 | 11 | namespace editor { 12 | class Options; 13 | } // namespace editor 14 | 15 | namespace jil { 16 | namespace pref { 17 | 18 | class Editor_GeneralPage : public wxPanel { 19 | public: 20 | explicit Editor_GeneralPage(editor::Options* options); 21 | virtual ~Editor_GeneralPage(); 22 | 23 | bool Create(wxWindow* parent, wxWindowID id = wxID_ANY); 24 | 25 | wxString JoinRulers(const std::vector& rulers); 26 | 27 | void SplitRulers(const wxString& rulers_str, std::vector& rulers); 28 | 29 | bool TransferDataToWindow() override; 30 | bool TransferDataFromWindow() override; 31 | 32 | protected: 33 | void CreateControls(); 34 | 35 | void CreateDisplaySection(wxSizer* top_vsizer); 36 | 37 | void CreateRulersSection(wxSizer* top_vsizer); 38 | 39 | void CreateDelimitersSection(wxSizer* top_vsizer); 40 | 41 | private: 42 | editor::Options* options_; 43 | 44 | wxCheckBox* show_hscrollbar_check_box_; 45 | wxCheckBox* show_number_check_box_; 46 | wxCheckBox* show_space_check_box_; 47 | wxCheckBox* wrap_check_box_; 48 | wxTextCtrl* rulers_text_ctrl_; 49 | wxTextCtrl* delimiters_text_ctrl_; 50 | }; 51 | 52 | } // namespace pref 53 | } // namespace jil 54 | 55 | #endif // JIL_PREF_EDITOR_GENERAL_PAGE_H_ 56 | -------------------------------------------------------------------------------- /src/editor/text_listener.h: -------------------------------------------------------------------------------- 1 | #ifndef EDITOR_TEXT_LISTENER_H_ 2 | #define EDITOR_TEXT_LISTENER_H_ 3 | 4 | #include "editor/text_range.h" 5 | 6 | namespace editor { 7 | 8 | enum LineChangeType { 9 | kLineUpdated = 1, 10 | kLineAdded = 2, 11 | 12 | // NOTE: The line number in the change data will be invalid. 13 | kLineDeleted = 4, 14 | 15 | kLineRefresh = 8, 16 | }; 17 | 18 | enum ChangeType { 19 | kEncodingChange = 1, 20 | kFileNameChange = 1 << 1, 21 | kModifiedStateChange = 1 << 2, 22 | kFileFormatChange = 1 << 3, 23 | kFileTypeChange = 1 << 4, 24 | kTabOptionsChange = 1 << 5, 25 | kViewOptionsChange = 1 << 6, 26 | }; 27 | 28 | class LineChangeData : public LineRange { 29 | public: 30 | // Single line. 31 | explicit LineChangeData(Coord first_line = 0, Coord last_line = 0) 32 | : LineRange(first_line, last_line) { 33 | } 34 | 35 | explicit LineChangeData(const LineRange& line_range) 36 | : LineRange(line_range) { 37 | } 38 | }; 39 | 40 | // Implement this interface and attach to a text buffer to listen to 41 | // the changes of it. 42 | class TextListener { 43 | public: 44 | virtual ~TextListener() { 45 | } 46 | 47 | virtual void OnBufferLineChange(LineChangeType type, 48 | const LineChangeData& data) = 0; 49 | 50 | virtual void OnBufferChange(ChangeType type) = 0; 51 | }; 52 | 53 | } // namespace editor 54 | 55 | #endif // EDITOR_TEXT_LISTENER_H_ 56 | -------------------------------------------------------------------------------- /third_party/src/libconfig/strbuf.h: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------------- 2 | libconfig - A library for processing structured configuration files 3 | Copyright (C) 2005-2010 Mark A Lindner 4 | 5 | This file is part of libconfig. 6 | 7 | This library is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU Lesser General Public License 9 | as published by the Free Software Foundation; either version 2.1 of 10 | the License, or (at your option) any later version. 11 | 12 | This library is distributed in the hope that it will be useful, but 13 | WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | Lesser General Public License for more details. 16 | 17 | You should have received a copy of the GNU Library General Public 18 | License along with this library; if not, see 19 | . 20 | ---------------------------------------------------------------------------- 21 | */ 22 | 23 | #ifndef __libconfig_strbuf_h 24 | #define __libconfig_strbuf_h 25 | 26 | #include 27 | #include 28 | 29 | typedef struct 30 | { 31 | char *string; 32 | size_t length; 33 | size_t capacity; 34 | } strbuf_t; 35 | 36 | char *strbuf_release(strbuf_t *buf); 37 | 38 | void strbuf_append(strbuf_t *buf, const char *text); 39 | 40 | #endif /* __libconfig_strbuf_h */ 41 | -------------------------------------------------------------------------------- /src/jil/option.h: -------------------------------------------------------------------------------- 1 | #ifndef JIL_OPTION_H_ 2 | #define JIL_OPTION_H_ 3 | 4 | #include 5 | 6 | #include "wx/arrstr.h" 7 | #include "wx/font.h" 8 | #include "wx/string.h" 9 | 10 | #include "editor/defs.h" 11 | 12 | #include "jil/defs.h" 13 | 14 | namespace jil { 15 | 16 | // Line padding range. 17 | const int kMinLinePadding = 1; 18 | const int kMaxLinePadding = 9; 19 | 20 | // Resolution of theme icons. 21 | enum Resolution { 22 | kNormalResolution = 0, 23 | kHighResolution, 24 | }; 25 | 26 | // Global options. 27 | class Options { 28 | public: 29 | Options() { 30 | Init(); 31 | } 32 | 33 | void Init() { 34 | cjk_filters = 0; 35 | icon_resolution = kNormalResolution; 36 | line_padding = 1; 37 | switch_cwd = false; 38 | restore_files = true; 39 | show_path = true; 40 | } 41 | 42 | int cjk_filters; 43 | 44 | // Encoding for new created file. 45 | editor::Encoding file_encoding; 46 | 47 | // Fonts. 48 | wxFont fonts[FONT_COUNT]; 49 | 50 | // Theme name. 51 | wxString theme; 52 | 53 | // Resolution of theme icons/images. 54 | Resolution icon_resolution; 55 | 56 | // Spacing at the top and bottom of a line. 57 | int line_padding; 58 | 59 | // Switch Current Working Dir when switch text page. 60 | bool switch_cwd; 61 | 62 | // Restore last open files. 63 | bool restore_files; 64 | 65 | // Show file path in the title bar. 66 | bool show_path; 67 | }; 68 | 69 | } // namespace jil 70 | 71 | #endif // JIL_OPTION_H_ 72 | -------------------------------------------------------------------------------- /third_party/src/lua/lstring.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lstring.h,v 1.56 2014/07/18 14:46:47 roberto Exp $ 3 | ** String table (keep all strings handled by Lua) 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef lstring_h 8 | #define lstring_h 9 | 10 | #include "lgc.h" 11 | #include "lobject.h" 12 | #include "lstate.h" 13 | 14 | 15 | #define sizelstring(l) (sizeof(union UTString) + ((l) + 1) * sizeof(char)) 16 | #define sizestring(s) sizelstring((s)->len) 17 | 18 | #define sizeludata(l) (sizeof(union UUdata) + (l)) 19 | #define sizeudata(u) sizeludata((u)->len) 20 | 21 | #define luaS_newliteral(L, s) (luaS_newlstr(L, "" s, \ 22 | (sizeof(s)/sizeof(char))-1)) 23 | 24 | 25 | /* 26 | ** test whether a string is a reserved word 27 | */ 28 | #define isreserved(s) ((s)->tt == LUA_TSHRSTR && (s)->extra > 0) 29 | 30 | 31 | /* 32 | ** equality for short strings, which are always internalized 33 | */ 34 | #define eqshrstr(a,b) check_exp((a)->tt == LUA_TSHRSTR, (a) == (b)) 35 | 36 | 37 | LUAI_FUNC unsigned int luaS_hash (const char *str, size_t l, unsigned int seed); 38 | LUAI_FUNC int luaS_eqlngstr (TString *a, TString *b); 39 | LUAI_FUNC void luaS_resize (lua_State *L, int newsize); 40 | LUAI_FUNC void luaS_remove (lua_State *L, TString *ts); 41 | LUAI_FUNC Udata *luaS_newudata (lua_State *L, size_t s); 42 | LUAI_FUNC TString *luaS_newlstr (lua_State *L, const char *str, size_t l); 43 | LUAI_FUNC TString *luaS_new (lua_State *L, const char *str); 44 | 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /src/jil/font_util.h: -------------------------------------------------------------------------------- 1 | #ifndef JIL_FONT_UTIL_H_ 2 | #define JIL_FONT_UTIL_H_ 3 | 4 | #include 5 | #include 6 | 7 | #include "wx/font.h" 8 | #include "wx/fontenum.h" 9 | #include "wx/string.h" 10 | 11 | #include "jil/defs.h" 12 | 13 | namespace jil { 14 | 15 | // Get or create the font via wxTheFontList. 16 | const wxFont& GetGlobalFont(int point_size, 17 | const wxString& facename, 18 | bool bold = false, 19 | bool italic = false); 20 | 21 | // Get a default preferred font. 22 | wxString GetDefaultFontName(); 23 | 24 | // Get the default font point size. 25 | int GetDefaultFontSize(); 26 | 27 | void NormalizeFont(wxFont& font); 28 | 29 | wxFont GetDefaultFont(FontType font_type); 30 | 31 | // Font point sizes. 32 | #if defined (__WXOSX__) 33 | const int kMinFontSize = 8; 34 | const int kMaxFontSize = 36; 35 | #else 36 | const int kMinFontSize = 6; 37 | const int kMaxFontSize = 24; 38 | #endif 39 | 40 | // Usage: 41 | // OrderedFontEnumerator fe; 42 | // fe.EnumerateFacenames(wxFONTENCODING_SYSTEM, true); 43 | // if (fe.facenames.empty()) { 44 | // ... 45 | // } 46 | class OrderedFontEnumerator : public wxFontEnumerator { 47 | public: 48 | virtual bool OnFacename(const wxString& facename) override { 49 | if (facename[0] != wxT('@')) { 50 | facenames.insert(facename); 51 | } 52 | return true; 53 | } 54 | 55 | std::set facenames; 56 | }; 57 | 58 | } // namespace jil 59 | 60 | #endif // JIL_FONT_UTIL_H_ 61 | -------------------------------------------------------------------------------- /src/editor/style.cc: -------------------------------------------------------------------------------- 1 | #include "editor/style.h" 2 | #include "editor/util.h" 3 | 4 | namespace editor { 5 | 6 | Style::Style() : values_(kItemCount) { 7 | // Initialize the major lex styles. 8 | for (int m = 0; m < kLexMajorTypeCount; ++m) { 9 | Set(Lex(m)); 10 | } 11 | } 12 | 13 | Style::~Style() { 14 | ClearContainer(&values_); 15 | 16 | for (std::size_t i = 0; i < kLexMajorTypeCount; ++i) { 17 | ClearContainer(&lex_values_[i]); 18 | } 19 | } 20 | 21 | void Style::Set(int item, const wxColour& fg, const wxColour& bg, int font) { 22 | if (values_[item] == NULL) { 23 | values_[item] = new StyleValue(fg, bg, font); 24 | } else { 25 | values_[item]->Set(fg, bg, font); 26 | } 27 | } 28 | 29 | void Style::Set(Lex lex, const wxColour& fg, const wxColour& bg, int font) { 30 | Values& values = lex_values_[lex.major()]; 31 | if (static_cast(lex.minor()) >= values.size()) { 32 | values.resize(lex.minor() + 1); 33 | } 34 | if (values[lex.minor()] == NULL) { 35 | values[lex.minor()] = new StyleValue(fg, bg, font); 36 | } else { 37 | values[lex.minor()]->Set(fg, bg, font); 38 | } 39 | } 40 | 41 | const StyleValue* Style::Get(Lex lex) const { 42 | const Values& values = lex_values_[lex.major()]; 43 | if (values.empty()) { 44 | return NULL; 45 | } 46 | 47 | if (static_cast(lex.minor()) < values.size() && 48 | values[lex.minor()] != NULL) { 49 | return values[lex.minor()]; 50 | } 51 | 52 | return values[0]; 53 | } 54 | 55 | } // namespace editor 56 | -------------------------------------------------------------------------------- /src/ui/bitmap_toggle_button.h: -------------------------------------------------------------------------------- 1 | #ifndef UI_BITMAP_TOGGLE_BUTTON_H_ 2 | #define UI_BITMAP_TOGGLE_BUTTON_H_ 3 | 4 | // A replacement of wxBitmapToggleButton. 5 | 6 | #include "ui/bitmap_button_base.h" 7 | 8 | #include "wx/tglbtn.h" // For wxEVT_TOGGLEBUTTON, etc. 9 | 10 | namespace ui { 11 | 12 | // Note: 13 | // BitmapToggleButton emits the same event as wxBitmapToggleButton: 14 | // Event type: wxEVT_TOGGLEBUTTON 15 | // Macro: EVT_TOGGLEBUTTON(id, func) 16 | 17 | class BitmapToggleButton : public BitmapButtonBase { 18 | DECLARE_CLASS(BitmapToggleButton) 19 | DECLARE_NO_COPY_CLASS(BitmapToggleButton) 20 | 21 | public: 22 | explicit BitmapToggleButton(SharedButtonStyle style); 23 | virtual ~BitmapToggleButton(); 24 | 25 | bool Create(wxWindow* parent, wxWindowID id); 26 | 27 | void set_auto_switch(bool auto_switch) { 28 | auto_switch_ = auto_switch; 29 | } 30 | 31 | // Switch toggle state. 32 | void Toggle() { 33 | toggle_ = !toggle_; 34 | } 35 | 36 | bool toggle() const { 37 | return toggle_; 38 | } 39 | void set_toggle(bool toggle) { 40 | toggle_ = toggle; 41 | Refresh(); 42 | } 43 | 44 | void SetToggleBitmaps(const wxBitmap& normal, const wxBitmap& pressed) { 45 | SetBitmaps(normal, pressed, pressed, normal); 46 | } 47 | 48 | protected: 49 | ButtonStyle::State GetState() const override; 50 | 51 | void PostEvent() override; 52 | 53 | private: 54 | bool toggle_; 55 | bool auto_switch_; 56 | }; 57 | 58 | } // namespace ui 59 | 60 | #endif // UI_BITMAP_TOGGLE_BUTTON_H_ 61 | -------------------------------------------------------------------------------- /data/jilfiles/ftplugin/lua/lex.cfg: -------------------------------------------------------------------------------- 1 | // Lex for Lua 2 | // Last update: 2015-10-26 3 | 4 | lex = ( 5 | // NOTE: Don't combine the following two comment quotes, or the comment 6 | // function can't recognize the comment start and end. 7 | { id = "comment"; quote = [ "--[[", "--]]" ]; multi_line = true; }, 8 | { id = "comment"; quote = [ "--\[(=+)\[", "--]\\1]" ]; use_regex = true; multi_line = true; }, 9 | 10 | { id = "comment"; quote = [ "--" ]; }, 11 | { id = "constant.string"; quote = [ "\"", "\"" ]; }, 12 | { id = "constant.string"; quote = [ "'", "'" ]; }, 13 | { id = "constant.string"; quote = [ "\[(=*)\[", "]\\1]" ]; regex = true; multi_line = true; }, 14 | 15 | { id = "constant.bool"; anyof = "true false"; }, 16 | { id = "constant.null"; anyof = "nil"; }, 17 | { id = "identifier"; anyof = "_G _VERSION"; }, 18 | { id = "statement"; anyof = "break goto return end local"; }, 19 | { id = "statement.conditional"; anyof = "if then else elseif and in not or"; }, 20 | { id = "statement.repeat"; anyof = "for do while repeat until"; }, 21 | { id = "type.struct"; anyof = "function"; }, 22 | 23 | // Basic functions 24 | { 25 | id = "identifier.function"; 26 | anyof = "assert collectgarbage dofile error getmetatable ipairs load " 27 | "loadfile next pairs pcall print rawequal rawget rawlen rawset " 28 | "select setmetatable tonumber tostring type xpcall"; 29 | }, 30 | 31 | { id = "constant.number"; prefix = "\d"; use_regex = true; } 32 | ); 33 | -------------------------------------------------------------------------------- /src/jil/about_dialog.cc: -------------------------------------------------------------------------------- 1 | #include "jil/about_dialog.h" 2 | 3 | #include "wx/sizer.h" 4 | #include "wx/stattext.h" 5 | 6 | #include "jil/defs.h" 7 | 8 | namespace jil { 9 | 10 | AboutDialog::AboutDialog(wxWindow* parent) 11 | : wxDialog(parent, wxID_ANY, kAppDisplayName) { 12 | SetMinSize(wxSize(390, -1)); 13 | 14 | // Name 15 | wxStaticText* name_label = NewLabel(kAppDisplayName); 16 | wxFont name_font = GetFont(); 17 | name_font.SetPointSize(16); 18 | name_label->SetFont(name_font); 19 | 20 | // Version 21 | wxStaticText* version_label = NewLabel(kAppVersion); 22 | 23 | // Author 24 | wxString author = wxT("Chunting Gu, sprinfall@gmail.com"); 25 | wxStaticText* author_label = NewLabel(author); 26 | 27 | // Years 28 | // Don't aumatically use the current year! Using the last update year makes 29 | // more sense. 30 | wxStaticText* years_label = NewLabel(wxT("2018")); 31 | 32 | // Layout 33 | wxSizer* top_vsizer = new wxBoxSizer(wxVERTICAL); 34 | top_vsizer->Add(name_label, 0, wxALIGN_CH | wxLR, 10); 35 | top_vsizer->Add(version_label, 0, wxALIGN_CH | wxLR, 10); 36 | top_vsizer->AddSpacer(30); 37 | top_vsizer->Add(author_label, 0, wxALIGN_CH | wxLR, 10); 38 | top_vsizer->Add(years_label, 0, wxALIGN_CH | wxLR, 10); 39 | top_vsizer->AddSpacer(10); 40 | 41 | SetSizer(top_vsizer); 42 | Fit(); 43 | } 44 | 45 | AboutDialog::~AboutDialog() { 46 | } 47 | 48 | wxStaticText* AboutDialog::NewLabel(const wxString& str) { 49 | return new wxStaticText(this, wxID_ANY, str); 50 | } 51 | 52 | } // namespace jil 53 | -------------------------------------------------------------------------------- /src/jil/pref/dialog_base.cc: -------------------------------------------------------------------------------- 1 | #include "jil/pref/dialog_base.h" 2 | 3 | #include "wx/notebook.h" 4 | #include "wx/sizer.h" 5 | 6 | #include "jil/pref/common.h" 7 | 8 | namespace jil { 9 | namespace pref { 10 | 11 | BEGIN_EVENT_TABLE(DialogBase, wxDialog) 12 | EVT_BUTTON(wxID_OK, DialogBase::OnButtonOK) 13 | EVT_BUTTON(wxID_CANCEL, DialogBase::OnButtonCancel) 14 | END_EVENT_TABLE() 15 | 16 | bool DialogBase::Create(wxWindow* parent, wxWindowID id, 17 | const wxString& title) { 18 | // Recursively call TransferDataFromWindow() and TransferDataToWindow(). 19 | SetExtraStyle(GetExtraStyle() | wxWS_EX_VALIDATE_RECURSIVELY); 20 | 21 | if (!wxDialog::Create(parent, id, title)) { 22 | return false; 23 | } 24 | 25 | notebook_ = new wxNotebook(this, ID_NOTEBOOK); 26 | 27 | AddPages(); 28 | 29 | // Layout 30 | wxSizer* vsizer = new wxBoxSizer(wxVERTICAL); 31 | vsizer->Add(notebook_, wxSizerFlags().Expand().Border(wxALL)); 32 | 33 | wxSizer* button_sizer = CreateStdDialogButtonSizer(wxOK | wxCANCEL); 34 | // NOTE: No left/right border, the button sizer has considered it. 35 | vsizer->Add(button_sizer, wxSizerFlags().Expand().Border(wxTOP | wxBOTTOM)); 36 | 37 | SetSizer(vsizer); 38 | 39 | Fit(); 40 | 41 | return true; 42 | } 43 | 44 | void DialogBase::OnButtonOK(wxCommandEvent& evt) { 45 | TransferDataFromWindow(); 46 | EndModal(wxID_OK); 47 | } 48 | 49 | void DialogBase::OnButtonCancel(wxCommandEvent& evt) { 50 | EndModal(wxID_CANCEL); 51 | } 52 | 53 | } // namespace pref 54 | } // namespace jil 55 | -------------------------------------------------------------------------------- /src/jil/goto_dialog.cc: -------------------------------------------------------------------------------- 1 | #include "jil/goto_dialog.h" 2 | #include "wx/button.h" 3 | #include "wx/sizer.h" 4 | #include "wx/textctrl.h" 5 | #include "wx/valnum.h" 6 | 7 | namespace jil { 8 | 9 | GotoDialog::GotoDialog(wxWindow* parent, wxWindowID id) 10 | : wxDialog(parent, id, _("Go To")) 11 | , line_text_ctrl_(NULL) 12 | , line_(0) { 13 | // Allow integer only. (Better to use unsigned int.) 14 | wxIntegerValidator val(&line_, wxNUM_VAL_DEFAULT); 15 | 16 | line_text_ctrl_ = new wxTextCtrl(this, wxID_ANY, wxEmptyString, 17 | wxDefaultPosition, wxSize(300, -1), 18 | 0, val); 19 | 20 | wxButton* ok_button = new wxButton(this, wxID_OK, _("OK")); 21 | wxButton* cancel_button = new wxButton(this, wxID_CANCEL, _("Cancel")); 22 | 23 | ok_button->SetDefault(); // Set default for ENTER key. 24 | 25 | const int kSpace = 7; 26 | 27 | wxSizer* vsizer = new wxBoxSizer(wxVERTICAL); 28 | vsizer->AddSpacer(kSpace); 29 | vsizer->Add(line_text_ctrl_, 0, wxEXPAND | wxLEFT | wxRIGHT, kSpace); 30 | 31 | wxSizer* button_hsizer = new wxBoxSizer(wxHORIZONTAL); 32 | button_hsizer->AddStretchSpacer(); 33 | button_hsizer->Add(ok_button); 34 | button_hsizer->AddSpacer(kSpace); 35 | button_hsizer->Add(cancel_button); 36 | vsizer->AddSpacer(kSpace); 37 | vsizer->Add(button_hsizer, 0, wxEXPAND | wxLEFT | wxRIGHT, kSpace); 38 | 39 | vsizer->AddSpacer(kSpace); 40 | 41 | SetSizer(vsizer); 42 | Fit(); 43 | } 44 | 45 | GotoDialog::~GotoDialog() { 46 | } 47 | 48 | } // namespace jil 49 | -------------------------------------------------------------------------------- /third_party/src/lua/ldebug.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: ldebug.h,v 2.12 2014/11/10 14:46:05 roberto Exp $ 3 | ** Auxiliary functions from Debug Interface module 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef ldebug_h 8 | #define ldebug_h 9 | 10 | 11 | #include "lstate.h" 12 | 13 | 14 | #define pcRel(pc, p) (cast(int, (pc) - (p)->code) - 1) 15 | 16 | #define getfuncline(f,pc) (((f)->lineinfo) ? (f)->lineinfo[pc] : -1) 17 | 18 | #define resethookcount(L) (L->hookcount = L->basehookcount) 19 | 20 | /* Active Lua function (given call info) */ 21 | #define ci_func(ci) (clLvalue((ci)->func)) 22 | 23 | 24 | LUAI_FUNC l_noret luaG_typeerror (lua_State *L, const TValue *o, 25 | const char *opname); 26 | LUAI_FUNC l_noret luaG_concaterror (lua_State *L, const TValue *p1, 27 | const TValue *p2); 28 | LUAI_FUNC l_noret luaG_opinterror (lua_State *L, const TValue *p1, 29 | const TValue *p2, 30 | const char *msg); 31 | LUAI_FUNC l_noret luaG_tointerror (lua_State *L, const TValue *p1, 32 | const TValue *p2); 33 | LUAI_FUNC l_noret luaG_ordererror (lua_State *L, const TValue *p1, 34 | const TValue *p2); 35 | LUAI_FUNC l_noret luaG_runerror (lua_State *L, const char *fmt, ...); 36 | LUAI_FUNC l_noret luaG_errormsg (lua_State *L); 37 | LUAI_FUNC void luaG_traceexec (lua_State *L); 38 | 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /src/jil/pref/global_general_page.h: -------------------------------------------------------------------------------- 1 | #ifndef JIL_PREF_GLOBAL_GENERAL_PAGE_H_ 2 | #define JIL_PREF_GLOBAL_GENERAL_PAGE_H_ 3 | 4 | #include 5 | 6 | #include "wx/panel.h" 7 | 8 | #include "editor/defs.h" 9 | 10 | class wxCheckBox; 11 | class wxComboBox; 12 | class wxSpinCtrl; 13 | 14 | namespace jil { 15 | 16 | class Options; 17 | 18 | namespace pref { 19 | 20 | class Global_GeneralPage : public wxPanel { 21 | public: 22 | explicit Global_GeneralPage(Options* options); 23 | 24 | ~Global_GeneralPage() override = default; 25 | 26 | bool Create(wxWindow* parent, wxWindowID id = wxID_ANY); 27 | 28 | bool TransferDataToWindow() override; 29 | bool TransferDataFromWindow() override; 30 | 31 | private: 32 | void CreateControls(); 33 | 34 | void CreateEncodingSection(wxSizer* top_vsizer); 35 | 36 | void CreateLinePaddingSection(wxSizer* top_vsizer); 37 | 38 | void InitFileEncodingTable(); 39 | 40 | void InitFileEncodingComboBox(wxComboBox* combo_box); 41 | 42 | int IndexFileEncoding(editor::Encoding& encoding) const; 43 | 44 | private: 45 | Options* options_; 46 | 47 | std::vector file_encodings_; 48 | 49 | wxCheckBox* c_check_box_; 50 | wxCheckBox* j_check_box_; 51 | wxCheckBox* k_check_box_; 52 | 53 | wxComboBox* fenc_combo_box_; 54 | 55 | wxCheckBox* switch_cwd_check_box_; 56 | wxCheckBox* restore_files_check_box_; 57 | wxCheckBox* show_path_check_box_; 58 | 59 | wxSpinCtrl* line_padding_spin_ctrl_; 60 | }; 61 | 62 | } // namespace pref 63 | } // namespace jil 64 | 65 | #endif // JIL_PREF_GLOBAL_GENERAL_PAGE_H_ 66 | -------------------------------------------------------------------------------- /src/editor/line_nr_area.cc: -------------------------------------------------------------------------------- 1 | #include "editor/line_nr_area.h" 2 | #include "wx/dcbuffer.h" 3 | #include "editor/compile_config.h" 4 | #include "editor/text_window.h" 5 | 6 | namespace editor { 7 | 8 | BEGIN_EVENT_TABLE(LineNrArea, wxPanel) 9 | EVT_PAINT(LineNrArea::OnPaint) 10 | EVT_SIZE(LineNrArea::OnSize) 11 | EVT_MOUSE_EVENTS(LineNrArea::OnMouse) 12 | EVT_MOUSE_CAPTURE_LOST(LineNrArea::OnMouseCaptureLost) 13 | END_EVENT_TABLE() 14 | 15 | LineNrArea::LineNrArea(TextWindow* text_window) 16 | : text_window_(text_window) { 17 | } 18 | 19 | LineNrArea::~LineNrArea() { 20 | } 21 | 22 | bool LineNrArea::Create(wxWindow* parent, wxWindowID id) { 23 | if (!wxPanel::Create(parent, id)) { 24 | return false; 25 | } 26 | 27 | SetBackgroundStyle(wxBG_STYLE_PAINT); 28 | return true; 29 | } 30 | 31 | void LineNrArea::OnPaint(wxPaintEvent& WXUNUSED(evt)) { 32 | wxAutoBufferedPaintDC dc(this); 33 | 34 | #if !wxALWAYS_NATIVE_DOUBLE_BUFFER 35 | dc.SetBackground(GetBackgroundColour()); 36 | dc.Clear(); 37 | #endif 38 | 39 | text_window_->PrepareDC(dc); 40 | text_window_->OnLineNrPaint(dc); 41 | } 42 | 43 | void LineNrArea::OnSize(wxSizeEvent& evt) { 44 | text_window_->OnLineNrSize(evt); 45 | evt.Skip(); 46 | } 47 | 48 | void LineNrArea::OnMouse(wxMouseEvent& evt) { 49 | bool handled = text_window_->OnLineNrMouse(evt); 50 | if (!handled) { 51 | // Skip the event for default handling. 52 | evt.Skip(); 53 | } 54 | } 55 | 56 | void LineNrArea::OnMouseCaptureLost(wxMouseCaptureLostEvent& evt) { 57 | WXUNUSED(evt); 58 | // Just ignore this event. 59 | } 60 | 61 | } // namespace editor 62 | -------------------------------------------------------------------------------- /src/ui/text_button.cc: -------------------------------------------------------------------------------- 1 | #include "ui/text_button.h" 2 | 3 | #include "wx/dcclient.h" 4 | 5 | namespace ui { 6 | 7 | IMPLEMENT_CLASS(TextButton, ButtonBase); 8 | 9 | bool TextButton::Create(wxWindow* parent, wxWindowID id, 10 | const wxString& label) { 11 | if (!ButtonBase::Create(parent, id)) { 12 | return false; 13 | } 14 | 15 | SetLabel(label); 16 | 17 | return true; 18 | } 19 | 20 | wxSize TextButton::DoGetBestSize() const { 21 | if (min_size_ != wxDefaultSize) { 22 | return min_size_; 23 | } 24 | 25 | wxSize best_size; 26 | GetTextExtent(GetLabel(), &best_size.x, &best_size.y); 27 | best_size += padding_; 28 | best_size += padding_; 29 | return best_size; 30 | } 31 | 32 | ButtonStyle::State TextButton::GetState() const { 33 | if (!IsThisEnabled()) { // NOTE: Don't use IsEnabled()! 34 | return ButtonStyle::DISABLED; 35 | } 36 | 37 | if (pressed_) { 38 | return ButtonStyle::PRESSED; 39 | } else if (hover_) { 40 | return ButtonStyle::HOVER; 41 | } else { 42 | return ButtonStyle::NORMAL; 43 | } 44 | } 45 | 46 | void TextButton::DrawFg(wxDC& dc, ButtonStyle::State state) { 47 | dc.SetFont(GetFont()); 48 | 49 | wxColour fg = style_->GetColor(ButtonStyle::FG, state); 50 | dc.SetTextForeground(fg); 51 | 52 | dc.DrawLabel(GetLabel(), GetClientRect(), wxALIGN_CENTER); 53 | } 54 | 55 | void TextButton::PostEvent() { 56 | wxCommandEvent evt(wxEVT_COMMAND_BUTTON_CLICKED, GetId()); 57 | evt.SetEventObject(this); 58 | evt.SetString(GetLabel()); 59 | GetParent()->GetEventHandler()->AddPendingEvent(evt); 60 | } 61 | 62 | } // namespace ui 63 | -------------------------------------------------------------------------------- /data/jilfiles/ft.cfg: -------------------------------------------------------------------------------- 1 | // ft.cfg 2 | // Rules to determine file type. 3 | 4 | // Determine file type by file name and extension. 5 | name = ( 6 | { id = "c"; name = "C"; fn_ext = "c"; }, 7 | { id = "cfg"; name = "Config"; fn_ext = "cfg"; }, 8 | { id = "cmake"; name = "CMake"; fn = "CMakeLists.txt"; }, 9 | { id = "cpp"; name = "C++"; fn_ext = "cpp,cc,cxx,h,hpp,hxx"; }, 10 | { id = "csharp"; name = "C#"; fn_ext = "cs"; }, 11 | { id = "css"; name = "CSS"; fn_ext = "css"; }, 12 | { id = "cue"; name = "CUE"; fn_ext = "cue"; }, 13 | { id = "go"; name = "Go"; fn_ext = "go"; }, 14 | { id = "html"; name = "HTML"; fn_ext = "htm,html"; }, 15 | { id = "java"; name = "Java"; fn_ext = "java"; }, 16 | { id = "javascript"; name = "JavaScript"; fn_ext = "js"; }, 17 | { id = "lua"; name = "Lua"; fn_ext = "lua"; }, 18 | { id = "python"; name = "Python"; fn_ext = "py"; }, 19 | { id = "ruby"; name = "Ruby"; fn_ext = "rb"; }, 20 | { id = "rust"; name = "Rust"; fn_ext = "rs"; }, 21 | { id = "vb"; name = "VB"; fn_ext = "vb"; }, 22 | { id = "xml"; name = "XML"; fn_ext = "xml"; }, 23 | { id = "jil-find_result"; name = "Find Result"; fn_ext = "jil-find_result"; } 24 | ); 25 | 26 | // Determine file type by paired file. 27 | pair = ( 28 | { 29 | fn_ext = "h"; 30 | paired = "c,cpp,cc,cxx"; 31 | } 32 | ); 33 | 34 | // Determine file type by file content. 35 | content = ( 36 | { 37 | id = "cpp"; 38 | any = [ "class", "namespace", "template", "extern \"C\"" ]; 39 | }, 40 | { 41 | id = "xml"; 42 | any = [ "stack_last - L->top <= (n)) \ 17 | luaD_growstack(L, n); else condmovestack(L); 18 | 19 | 20 | #define incr_top(L) {L->top++; luaD_checkstack(L,0);} 21 | 22 | #define savestack(L,p) ((char *)(p) - (char *)L->stack) 23 | #define restorestack(L,n) ((TValue *)((char *)L->stack + (n))) 24 | 25 | 26 | /* type of protected functions, to be ran by 'runprotected' */ 27 | typedef void (*Pfunc) (lua_State *L, void *ud); 28 | 29 | LUAI_FUNC int luaD_protectedparser (lua_State *L, ZIO *z, const char *name, 30 | const char *mode); 31 | LUAI_FUNC void luaD_hook (lua_State *L, int event, int line); 32 | LUAI_FUNC int luaD_precall (lua_State *L, StkId func, int nresults); 33 | LUAI_FUNC void luaD_call (lua_State *L, StkId func, int nResults, 34 | int allowyield); 35 | LUAI_FUNC int luaD_pcall (lua_State *L, Pfunc func, void *u, 36 | ptrdiff_t oldtop, ptrdiff_t ef); 37 | LUAI_FUNC int luaD_poscall (lua_State *L, StkId firstResult); 38 | LUAI_FUNC void luaD_reallocstack (lua_State *L, int newsize); 39 | LUAI_FUNC void luaD_growstack (lua_State *L, int n); 40 | LUAI_FUNC void luaD_shrinkstack (lua_State *L); 41 | 42 | LUAI_FUNC l_noret luaD_throw (lua_State *L, int errcode); 43 | LUAI_FUNC int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud); 44 | 45 | #endif 46 | 47 | -------------------------------------------------------------------------------- /third_party/src/lua/lfunc.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lfunc.h,v 2.14 2014/06/19 18:27:20 roberto Exp $ 3 | ** Auxiliary functions to manipulate prototypes and closures 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef lfunc_h 8 | #define lfunc_h 9 | 10 | 11 | #include "lobject.h" 12 | 13 | 14 | #define sizeCclosure(n) (cast(int, sizeof(CClosure)) + \ 15 | cast(int, sizeof(TValue)*((n)-1))) 16 | 17 | #define sizeLclosure(n) (cast(int, sizeof(LClosure)) + \ 18 | cast(int, sizeof(TValue *)*((n)-1))) 19 | 20 | 21 | /* test whether thread is in 'twups' list */ 22 | #define isintwups(L) (L->twups != L) 23 | 24 | 25 | /* 26 | ** Upvalues for Lua closures 27 | */ 28 | struct UpVal { 29 | TValue *v; /* points to stack or to its own value */ 30 | lu_mem refcount; /* reference counter */ 31 | union { 32 | struct { /* (when open) */ 33 | UpVal *next; /* linked list */ 34 | int touched; /* mark to avoid cycles with dead threads */ 35 | } open; 36 | TValue value; /* the value (when closed) */ 37 | } u; 38 | }; 39 | 40 | #define upisopen(up) ((up)->v != &(up)->u.value) 41 | 42 | 43 | LUAI_FUNC Proto *luaF_newproto (lua_State *L); 44 | LUAI_FUNC CClosure *luaF_newCclosure (lua_State *L, int nelems); 45 | LUAI_FUNC LClosure *luaF_newLclosure (lua_State *L, int nelems); 46 | LUAI_FUNC void luaF_initupvals (lua_State *L, LClosure *cl); 47 | LUAI_FUNC UpVal *luaF_findupval (lua_State *L, StkId level); 48 | LUAI_FUNC void luaF_close (lua_State *L, StkId level); 49 | LUAI_FUNC void luaF_freeproto (lua_State *L, Proto *f); 50 | LUAI_FUNC const char *luaF_getlocalname (const Proto *func, int local_number, 51 | int pc); 52 | 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /data/jilfiles/ftplugin/go/lex.cfg: -------------------------------------------------------------------------------- 1 | // Lex for Go 2 | // Last update: 2015-10-26 3 | 4 | lex = ( 5 | { id = "comment"; quote = [ "/*", "*/" ]; multi_line = true; }, 6 | { id = "comment"; quote = [ "//" ]; }, // EOL is not escapable. 7 | { id = "constant.string"; quote = [ "\"", "\"" ]; escape_eol = true; }, 8 | // Raw string. 9 | { id = "constant.string"; quote = [ "`", "`" ]; multi_line = true; }, 10 | { id = "constant.char"; quote = [ "'", "'" ]; }, 11 | 12 | { id = "constant"; anyof = "iota"; }, 13 | { id = "constant.bool"; anyof = "true false"; }, 14 | { id = "constant.null"; anyof = "nil"; }, 15 | { 16 | id = "identifier.function"; 17 | anyof = "append cap close complex copy delete imag len " 18 | "make new panic print println real recover"; 19 | }, 20 | // TODO: func is also a type. 21 | { id = "statement"; anyof = "func defer go goto return var type"; }, 22 | { id = "statement.package"; anyof = "package import"; }, 23 | { id = "statement.conditional"; anyof = "if else switch case default select"; }, 24 | { id = "statement.repeat"; anyof = "for range break continue fallthrough"; }, 25 | { 26 | id = "type"; 27 | anyof = "chan map bool string error " 28 | "int int8 int16 int32 int64 rune " 29 | "byte uint uint8 uint16 uint32 uint64 uintptr " 30 | "float32 float64 complex64 complex128"; 31 | }, 32 | { id = "type.qualifier"; anyof = "const"; }, 33 | { id = "type.struct"; anyof = "struct interface"; }, 34 | 35 | { id = "constant.number"; prefix = "\d"; use_regex = true; }, 36 | 37 | { id = "identifier.function"; prev = "func"; }, 38 | { id = "identifier.function"; next = "("; } 39 | ); 40 | -------------------------------------------------------------------------------- /src/editor/option.cc: -------------------------------------------------------------------------------- 1 | #include "editor/option.h" 2 | 3 | #define TRUE_STR wxT("true") 4 | #define FALSE_STR wxT("false") 5 | 6 | namespace editor { 7 | 8 | wxString OptionValue::ToString() const { 9 | if (type_ == kBool) { 10 | bool value = false; 11 | if (As(&value)) { 12 | return value ? TRUE_STR : FALSE_STR; 13 | } 14 | } else if (type_ == kInt) { 15 | int value = 0; 16 | if (As(&value)) { 17 | return wxString::Format(wxT("%d"), value); 18 | } 19 | } else if (type_ == kString) { 20 | std::string value; 21 | if (As(&value)) { 22 | return wxString::FromUTF8(value.c_str()); 23 | } 24 | } 25 | 26 | return wxEmptyString; 27 | } 28 | 29 | bool OptionValue::Parse(const wxString& str) { 30 | if (type_ == kBool) { 31 | if (str.CmpNoCase(TRUE_STR) == 0) { 32 | data_ = true; 33 | return true; 34 | } else if (str.CmpNoCase(FALSE_STR) == 0) { 35 | data_ = false; 36 | return true; 37 | } 38 | } else if (type_ == kInt) { 39 | long value = 0; 40 | if (str.ToLong(&value)) { 41 | data_ = static_cast(value); 42 | return true; 43 | } 44 | } else if (type_ == kString) { 45 | // NOTE: Don't assign str.ToUTF8().data() directly to data_!!! 46 | data_ = std::string(str.ToUTF8().data()); 47 | return true; 48 | } 49 | 50 | return false; 51 | } 52 | 53 | bool operator==(const ViewOptions& lhs, const ViewOptions& rhs) { 54 | if (lhs.wrap == rhs.wrap && 55 | lhs.show_number == rhs.show_number && 56 | lhs.show_space == rhs.show_space && 57 | lhs.show_hscrollbar == rhs.show_hscrollbar && 58 | lhs.rulers == rhs.rulers) { 59 | return true; 60 | } 61 | return false; 62 | } 63 | 64 | } // namespace editor 65 | -------------------------------------------------------------------------------- /src/jil/pref/global_dialog.cc: -------------------------------------------------------------------------------- 1 | #include "jil/pref/global_dialog.h" 2 | 3 | #include "wx/notebook.h" 4 | 5 | #include "jil/pref/common.h" 6 | #include "jil/pref/global_font_page.h" 7 | #include "jil/pref/global_general_page.h" 8 | #include "jil/pref/global_theme_page.h" 9 | 10 | namespace jil { 11 | namespace pref { 12 | 13 | BEGIN_EVENT_TABLE(GlobalDialog, DialogBase) 14 | EVT_NOTEBOOK_PAGE_CHANGED(ID_NOTEBOOK, GlobalDialog::OnNotebookPageChanged) 15 | END_EVENT_TABLE() 16 | 17 | void GlobalDialog::AddPages() { 18 | Global_GeneralPage* general_page = new Global_GeneralPage(options_); 19 | Global_FontPage* font_page = new Global_FontPage(options_); 20 | Global_ThemePage* theme_page = new Global_ThemePage(options_); 21 | 22 | wxColour theme_bg_colour = notebook_->GetThemeBackgroundColour(); 23 | if (theme_bg_colour.IsOk()) { 24 | general_page->SetBackgroundColour(theme_bg_colour); 25 | font_page->SetBackgroundColour(theme_bg_colour); 26 | theme_page->SetBackgroundColour(theme_bg_colour); 27 | } 28 | 29 | general_page->Create(notebook_); 30 | font_page->Create(notebook_); 31 | theme_page->Create(notebook_); 32 | 33 | notebook_->AddPage(general_page, _("General"), true); 34 | notebook_->AddPage(font_page, _("Font"), false); 35 | notebook_->AddPage(theme_page, _("Theme"), false); 36 | } 37 | 38 | void GlobalDialog::OnNotebookPageChanged(wxBookCtrlEvent& evt) { 39 | int selection = evt.GetSelection(); 40 | if (selection == 1) { 41 | // Enumerate system fonts if necessary. 42 | wxWindow* page = notebook_->GetPage(1); 43 | Global_FontPage* font_page = dynamic_cast(page); 44 | if (font_page != NULL) { 45 | font_page->EnumerateFonts(); 46 | } 47 | } 48 | } 49 | 50 | } // namespace pref 51 | } // namespace jil 52 | -------------------------------------------------------------------------------- /src/jil/pref/common.h: -------------------------------------------------------------------------------- 1 | #ifndef JIL_PREF_COMMON_H_ 2 | #define JIL_PREF_COMMON_H_ 3 | 4 | // Preference utilities. 5 | 6 | #include "wx/gdicmn.h" 7 | #include "wx/string.h" 8 | #include "wx/window.h" 9 | 10 | class wxComboBox; 11 | class wxStaticText; 12 | class wxSizer; 13 | class wxTextCtrl; 14 | 15 | namespace jil { 16 | namespace pref { 17 | 18 | enum Id { 19 | ID_PREF_BEGIN = wxID_HIGHEST + 100, 20 | 21 | ID_NOTEBOOK, 22 | 23 | ID_FONT_LIST_CTRL, 24 | ID_FONT_NAME_COMBOBOX, 25 | ID_FONT_SIZE_COMBOBOX, 26 | ID_FONT_USE_DEFAULT_BUTTON, 27 | 28 | ID_TAB_STOP_TEXTCTRL, 29 | ID_EXPAND_TAB_CHECKBOX, 30 | ID_GUESS_CHECKBOX, 31 | }; 32 | 33 | static const wxSize kMinComboBoxSize(120, -1); 34 | static const wxSize kNumTextSize(100, -1); 35 | static const wxSize kSmallNumTextSize(60, -1); 36 | static const wxSize kStrTextSize(280, -1); 37 | 38 | // Add or remove a flag from the flags. 39 | void UpdateFlag(int& flags, int flag, bool enable); 40 | 41 | static inline wxString IntToStr(int i) { 42 | return wxString::Format(wxT("%d"), i); 43 | } 44 | 45 | int StrToInt(const wxString& str); 46 | 47 | int ValidateInt(int i, int min, int max); 48 | 49 | wxStaticText* CreateStaticText(wxWindow* parent, const wxString& label, 50 | bool bold = false); 51 | 52 | wxSizer* CreateSeparator(wxWindow* parent, const wxString& label, 53 | bool bold = false); 54 | 55 | wxComboBox* CreateReadonlyComboBox(wxWindow* parent, wxWindowID id); 56 | 57 | wxTextCtrl* CreateTextCtrl(wxWindow* parent, wxWindowID id, 58 | const wxSize& size = wxDefaultSize, 59 | const wxValidator& validator = wxDefaultValidator); 60 | 61 | } // namespace pref 62 | } // namespace jil 63 | 64 | #endif // JIL_PREF_COMMON_H_ 65 | -------------------------------------------------------------------------------- /third_party/src/pugixml/foreach.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Boost.Foreach support for pugixml classes. 3 | * This file is provided to the public domain. 4 | * Written by Arseny Kapoulkine (arseny.kapoulkine@gmail.com) 5 | */ 6 | 7 | #ifndef HEADER_PUGIXML_FOREACH_HPP 8 | #define HEADER_PUGIXML_FOREACH_HPP 9 | 10 | #include "pugixml.hpp" 11 | 12 | /* 13 | * These types add support for BOOST_FOREACH macro to xml_node and xml_document classes (child iteration only). 14 | * Example usage: 15 | * BOOST_FOREACH(xml_node n, doc) {} 16 | */ 17 | 18 | namespace boost 19 | { 20 | template struct range_mutable_iterator; 21 | template struct range_const_iterator; 22 | 23 | template<> struct range_mutable_iterator 24 | { 25 | typedef pugi::xml_node::iterator type; 26 | }; 27 | 28 | template<> struct range_const_iterator 29 | { 30 | typedef pugi::xml_node::iterator type; 31 | }; 32 | 33 | template<> struct range_mutable_iterator 34 | { 35 | typedef pugi::xml_document::iterator type; 36 | }; 37 | 38 | template<> struct range_const_iterator 39 | { 40 | typedef pugi::xml_document::iterator type; 41 | }; 42 | } 43 | 44 | /* 45 | * These types add support for BOOST_FOREACH macro to xml_node and xml_document classes (child/attribute iteration). 46 | * Example usage: 47 | * BOOST_FOREACH(xml_node n, children(doc)) {} 48 | * BOOST_FOREACH(xml_node n, attributes(doc)) {} 49 | */ 50 | 51 | namespace pugi 52 | { 53 | inline xml_object_range children(const pugi::xml_node& node) 54 | { 55 | return node.children(); 56 | } 57 | 58 | inline xml_object_range attributes(const pugi::xml_node& node) 59 | { 60 | return node.attributes(); 61 | } 62 | } 63 | 64 | #endif 65 | -------------------------------------------------------------------------------- /src/editor/selection.h: -------------------------------------------------------------------------------- 1 | #ifndef EDITOR_SELECTION_H_ 2 | #define EDITOR_SELECTION_H_ 3 | 4 | #include "editor/defs.h" 5 | #include "editor/text_range.h" 6 | 7 | namespace editor { 8 | 9 | // Text selection. 10 | class Selection { 11 | public: 12 | Selection() : dir(kForward), rect(false) { 13 | } 14 | 15 | void Reset() { 16 | range.Reset(); 17 | rect = false; 18 | } 19 | 20 | void Set(const TextRange& _range, TextDir _dir, bool _rect) { 21 | range = _range; 22 | dir = _dir; 23 | rect = _rect; 24 | } 25 | 26 | bool IsEmpty() const { 27 | return range.IsEmpty(); 28 | } 29 | 30 | bool IsRectEmpty() const { 31 | return (rect && range.point_begin().x == range.point_end().x); 32 | } 33 | 34 | bool Contain(const TextPoint& point) const { 35 | return range.Contain(point); 36 | } 37 | 38 | bool HasLine(Coord ln) const { 39 | return range.HasLine(ln); 40 | } 41 | 42 | const TextPoint& begin() const { 43 | return range.point_begin(); 44 | } 45 | 46 | const TextPoint& end() const { 47 | return range.point_end(); 48 | } 49 | 50 | const TextPoint& GetFromPoint() const { 51 | return (dir == kForward ? begin() : end()); 52 | } 53 | 54 | const TextPoint& GetToPoint() const { 55 | return (dir == kForward ? end() : begin()); 56 | } 57 | 58 | LineRange GetLineRange() const { 59 | return range.GetLineRange(); 60 | } 61 | 62 | CharRange GetCharRange(Coord ln) const { 63 | if (rect) { 64 | return range.GetCharRange(); 65 | } else { 66 | return range.GetCharRange(ln); 67 | } 68 | } 69 | 70 | CharRange GetCharRange() const { 71 | return range.GetCharRange(); 72 | } 73 | 74 | TextRange range; 75 | TextDir dir; 76 | bool rect; 77 | }; 78 | 79 | } // namespace editor 80 | 81 | #endif // EDITOR_SELECTION_H_ 82 | -------------------------------------------------------------------------------- /third_party/src/lua/lzio.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lzio.h,v 1.30 2014/12/19 17:26:14 roberto Exp $ 3 | ** Buffered streams 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | 8 | #ifndef lzio_h 9 | #define lzio_h 10 | 11 | #include "lua.h" 12 | 13 | #include "lmem.h" 14 | 15 | 16 | #define EOZ (-1) /* end of stream */ 17 | 18 | typedef struct Zio ZIO; 19 | 20 | #define zgetc(z) (((z)->n--)>0 ? cast_uchar(*(z)->p++) : luaZ_fill(z)) 21 | 22 | 23 | typedef struct Mbuffer { 24 | char *buffer; 25 | size_t n; 26 | size_t buffsize; 27 | } Mbuffer; 28 | 29 | #define luaZ_initbuffer(L, buff) ((buff)->buffer = NULL, (buff)->buffsize = 0) 30 | 31 | #define luaZ_buffer(buff) ((buff)->buffer) 32 | #define luaZ_sizebuffer(buff) ((buff)->buffsize) 33 | #define luaZ_bufflen(buff) ((buff)->n) 34 | 35 | #define luaZ_buffremove(buff,i) ((buff)->n -= (i)) 36 | #define luaZ_resetbuffer(buff) ((buff)->n = 0) 37 | 38 | 39 | #define luaZ_resizebuffer(L, buff, size) \ 40 | ((buff)->buffer = luaM_reallocvchar(L, (buff)->buffer, \ 41 | (buff)->buffsize, size), \ 42 | (buff)->buffsize = size) 43 | 44 | #define luaZ_freebuffer(L, buff) luaZ_resizebuffer(L, buff, 0) 45 | 46 | 47 | LUAI_FUNC char *luaZ_openspace (lua_State *L, Mbuffer *buff, size_t n); 48 | LUAI_FUNC void luaZ_init (lua_State *L, ZIO *z, lua_Reader reader, 49 | void *data); 50 | LUAI_FUNC size_t luaZ_read (ZIO* z, void *b, size_t n); /* read next n bytes */ 51 | 52 | 53 | 54 | /* --------- Private Part ------------------ */ 55 | 56 | struct Zio { 57 | size_t n; /* bytes still unread */ 58 | const char *p; /* current position in buffer */ 59 | lua_Reader reader; /* reader function */ 60 | void *data; /* additional data */ 61 | lua_State *L; /* Lua state (for reader) */ 62 | }; 63 | 64 | 65 | LUAI_FUNC int luaZ_fill (ZIO *z); 66 | 67 | #endif 68 | -------------------------------------------------------------------------------- /third_party/src/libconfig/parsectx.h: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------------- 2 | libconfig - A library for processing structured configuration files 3 | Copyright (C) 2005-2010 Mark A Lindner 4 | 5 | This file is part of libconfig. 6 | 7 | This library is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU Lesser General Public License 9 | as published by the Free Software Foundation; either version 2.1 of 10 | the License, or (at your option) any later version. 11 | 12 | This library is distributed in the hope that it will be useful, but 13 | WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | Lesser General Public License for more details. 16 | 17 | You should have received a copy of the GNU Library General Public 18 | License along with this library; if not, see 19 | . 20 | ---------------------------------------------------------------------------- 21 | */ 22 | 23 | #ifndef __libconfig_parsectx_h 24 | #define __libconfig_parsectx_h 25 | 26 | #include "libconfig.h" 27 | #include "strbuf.h" 28 | 29 | struct parse_context 30 | { 31 | config_t *config; 32 | config_setting_t *parent; 33 | config_setting_t *setting; 34 | char *name; 35 | strbuf_t string; 36 | }; 37 | 38 | #define parsectx_init(C) \ 39 | memset((C), 0, sizeof(struct parse_context)) 40 | #define parsectx_cleanup(C) \ 41 | free((void *)(strbuf_release(&((C)->string)))) 42 | 43 | #define parsectx_append_string(C, S) \ 44 | strbuf_append(&((C)->string), (S)) 45 | #define parsectx_take_string(C) \ 46 | strbuf_release(&((C)->string)) 47 | 48 | #endif /* __libconfig_parsectx_h */ 49 | -------------------------------------------------------------------------------- /src/jil/pref/editor_comment_page.cc: -------------------------------------------------------------------------------- 1 | #include "jil/pref/editor_comment_page.h" 2 | 3 | #include "wx/checkbox.h" 4 | #include "wx/sizer.h" 5 | #include "wx/stattext.h" 6 | 7 | #include "ui/static_box.h" 8 | 9 | #include "editor/option.h" 10 | 11 | #include "jil/defs.h" 12 | #include "jil/pref/common.h" 13 | 14 | namespace jil { 15 | namespace pref { 16 | 17 | bool Editor_CommentPage::Create(wxWindow* parent, wxWindowID id) { 18 | if (!wxPanel::Create(parent, id)) { 19 | return false; 20 | } 21 | 22 | CreateControls(); 23 | 24 | return true; 25 | } 26 | 27 | bool Editor_CommentPage::TransferDataToWindow() { 28 | add_space_check_box_->SetValue(options_->text.comment_add_space); 29 | respect_indent_check_box_->SetValue(options_->text.comment_respect_indent); 30 | 31 | return true; 32 | } 33 | 34 | bool Editor_CommentPage::TransferDataFromWindow() { 35 | options_->text.comment_add_space = add_space_check_box_->GetValue(); 36 | options_->text.comment_respect_indent = respect_indent_check_box_->GetValue(); 37 | 38 | return true; 39 | } 40 | 41 | void Editor_CommentPage::CreateControls() { 42 | wxSizer* top_vsizer = new wxBoxSizer(wxVERTICAL); 43 | 44 | ui::StaticBox* box = new ui::StaticBox(this, wxEmptyString); 45 | wxSizer* box_vsizer = new wxBoxSizer(wxVERTICAL); 46 | 47 | add_space_check_box_ = new wxCheckBox(box, wxID_ANY, _("Add space")); 48 | respect_indent_check_box_ = new wxCheckBox(box, wxID_ANY, 49 | _("Respect line indent")); 50 | 51 | box_vsizer->Add(add_space_check_box_, wxSizerFlags().Border(wxTOP)); 52 | box_vsizer->Add(respect_indent_check_box_, 53 | wxSizerFlags().Expand().Border(wxTOP)); 54 | 55 | box->SetBodySizer(box_vsizer); 56 | top_vsizer->Add(box, wxSizerFlags().Expand().Border(wxALL)); 57 | 58 | SetSizerAndFit(top_vsizer); 59 | } 60 | 61 | } // namespace pref 62 | } // namespace jil 63 | -------------------------------------------------------------------------------- /third_party/src/lua/ltable.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: ltable.h,v 2.20 2014/09/04 18:15:29 roberto Exp $ 3 | ** Lua tables (hash) 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef ltable_h 8 | #define ltable_h 9 | 10 | #include "lobject.h" 11 | 12 | 13 | #define gnode(t,i) (&(t)->node[i]) 14 | #define gval(n) (&(n)->i_val) 15 | #define gnext(n) ((n)->i_key.nk.next) 16 | 17 | 18 | /* 'const' to avoid wrong writings that can mess up field 'next' */ 19 | #define gkey(n) cast(const TValue*, (&(n)->i_key.tvk)) 20 | 21 | #define wgkey(n) (&(n)->i_key.nk) 22 | 23 | #define invalidateTMcache(t) ((t)->flags = 0) 24 | 25 | 26 | /* returns the key, given the value of a table entry */ 27 | #define keyfromval(v) \ 28 | (gkey(cast(Node *, cast(char *, (v)) - offsetof(Node, i_val)))) 29 | 30 | 31 | LUAI_FUNC const TValue *luaH_getint (Table *t, lua_Integer key); 32 | LUAI_FUNC void luaH_setint (lua_State *L, Table *t, lua_Integer key, 33 | TValue *value); 34 | LUAI_FUNC const TValue *luaH_getstr (Table *t, TString *key); 35 | LUAI_FUNC const TValue *luaH_get (Table *t, const TValue *key); 36 | LUAI_FUNC TValue *luaH_newkey (lua_State *L, Table *t, const TValue *key); 37 | LUAI_FUNC TValue *luaH_set (lua_State *L, Table *t, const TValue *key); 38 | LUAI_FUNC Table *luaH_new (lua_State *L); 39 | LUAI_FUNC void luaH_resize (lua_State *L, Table *t, unsigned int nasize, 40 | unsigned int nhsize); 41 | LUAI_FUNC void luaH_resizearray (lua_State *L, Table *t, unsigned int nasize); 42 | LUAI_FUNC void luaH_free (lua_State *L, Table *t); 43 | LUAI_FUNC int luaH_next (lua_State *L, Table *t, StkId key); 44 | LUAI_FUNC int luaH_getn (Table *t); 45 | 46 | 47 | #if defined(LUA_DEBUG) 48 | LUAI_FUNC Node *luaH_mainposition (const Table *t, const TValue *key); 49 | LUAI_FUNC int luaH_isdummy (Node *n); 50 | #endif 51 | 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /third_party/src/gtest/gtest_main.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2006, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | #include 31 | 32 | #include "gtest/gtest.h" 33 | 34 | GTEST_API_ int main(int argc, char **argv) { 35 | printf("Running main() from gtest_main.cc\n"); 36 | testing::InitGoogleTest(&argc, argv); 37 | return RUN_ALL_TESTS(); 38 | } 39 | -------------------------------------------------------------------------------- /src/editor/text_point.h: -------------------------------------------------------------------------------- 1 | #ifndef EDITOR_TEXT_POINT_H_ 2 | #define EDITOR_TEXT_POINT_H_ 3 | 4 | #include "wx/string.h" 5 | 6 | #include "editor/defs.h" 7 | 8 | namespace editor { 9 | 10 | class TextPoint { 11 | public: 12 | explicit TextPoint(Coord x_ = -1, Coord y_ = 0) 13 | : x(x_), y(y_) { 14 | } 15 | 16 | void Set(Coord x_, Coord y_) { 17 | x = x_; 18 | y = y_; 19 | } 20 | 21 | // Reset to an invalid text point. 22 | void Reset() { 23 | x = -1; 24 | y = 0; 25 | } 26 | 27 | bool Valid() const { 28 | return x >= 0 && y > 0; 29 | } 30 | 31 | wxString ToString() const { 32 | return wxString::Format(wxT("(%d, %d)"), x, y); 33 | } 34 | 35 | Coord x; // 0-based 36 | Coord y; // 1-based 37 | }; 38 | 39 | inline bool operator==(const TextPoint& lhs, const TextPoint& rhs) { 40 | return lhs.x == rhs.x && lhs.y == rhs.y; 41 | } 42 | 43 | inline bool operator!=(const TextPoint& lhs, const TextPoint& rhs) { 44 | return !(lhs == rhs); 45 | } 46 | 47 | bool operator<(const TextPoint& lhs, const TextPoint& rhs); 48 | 49 | inline bool operator>(const TextPoint& lhs, const TextPoint& rhs) { 50 | return !(lhs < rhs) && lhs != rhs; 51 | } 52 | 53 | inline bool operator<=(const TextPoint& lhs, const TextPoint& rhs) { 54 | return lhs < rhs || lhs == rhs; 55 | } 56 | 57 | inline bool operator>=(const TextPoint& lhs, const TextPoint& rhs) { 58 | return lhs > rhs || lhs == rhs; 59 | } 60 | 61 | inline TextPoint operator+(const TextPoint& lhs, const TextPoint& rhs) { 62 | return TextPoint(lhs.x + rhs.x, lhs.y + rhs.y); 63 | } 64 | 65 | inline TextPoint operator-(const TextPoint& lhs, const TextPoint& rhs) { 66 | return TextPoint(lhs.x - rhs.x, lhs.y - rhs.y); 67 | } 68 | 69 | inline TextPoint& operator+=(TextPoint& lhs, const TextPoint& rhs) { 70 | lhs.x += rhs.x; 71 | lhs.y += rhs.y; 72 | return lhs; 73 | } 74 | 75 | } // namespace editor 76 | 77 | #endif // EDITOR_TEXT_POINT_H_ 78 | -------------------------------------------------------------------------------- /src/jil/pref/global_font_page.h: -------------------------------------------------------------------------------- 1 | #ifndef JIL_PREF_GLOBAL_FONT_PAGE_H_ 2 | #define JIL_PREF_GLOBAL_FONT_PAGE_H_ 3 | 4 | #include 5 | #include 6 | 7 | #include "wx/panel.h" 8 | #include "wx/thread.h" 9 | 10 | #include "jil/defs.h" 11 | #include "jil/font_util.h" 12 | 13 | class wxButton; 14 | class wxComboBox; 15 | class wxListEvent; 16 | 17 | namespace ui { 18 | class BoldItemComboBox; 19 | class StringListCtrl; 20 | } // namespace ui 21 | 22 | namespace jil { 23 | 24 | class Options; 25 | 26 | namespace pref { 27 | 28 | class Global_FontPage : public wxPanel, public wxThreadHelper { 29 | DECLARE_EVENT_TABLE() 30 | 31 | public: 32 | explicit Global_FontPage(Options* options); 33 | 34 | ~Global_FontPage() override; 35 | 36 | bool Create(wxWindow* parent, wxWindowID id = wxID_ANY); 37 | 38 | bool TransferDataToWindow() override; 39 | bool TransferDataFromWindow() override; 40 | 41 | void EnumerateFonts(); 42 | 43 | protected: 44 | wxThread::ExitCode Entry() override; 45 | 46 | void OnThreadUpdate(wxThreadEvent& evt); 47 | 48 | void InitFonts(); 49 | void CreateControls(); 50 | void CreateTypeSection(wxSizer* top_vsizer); 51 | void CreateFontSection(wxSizer* top_vsizer); 52 | 53 | FontType GetSelectedFontType() const; 54 | 55 | void SetFontToWindow(const wxFont& font); 56 | 57 | void OnFontListSelectionChange(wxListEvent& evt); 58 | 59 | void OnNameComboBox(wxCommandEvent& evt); 60 | void OnSizeComboBox(wxCommandEvent& evt); 61 | void OnUseDefaultButton(wxCommandEvent& evt); 62 | 63 | private: 64 | Options* options_; 65 | 66 | wxFont fonts_[FONT_COUNT]; 67 | 68 | std::vector font_names_; 69 | 70 | ui::StringListCtrl* font_list_ctrl_; 71 | 72 | wxComboBox* name_combo_box_; 73 | wxComboBox* size_combo_box_; 74 | 75 | wxButton* use_default_button_; 76 | }; 77 | 78 | } // namespace pref 79 | } // namespace jil 80 | 81 | #endif // JIL_PREF_GLOBAL_FONT_PAGE_H_ 82 | -------------------------------------------------------------------------------- /src/ui/label.cc: -------------------------------------------------------------------------------- 1 | #include "ui/label.h" 2 | 3 | #include "wx/dcclient.h" 4 | 5 | namespace ui { 6 | 7 | BEGIN_EVENT_TABLE(Label, wxControl) 8 | EVT_PAINT(Label::OnPaint) 9 | EVT_LEFT_DOWN(Label::OnLeftDown) 10 | EVT_LEFT_UP(Label::OnLeftUp) 11 | END_EVENT_TABLE(); 12 | 13 | Label::Label(wxWindow* parent, wxWindowID id, const wxString& label) 14 | : wxControl(parent, id, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE) 15 | , accept_focus_(false) { 16 | SetBackgroundStyle(wxBG_STYLE_CUSTOM); 17 | SetBackgroundColour(parent->GetBackgroundColour()); 18 | 19 | SetLayoutDirection(wxLayout_LeftToRight); 20 | 21 | SetLabel(label); 22 | 23 | InitPadding(); 24 | } 25 | 26 | Label::~Label() { 27 | } 28 | 29 | void Label::InitPadding() { 30 | // Determine padding by char width. 31 | int cw = GetCharWidth(); 32 | padding_.Set(0, cw / 2); 33 | } 34 | 35 | wxSize Label::DoGetBestSize() const { 36 | wxSize best_size; 37 | GetTextExtent(GetLabel(), &best_size.x, &best_size.y); 38 | best_size.IncBy(padding_.x * 2, padding_.y * 2); 39 | return best_size; 40 | } 41 | 42 | void Label::OnPaint(wxPaintEvent& evt) { 43 | wxPaintDC dc(this); 44 | dc.SetBackground(GetBackgroundColour()); 45 | dc.Clear(); 46 | 47 | const wxRect client_rect = GetClientRect(); 48 | 49 | dc.SetTextForeground(GetForegroundColour()); 50 | dc.SetFont(GetFont()); 51 | 52 | wxRect label_rect = client_rect.Deflate(padding_.x, 0); 53 | dc.DrawLabel(GetLabel(), label_rect, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL); 54 | } 55 | 56 | void Label::OnLeftDown(wxMouseEvent& evt) { 57 | if (!HasCapture()) { 58 | CaptureMouse(); 59 | } 60 | } 61 | 62 | void Label::OnLeftUp(wxMouseEvent& evt) { 63 | if (HasCapture()) { 64 | ReleaseMouse(); 65 | } 66 | 67 | wxCommandEvent click_evt(wxEVT_BUTTON, GetId()); 68 | click_evt.SetEventObject(this); 69 | GetParent()->GetEventHandler()->AddPendingEvent(click_evt); 70 | } 71 | 72 | } // namespace ui 73 | -------------------------------------------------------------------------------- /data/jilfiles/ftplugin/cfg/indent.lua: -------------------------------------------------------------------------------- 1 | -- Indent function for Cfg (libconfig) 2 | 3 | cfg = cfg or {} 4 | 5 | cfg.indentByCurrLine = function(buffer, ln) 6 | local line = buffer:getLine(ln) 7 | 8 | if line:isCommentOnly() then 9 | return -1 10 | end 11 | 12 | local l_keys = { '{', '(', '[' } 13 | local r_keys = { '}', ')', ']' } 14 | 15 | for i = 1, 3 do 16 | local ok, x = line:startWith(true, true, r_keys[i]) 17 | if ok then 18 | local p = Point(x, ln) 19 | p = buffer:getUnpairedLeftKey(p, l_keys[i], r_keys[i]) 20 | if p:valid() then 21 | return buffer:getIndent(p.y) 22 | else 23 | return buffer:getPrevLineIndent(ln, true) 24 | end 25 | end 26 | end 27 | 28 | return -1 29 | end 30 | 31 | cfg.indentByPrevLine = function(buffer, ln) 32 | local prev_ln = buffer:getPrevNonEmptyLine(ln, true) 33 | if prev_ln == 0 then 34 | return 0 35 | end 36 | 37 | local tab_stop = buffer:getTabStop() 38 | 39 | local prev_line = buffer:getLine(prev_ln) 40 | if prev_line:endWith(true, true, '{', '(', '[') then 41 | return prev_line:getIndent(tab_stop) + tab_stop 42 | end 43 | 44 | return -1 45 | end 46 | 47 | cfg.indent = function(buffer, ln) 48 | local indent_size = cfg.indentByCurrLine(buffer, ln) 49 | if indent_size ~= -1 then 50 | return indent_size 51 | end 52 | 53 | local line = buffer:getLine(ln) 54 | if line:isCommentOnly() then 55 | local prev_ln = buffer:getPrevNonEmptyLine(ln, false) 56 | if prev_ln ~= 0 then 57 | local prev_line = buffer:getLine(prev_ln) 58 | if prev_line:isCommentOnly() then 59 | return prev_line:getIndent(buffer:getTabStop()) 60 | end 61 | end 62 | end 63 | 64 | indent_size = cfg.indentByPrevLine(buffer, ln) 65 | if indent_size ~= -1 then 66 | return indent_size 67 | end 68 | 69 | local prev_ln = buffer:getPrevNonEmptyLine(ln, true) 70 | return buffer:getIndent(prev_ln) 71 | end 72 | -------------------------------------------------------------------------------- /src/editor/theme.h: -------------------------------------------------------------------------------- 1 | #ifndef EDITOR_THEME_H_ 2 | #define EDITOR_THEME_H_ 3 | 4 | #include 5 | #include 6 | 7 | #include "wx/bitmap.h" 8 | #include "wx/colour.h" 9 | 10 | namespace editor { 11 | 12 | class Theme; 13 | typedef std::shared_ptr SharedTheme; 14 | 15 | class Theme { 16 | public: 17 | explicit Theme(std::size_t theme_size) : themes_(theme_size) { 18 | } 19 | 20 | Theme(std::size_t theme_size, std::size_t color_size, std::size_t image_size) 21 | : themes_(theme_size), colors_(color_size), images_(image_size) { 22 | } 23 | 24 | SharedTheme GetTheme(int id) const { 25 | assert(id >= 0 && id < theme_size()); 26 | return themes_[id]; 27 | } 28 | 29 | void SetTheme(int id, const SharedTheme& theme) { 30 | assert(id >= 0 && id < theme_size()); 31 | themes_[id] = theme; 32 | } 33 | 34 | const wxColour& GetColor(int id) const { 35 | assert(id >= 0 && id < color_size()); 36 | return colors_[id]; 37 | } 38 | 39 | // NOTE: Color could be invalid. 40 | void SetColor(int id, const wxColour& color) { 41 | assert(id >= 0 && id < color_size()); 42 | colors_[id] = color; 43 | } 44 | 45 | const wxBitmap& GetImage(int id) const { 46 | assert(id >= 0 && id < image_size()); 47 | return images_[id]; 48 | } 49 | 50 | void SetImage(int id, const wxBitmap& image) { 51 | assert(id >= 0 && id < image_size()); 52 | images_[id] = image; 53 | } 54 | 55 | 56 | private: 57 | int theme_size() const { 58 | return static_cast(themes_.size()); 59 | } 60 | 61 | int color_size() const { 62 | return static_cast(colors_.size()); 63 | } 64 | 65 | int image_size() const { 66 | return static_cast(images_.size()); 67 | } 68 | 69 | private: 70 | std::vector themes_; // Sub-themes 71 | std::vector colors_; 72 | std::vector images_; 73 | }; 74 | 75 | } // namespace editor 76 | 77 | #endif // EDITOR_THEME_H_ 78 | -------------------------------------------------------------------------------- /src/jil/pref/common.cc: -------------------------------------------------------------------------------- 1 | #include "jil/pref/common.h" 2 | 3 | #include "wx/combobox.h" 4 | #include "wx/sizer.h" 5 | #include "wx/statline.h" 6 | #include "wx/stattext.h" 7 | 8 | namespace jil { 9 | namespace pref { 10 | 11 | void UpdateFlag(int& flags, int flag, bool enable) { 12 | if (enable) { 13 | flags |= flag; 14 | } else { 15 | flags &= ~flag; 16 | } 17 | } 18 | 19 | int StrToInt(const wxString& str) { 20 | long i = 0; 21 | str.ToLong(&i); 22 | return static_cast(i); 23 | } 24 | 25 | int ValidateInt(int i, int min, int max) { 26 | if (i < min) { 27 | return min; 28 | } 29 | if (i > max) { 30 | return max; 31 | } 32 | return i; 33 | } 34 | 35 | wxStaticText* CreateStaticText(wxWindow* parent, const wxString& label, 36 | bool bold) { 37 | wxStaticText* static_text = new wxStaticText(parent, wxID_ANY, label); 38 | if (bold) { 39 | static_text->SetFont(static_text->GetFont().Bold()); 40 | } 41 | return static_text; 42 | } 43 | 44 | wxSizer* CreateSeparator(wxWindow* parent, const wxString& label, bool bold) { 45 | wxStaticText* static_text = CreateStaticText(parent, label, bold); 46 | wxStaticLine* sep = new wxStaticLine(parent); 47 | 48 | wxSizer* hsizer = new wxBoxSizer(wxHORIZONTAL); 49 | hsizer->Add(static_text, wxSizerFlags().Center()); 50 | hsizer->Add(sep, wxSizerFlags(1).Center().Border(wxLEFT)); 51 | return hsizer; 52 | } 53 | 54 | wxComboBox* CreateReadonlyComboBox(wxWindow* parent, wxWindowID id) { 55 | return new wxComboBox(parent, id, wxEmptyString, wxDefaultPosition, 56 | wxDefaultSize, 0, NULL, wxCB_READONLY); 57 | } 58 | 59 | wxTextCtrl* CreateTextCtrl(wxWindow* parent, wxWindowID id, const wxSize& size, 60 | const wxValidator& validator) { 61 | return new wxTextCtrl(parent, id, wxEmptyString, wxDefaultPosition, size, 62 | 0, validator); 63 | } 64 | 65 | } // namespace pref 66 | } // namespace jil 67 | -------------------------------------------------------------------------------- /third_party/src/lua/lzio.c: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lzio.c,v 1.36 2014/11/02 19:19:04 roberto Exp $ 3 | ** Buffered streams 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #define lzio_c 8 | #define LUA_CORE 9 | 10 | #include "lprefix.h" 11 | 12 | 13 | #include 14 | 15 | #include "lua.h" 16 | 17 | #include "llimits.h" 18 | #include "lmem.h" 19 | #include "lstate.h" 20 | #include "lzio.h" 21 | 22 | 23 | int luaZ_fill (ZIO *z) { 24 | size_t size; 25 | lua_State *L = z->L; 26 | const char *buff; 27 | lua_unlock(L); 28 | buff = z->reader(L, z->data, &size); 29 | lua_lock(L); 30 | if (buff == NULL || size == 0) 31 | return EOZ; 32 | z->n = size - 1; /* discount char being returned */ 33 | z->p = buff; 34 | return cast_uchar(*(z->p++)); 35 | } 36 | 37 | 38 | void luaZ_init (lua_State *L, ZIO *z, lua_Reader reader, void *data) { 39 | z->L = L; 40 | z->reader = reader; 41 | z->data = data; 42 | z->n = 0; 43 | z->p = NULL; 44 | } 45 | 46 | 47 | /* --------------------------------------------------------------- read --- */ 48 | size_t luaZ_read (ZIO *z, void *b, size_t n) { 49 | while (n) { 50 | size_t m; 51 | if (z->n == 0) { /* no bytes in buffer? */ 52 | if (luaZ_fill(z) == EOZ) /* try to read more */ 53 | return n; /* no more input; return number of missing bytes */ 54 | else { 55 | z->n++; /* luaZ_fill consumed first byte; put it back */ 56 | z->p--; 57 | } 58 | } 59 | m = (n <= z->n) ? n : z->n; /* min. between n and z->n */ 60 | memcpy(b, z->p, m); 61 | z->n -= m; 62 | z->p += m; 63 | b = (char *)b + m; 64 | n -= m; 65 | } 66 | return 0; 67 | } 68 | 69 | /* ------------------------------------------------------------------------ */ 70 | char *luaZ_openspace (lua_State *L, Mbuffer *buff, size_t n) { 71 | if (n > buff->buffsize) { 72 | if (n < LUA_MINBUFFER) n = LUA_MINBUFFER; 73 | luaZ_resizebuffer(L, buff, n); 74 | } 75 | return buff->buffer; 76 | } 77 | 78 | 79 | -------------------------------------------------------------------------------- /third_party/src/lua/linit.c: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: linit.c,v 1.38 2015/01/05 13:48:33 roberto Exp $ 3 | ** Initialization of libraries for lua.c and other clients 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | 8 | #define linit_c 9 | #define LUA_LIB 10 | 11 | /* 12 | ** If you embed Lua in your program and need to open the standard 13 | ** libraries, call luaL_openlibs in your program. If you need a 14 | ** different set of libraries, copy this file to your project and edit 15 | ** it to suit your needs. 16 | ** 17 | ** You can also *preload* libraries, so that a later 'require' can 18 | ** open the library, which is already linked to the application. 19 | ** For that, do the following code: 20 | ** 21 | ** luaL_getsubtable(L, LUA_REGISTRYINDEX, "_PRELOAD"); 22 | ** lua_pushcfunction(L, luaopen_modname); 23 | ** lua_setfield(L, -2, modname); 24 | ** lua_pop(L, 1); // remove _PRELOAD table 25 | */ 26 | 27 | #include "lprefix.h" 28 | 29 | 30 | #include 31 | 32 | #include "lua.h" 33 | 34 | #include "lualib.h" 35 | #include "lauxlib.h" 36 | 37 | 38 | /* 39 | ** these libs are loaded by lua.c and are readily available to any Lua 40 | ** program 41 | */ 42 | static const luaL_Reg loadedlibs[] = { 43 | {"_G", luaopen_base}, 44 | {LUA_LOADLIBNAME, luaopen_package}, 45 | {LUA_COLIBNAME, luaopen_coroutine}, 46 | {LUA_TABLIBNAME, luaopen_table}, 47 | {LUA_IOLIBNAME, luaopen_io}, 48 | {LUA_OSLIBNAME, luaopen_os}, 49 | {LUA_STRLIBNAME, luaopen_string}, 50 | {LUA_MATHLIBNAME, luaopen_math}, 51 | {LUA_UTF8LIBNAME, luaopen_utf8}, 52 | {LUA_DBLIBNAME, luaopen_debug}, 53 | #if defined(LUA_COMPAT_BITLIB) 54 | {LUA_BITLIBNAME, luaopen_bit32}, 55 | #endif 56 | {NULL, NULL} 57 | }; 58 | 59 | 60 | LUALIB_API void luaL_openlibs (lua_State *L) { 61 | const luaL_Reg *lib; 62 | /* "require" functions from 'loadedlibs' and set results to global table */ 63 | for (lib = loadedlibs; lib->func; lib++) { 64 | luaL_requiref(L, lib->name, lib->func, 1); 65 | lua_pop(L, 1); /* remove lib */ 66 | } 67 | } 68 | 69 | -------------------------------------------------------------------------------- /src/editor/file_io.cc: -------------------------------------------------------------------------------- 1 | #include "editor/file_io.h" 2 | 3 | #include "wx/defs.h" 4 | #include "wx/wxcrt.h" 5 | 6 | namespace editor { 7 | 8 | int ReadBytes(const wxString& filename, std::string* bytes, 9 | std::size_t max_bytes) { 10 | // If we don't use binary mode to read text files, line ending characters 11 | // might be "lost". Suppose there's a file with the following text: 12 | // abc\r\nde\r\nf 13 | // The file size told by ftell() is 10, but fread() can only read 8. 14 | // So we use binary mode. 15 | FILE* file = wxFopen(filename, _T("rb")); 16 | if (file == NULL) { 17 | return 1; 18 | } 19 | 20 | fseek(file, 0, SEEK_END); 21 | long fsize = ftell(file); 22 | if (fsize == -1) { 23 | fclose(file); 24 | return 1; 25 | } 26 | if (fsize == 0) { 27 | fclose(file); 28 | return 0; 29 | } 30 | 31 | rewind(file); 32 | 33 | int result = 0; 34 | 35 | std::size_t count = static_cast(fsize); 36 | 37 | if (max_bytes != std::string::npos) { 38 | // Limit bytes. 39 | if (count > max_bytes) { 40 | count = max_bytes; 41 | result = 2; 42 | } 43 | } 44 | 45 | bytes->resize(count); 46 | std::size_t read_size = fread(&(*bytes)[0], 1, count, file); 47 | if (read_size != count) { 48 | result = 1; 49 | } 50 | 51 | fclose(file); 52 | 53 | return result; 54 | } 55 | 56 | int SaveBytes(const wxString& filename, const char* bom, 57 | const std::string& bytes) { 58 | FILE* file = wxFopen(filename, wxT("wb")); 59 | if (file == NULL) { 60 | return 1; 61 | } 62 | 63 | int result = 0; 64 | 65 | if (bom != NULL) { 66 | std::size_t bom_len = strlen(bom); 67 | if (fwrite(bom, 1, bom_len, file) != bom_len) { 68 | fclose(file); 69 | return 1; 70 | } 71 | } 72 | 73 | std::size_t write_size = fwrite(bytes.c_str(), 1, bytes.size(), file); 74 | if (write_size != bytes.size()) { 75 | result = 1; 76 | } 77 | 78 | fclose(file); 79 | return result; 80 | } 81 | 82 | } // namespace editor 83 | -------------------------------------------------------------------------------- /src/jil/find_thread.h: -------------------------------------------------------------------------------- 1 | #ifndef JIL_FIND_THREAD_H_ 2 | #define JIL_FIND_THREAD_H_ 3 | 4 | #include "wx/arrstr.h" 5 | #include "wx/thread.h" 6 | 7 | namespace jil { 8 | 9 | class BookFrame; 10 | 11 | //////////////////////////////////////////////////////////////////////////////// 12 | 13 | class FindThreadBase : public wxThread { 14 | public: 15 | FindThreadBase(BookFrame* book_frame, 16 | const std::wstring& str, 17 | int flags); 18 | 19 | virtual ~FindThreadBase(); 20 | 21 | // TODO: Avoid copy. 22 | void set_files(const wxArrayString& files) { 23 | files_ = files; 24 | } 25 | 26 | bool IsReplace() const; 27 | 28 | protected: 29 | virtual ExitCode Entry() override; 30 | 31 | virtual int HandleFile(const wxString& file) = 0; 32 | 33 | void QueueEvent(int ivalue, const wxString& file); 34 | 35 | protected: 36 | BookFrame* book_frame_; 37 | 38 | std::wstring str_; // The string to find. 39 | int flags_; // Find flags. 40 | wxArrayString files_; // The files in which to find. 41 | 42 | int event_id_; 43 | }; 44 | 45 | //////////////////////////////////////////////////////////////////////////////// 46 | 47 | class FindThread : public FindThreadBase { 48 | public: 49 | FindThread(BookFrame* book_frame, 50 | const std::wstring& str, 51 | int flags); 52 | 53 | virtual ~FindThread(); 54 | 55 | protected: 56 | virtual int HandleFile(const wxString& file) override; 57 | }; 58 | 59 | //////////////////////////////////////////////////////////////////////////////// 60 | 61 | class ReplaceThread : public FindThreadBase { 62 | public: 63 | ReplaceThread(BookFrame* book_frame, 64 | const std::wstring& str, 65 | const std::wstring& replace_str, 66 | int flags); 67 | 68 | virtual ~ReplaceThread(); 69 | 70 | protected: 71 | virtual int HandleFile(const wxString& file) override; 72 | 73 | private: 74 | std::wstring replace_str_; 75 | }; 76 | 77 | } // namespace jil 78 | 79 | #endif // JIL_FIND_THREAD_H_ 80 | -------------------------------------------------------------------------------- /src/editor/renderer.h: -------------------------------------------------------------------------------- 1 | #ifndef EDITOR_RENDERER_H_ 2 | #define EDITOR_RENDERER_H_ 3 | 4 | #include 5 | 6 | #include "wx/brush.h" 7 | #include "wx/colour.h" 8 | #include "wx/font.h" 9 | #include "wx/gdicmn.h" 10 | #include "wx/pen.h" 11 | 12 | #include "editor/defs.h" 13 | 14 | class wxDC; 15 | 16 | namespace editor { 17 | 18 | class Renderer { 19 | public: 20 | explicit Renderer(wxDC* dc); 21 | ~Renderer(); 22 | 23 | void SetFont(const wxFont& font); 24 | 25 | void SetTextForeground(const wxColour& fg); 26 | void SetTextBackground(const wxColour& bg); 27 | 28 | const wxBrush& GetBrush() const; 29 | void SetBrush(const wxBrush& brush, bool backup); 30 | 31 | const wxPen& GetPen() const; 32 | void SetPen(const wxPen& pen, bool backup); 33 | 34 | void SetStyle(const wxBrush& brush, const wxPen& pen, bool backup); 35 | 36 | void SetStyle(const wxColour& brush_color, const wxColour& pen_color, 37 | bool backup); 38 | 39 | void BackupBrush(); 40 | void RestoreBrush(); 41 | 42 | void BackupPen(); 43 | void RestorePen(); 44 | 45 | void BackupStyle(); 46 | void RestoreStyle(); 47 | 48 | void DrawText(const std::wstring& text, Coord off, Coord len, int x, int y, 49 | int* w = NULL); 50 | 51 | void DrawLine(int x1, int y1, int x2, int y2); 52 | 53 | inline void DrawLineH(int x1, int x2, int y) { 54 | DrawLine(x1, y, x2, y); 55 | } 56 | 57 | inline void DrawLineV(int x, int y1, int y2) { 58 | DrawLine(x, y1, x, y2); 59 | } 60 | 61 | void DrawRectangle(int x, int y, int w, int h); 62 | void DrawRectangle(const wxRect& rect); 63 | void DrawRoundedRectangle(const wxRect& rect, double radius); 64 | 65 | void DrawWhiteSpaces(int x, int y, Coord count = 1, int* w = NULL); 66 | void DrawTab(int x, int y, int w, int h); 67 | 68 | private: 69 | void UpdateCharSize(); 70 | 71 | private: 72 | wxDC* dc_; 73 | wxSize char_size_; 74 | 75 | // Backups. 76 | wxBrush brush_; 77 | wxPen pen_; 78 | }; 79 | 80 | } // namespace editor 81 | 82 | #endif // EDITOR_RENDERER_H_ 83 | -------------------------------------------------------------------------------- /src/editor_unittest/indent_test_base.cc: -------------------------------------------------------------------------------- 1 | #include "editor_unittest/indent_test_base.h" 2 | 3 | using namespace editor; 4 | 5 | static const Encoding kEncoding = GetEncodingById(ENCODING_ISO_8859_1); 6 | 7 | lua_State* IndentTestBase::lua_state; 8 | FtPlugin* IndentTestBase::ft_plugin; 9 | 10 | void IndentTestBase::LoadLua() { 11 | lua_state = luaL_newstate(); 12 | luaL_openlibs(lua_state); 13 | InitLua(lua_state); 14 | } 15 | 16 | void IndentTestBase::SetTextOptions(bool expand_tab, int tab_stop) { 17 | TextOptions text_options; 18 | 19 | text_options.expand_tab = expand_tab; 20 | text_options.tab_stop = tab_stop; 21 | 22 | text_options.delimiters = L"!@#%^$&*()+-=\\|/?[]{}<>,.;:'\"`~"; 23 | 24 | ft_plugin->set_text_options(text_options); 25 | } 26 | 27 | void IndentTestBase::LoadIndentFunc(const wxString& ft_id) { 28 | // TODO 29 | // jil/build/src/editor 30 | wxString ftplugin_dir = wxT("../../../data/jilfiles/ftplugin/") + ft_id; 31 | 32 | wxString cwd = wxGetCwd(); 33 | wxSetWorkingDirectory(ftplugin_dir); 34 | 35 | std::string err; 36 | if (LoadLuaFile(lua_state, wxT("indent.lua"), &err)) { 37 | std::string ns = ft_id.ToAscii().data(); 38 | luabridge::LuaRef indent_func = GetLuaValue(lua_state, ns.c_str(), "indent"); 39 | ft_plugin->set_indent_func(indent_func); 40 | } 41 | 42 | wxSetWorkingDirectory(cwd); 43 | } 44 | 45 | void IndentTestBase::StaticSetUp(const FileType& ft) { 46 | LoadLua(); 47 | ft_plugin = new FtPlugin(ft, lua_state); 48 | LoadIndentFunc(ft.id); 49 | } 50 | 51 | void IndentTestBase::StaticTearDown() { 52 | delete ft_plugin; 53 | lua_close(lua_state); 54 | } 55 | 56 | void IndentTestBase::SetUp() { 57 | buffer_ = new TextBuffer(0, ft_plugin, kEncoding); 58 | } 59 | 60 | void IndentTestBase::TearDown() { 61 | delete buffer_; 62 | } 63 | 64 | int IndentTestBase::GetExpectedIndent(int ln) { 65 | const luabridge::LuaRef& indent_func = ft_plugin->indent_func(); 66 | if (indent_func.isNil() || !indent_func.isFunction()) { 67 | return 0; 68 | } 69 | return indent_func(buffer_, ln); 70 | } 71 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Jil Text 2 | 3 | **NOTE: This project is only for study purpose and it's dead. I will not push any update. Sorry!** 4 | 5 | Yet another text editor developed with C++ and wxWidgets. 6 | 7 | ![alt main_window](doc/screenshots/main.png) 8 | 9 | ## Advantages 10 | 11 | * Cross platform (Windows, Linux and Mac). 12 | * Intuitive and beautiful interface. 13 | * Low memory usage, super fast. 14 | * GUI based configuration: support both global and file type specific options. 15 | * Extensible indent functions using Lua script. 16 | 17 | ## Disadvantages 18 | 19 | * No plugin support. 20 | * No resources, no documentation. 21 | 22 | ## Build Instructions 23 | 24 | The build system of Jil Text is based on CMake, with which you can generate Visual Studio solution, XCode project or Unix makefiles. 25 | 26 | ### Linux (Ubuntu) 27 | 28 | **CMake** 29 | 30 | ``` 31 | $ sudo apt install cmake cmake-qt-gui 32 | ``` 33 | The GUI version "cmake-qt-gui" is optional. 34 | 35 | **C++ Boost Library** 36 | ``` 37 | $ sudo apt install libboost-dev 38 | ``` 39 | 40 | **wxWidgets** 41 | 42 | Install with apt: 43 | ``` 44 | $ sudo apt install libwxgtk3.0-dev 45 | ``` 46 | Or download the source code and build it yourself: 47 | ``` 48 | $ ./configure --with-gtk=3 --disable-shared 49 | $ make 50 | $ sudo make install 51 | ``` 52 | 53 | **Generate Makefiles** 54 | 55 | Suppose the source code is cloned to ~/jil, create a build directory next to it: 56 | ``` 57 | $ mkdir ~/jilbuild 58 | ``` 59 | 60 | Generate Unix makefiles with CMake: 61 | ``` 62 | $ cd ~/jilbuild 63 | $ cmake -G"Unix Makefiles" -DCMAKE_INSTALL_PREFIX=~/jilbuild/src/app ../jil 64 | ``` 65 | 66 | **Build & Install** 67 | 68 | Now build it with make: 69 | 70 | ``` 71 | $ make 72 | ``` 73 | 74 | Note that CMAKE_INSTALL_PREFIX is set to the directory where the executable file is located. The resource files will also be installed to this directory by: 75 | ``` 76 | $ make install 77 | ``` 78 | 79 | You may want to create a symbolic link in ~/bin to the executable: 80 | ``` 81 | $ ln -s ~/jilbuild/src/app/jil ~/bin/jil 82 | ``` 83 | 84 | -------------------------------------------------------------------------------- /third_party/src/lua/ltm.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: ltm.h,v 2.21 2014/10/25 11:50:46 roberto Exp $ 3 | ** Tag methods 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef ltm_h 8 | #define ltm_h 9 | 10 | 11 | #include "lobject.h" 12 | 13 | 14 | /* 15 | * WARNING: if you change the order of this enumeration, 16 | * grep "ORDER TM" and "ORDER OP" 17 | */ 18 | typedef enum { 19 | TM_INDEX, 20 | TM_NEWINDEX, 21 | TM_GC, 22 | TM_MODE, 23 | TM_LEN, 24 | TM_EQ, /* last tag method with fast access */ 25 | TM_ADD, 26 | TM_SUB, 27 | TM_MUL, 28 | TM_MOD, 29 | TM_POW, 30 | TM_DIV, 31 | TM_IDIV, 32 | TM_BAND, 33 | TM_BOR, 34 | TM_BXOR, 35 | TM_SHL, 36 | TM_SHR, 37 | TM_UNM, 38 | TM_BNOT, 39 | TM_LT, 40 | TM_LE, 41 | TM_CONCAT, 42 | TM_CALL, 43 | TM_N /* number of elements in the enum */ 44 | } TMS; 45 | 46 | 47 | 48 | #define gfasttm(g,et,e) ((et) == NULL ? NULL : \ 49 | ((et)->flags & (1u<<(e))) ? NULL : luaT_gettm(et, e, (g)->tmname[e])) 50 | 51 | #define fasttm(l,et,e) gfasttm(G(l), et, e) 52 | 53 | #define ttypename(x) luaT_typenames_[(x) + 1] 54 | #define objtypename(x) ttypename(ttnov(x)) 55 | 56 | LUAI_DDEC const char *const luaT_typenames_[LUA_TOTALTAGS]; 57 | 58 | 59 | LUAI_FUNC const TValue *luaT_gettm (Table *events, TMS event, TString *ename); 60 | LUAI_FUNC const TValue *luaT_gettmbyobj (lua_State *L, const TValue *o, 61 | TMS event); 62 | LUAI_FUNC void luaT_init (lua_State *L); 63 | 64 | LUAI_FUNC void luaT_callTM (lua_State *L, const TValue *f, const TValue *p1, 65 | const TValue *p2, TValue *p3, int hasres); 66 | LUAI_FUNC int luaT_callbinTM (lua_State *L, const TValue *p1, const TValue *p2, 67 | StkId res, TMS event); 68 | LUAI_FUNC void luaT_trybinTM (lua_State *L, const TValue *p1, const TValue *p2, 69 | StkId res, TMS event); 70 | LUAI_FUNC int luaT_callorderTM (lua_State *L, const TValue *p1, 71 | const TValue *p2, TMS event); 72 | 73 | 74 | 75 | #endif 76 | -------------------------------------------------------------------------------- /src/jil/book_page.h: -------------------------------------------------------------------------------- 1 | #ifndef JIL_BOOK_PAGE_H_ 2 | #define JIL_BOOK_PAGE_H_ 3 | 4 | #include "wx/string.h" 5 | 6 | class wxMenu; 7 | class wxWindow; 8 | 9 | namespace jil { 10 | 11 | //////////////////////////////////////////////////////////////////////////////// 12 | 13 | // Page interface of book ctrl. 14 | class BookPage { 15 | public: 16 | enum Flag { 17 | kModified = 1, 18 | kNewCreated = 2, 19 | }; 20 | 21 | virtual ~BookPage() { 22 | } 23 | 24 | // NOTE: Prefix "Page_" is added to avoid name conflict. 25 | 26 | virtual bool Page_HasFocus() const = 0; 27 | virtual void Page_SetFocus() = 0; 28 | 29 | // Activate/deactivate this page. 30 | virtual void Page_Activate(bool active) = 0; 31 | 32 | // Close this page (also destroy the window). 33 | virtual void Page_Close() = 0; 34 | 35 | // Page type ID. 36 | virtual int Page_Type() const = 0; 37 | 38 | // Page label displayed in tab. 39 | virtual wxString Page_Label() const = 0; 40 | 41 | // Page description displayed, e.g., in tab tooltip. 42 | virtual wxString Page_Description() const { 43 | return wxEmptyString; 44 | } 45 | 46 | // See enum Flag. 47 | virtual int Page_Flags() const { 48 | return 0; 49 | } 50 | 51 | // Add menu items to the edit menu. 52 | // Different pages might have different edit menu items. 53 | // E.g., text page has Undo and Redo while find result page doesn't. 54 | virtual void Page_EditMenu(wxMenu* menu) = 0; 55 | 56 | // Get the enable state of the edit menu item. 57 | virtual bool Page_EditMenuState(int menu_id) = 0; 58 | 59 | // Get the enable state of the file menu item. 60 | virtual bool Page_FileMenuState(int menu_id) = 0; 61 | 62 | // Handle the menu event. 63 | virtual bool Page_OnMenu(int menu_id) = 0; 64 | 65 | virtual bool Page_Save() = 0; 66 | 67 | bool Page_IsModified() const { 68 | return (Page_Flags() & kModified) != 0; 69 | } 70 | 71 | bool Page_IsNewCreated() const { 72 | return (Page_Flags() & kNewCreated) != 0; 73 | } 74 | }; 75 | 76 | } // namespace jil 77 | 78 | #endif // JIL_BOOK_PAGE_H_ 79 | -------------------------------------------------------------------------------- /third_party/src/lua/lvm.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lvm.h,v 2.34 2014/08/01 17:24:02 roberto Exp $ 3 | ** Lua virtual machine 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef lvm_h 8 | #define lvm_h 9 | 10 | 11 | #include "ldo.h" 12 | #include "lobject.h" 13 | #include "ltm.h" 14 | 15 | 16 | #if !defined(LUA_NOCVTN2S) 17 | #define cvt2str(o) ttisnumber(o) 18 | #else 19 | #define cvt2str(o) 0 /* no conversion from numbers to strings */ 20 | #endif 21 | 22 | 23 | #if !defined(LUA_NOCVTS2N) 24 | #define cvt2num(o) ttisstring(o) 25 | #else 26 | #define cvt2num(o) 0 /* no conversion from strings to numbers */ 27 | #endif 28 | 29 | 30 | #define tonumber(o,n) \ 31 | (ttisfloat(o) ? (*(n) = fltvalue(o), 1) : luaV_tonumber_(o,n)) 32 | 33 | #define tointeger(o,i) \ 34 | (ttisinteger(o) ? (*(i) = ivalue(o), 1) : luaV_tointeger_(o,i)) 35 | 36 | #define intop(op,v1,v2) l_castU2S(l_castS2U(v1) op l_castS2U(v2)) 37 | 38 | #define luaV_rawequalobj(t1,t2) luaV_equalobj(NULL,t1,t2) 39 | 40 | 41 | LUAI_FUNC int luaV_equalobj (lua_State *L, const TValue *t1, const TValue *t2); 42 | LUAI_FUNC int luaV_lessthan (lua_State *L, const TValue *l, const TValue *r); 43 | LUAI_FUNC int luaV_lessequal (lua_State *L, const TValue *l, const TValue *r); 44 | LUAI_FUNC int luaV_tonumber_ (const TValue *obj, lua_Number *n); 45 | LUAI_FUNC int luaV_tointeger_ (const TValue *obj, lua_Integer *p); 46 | LUAI_FUNC void luaV_gettable (lua_State *L, const TValue *t, TValue *key, 47 | StkId val); 48 | LUAI_FUNC void luaV_settable (lua_State *L, const TValue *t, TValue *key, 49 | StkId val); 50 | LUAI_FUNC void luaV_finishOp (lua_State *L); 51 | LUAI_FUNC void luaV_execute (lua_State *L); 52 | LUAI_FUNC void luaV_concat (lua_State *L, int total); 53 | LUAI_FUNC lua_Integer luaV_div (lua_State *L, lua_Integer x, lua_Integer y); 54 | LUAI_FUNC lua_Integer luaV_mod (lua_State *L, lua_Integer x, lua_Integer y); 55 | LUAI_FUNC lua_Integer luaV_shiftl (lua_Integer x, lua_Integer y); 56 | LUAI_FUNC void luaV_objlen (lua_State *L, StkId ra, const TValue *rb); 57 | 58 | #endif 59 | -------------------------------------------------------------------------------- /third_party/src/libconfig/strbuf.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------------- 2 | libconfig - A library for processing structured configuration files 3 | Copyright (C) 2005-2010 Mark A Lindner 4 | 5 | This file is part of libconfig. 6 | 7 | This library is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU Lesser General Public License 9 | as published by the Free Software Foundation; either version 2.1 of 10 | the License, or (at your option) any later version. 11 | 12 | This library is distributed in the hope that it will be useful, but 13 | WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | Lesser General Public License for more details. 16 | 17 | You should have received a copy of the GNU Library General Public 18 | License along with this library; if not, see 19 | . 20 | ---------------------------------------------------------------------------- 21 | */ 22 | 23 | #include "strbuf.h" 24 | 25 | #include 26 | #include 27 | 28 | #define STRING_BLOCK_SIZE 64 29 | 30 | /* ------------------------------------------------------------------------- */ 31 | 32 | char *strbuf_release(strbuf_t *buf) 33 | { 34 | char *r = buf->string; 35 | memset(buf, 0, sizeof(strbuf_t)); 36 | return(r); 37 | } 38 | 39 | /* ------------------------------------------------------------------------- */ 40 | 41 | void strbuf_append(strbuf_t *buf, const char *text) 42 | { 43 | static const size_t mask = ~(STRING_BLOCK_SIZE - 1); 44 | size_t len = strlen(text); 45 | size_t newlen = buf->length + len + 1; /* add 1 for NUL */ 46 | 47 | if(newlen > buf->capacity) 48 | { 49 | buf->capacity = (newlen + (STRING_BLOCK_SIZE - 1)) & mask; 50 | buf->string = (char *)realloc(buf->string, buf->capacity); 51 | } 52 | 53 | strcpy(buf->string + buf->length, text); 54 | buf->length += len; 55 | } 56 | 57 | /* ------------------------------------------------------------------------- */ 58 | /* eof */ 59 | -------------------------------------------------------------------------------- /third_party/src/uchardet/prmem.h: -------------------------------------------------------------------------------- 1 | /* ***** BEGIN LICENSE BLOCK ***** 2 | * Version: MPL 1.1/GPL 2.0/LGPL 2.1 3 | * 4 | * The contents of this file are subject to the Mozilla Public License Version 5 | * 1.1 (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * http://www.mozilla.org/MPL/ 8 | * 9 | * Software distributed under the License is distributed on an "AS IS" basis, 10 | * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 11 | * for the specific language governing rights and limitations under the 12 | * License. 13 | * 14 | * The Original Code is Mozilla Universal charset detector code. 15 | * 16 | * The Initial Developer of the Original Code is 17 | * Netscape Communications Corporation. 18 | * Portions created by the Initial Developer are Copyright (C) 2001 19 | * the Initial Developer. All Rights Reserved. 20 | * 21 | * Contributor(s): 22 | * Kohei TAKETA 23 | * 24 | * Alternatively, the contents of this file may be used under the terms of 25 | * either the GNU General Public License Version 2 or later (the "GPL"), or 26 | * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), 27 | * in which case the provisions of the GPL or the LGPL are applicable instead 28 | * of those above. If you wish to allow use of your version of this file only 29 | * under the terms of either the GPL or the LGPL, and not to allow others to 30 | * use your version of this file under the terms of the MPL, indicate your 31 | * decision by deleting the provisions above and replace them with the notice 32 | * and other provisions required by the GPL or the LGPL. If you do not delete 33 | * the provisions above, a recipient may use your version of this file under 34 | * the terms of any one of the MPL, the GPL or the LGPL. 35 | * 36 | * ***** END LICENSE BLOCK ***** */ 37 | #ifndef nsDummyPrmem_h__ 38 | #define nsDummyPrmem_h__ 39 | 40 | #include 41 | 42 | inline void* PR_Malloc(size_t len) 43 | { 44 | return malloc(len); 45 | } 46 | 47 | #define PR_FREEIF(p) if (p) free(p) 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /src/ui/static_box.cc: -------------------------------------------------------------------------------- 1 | #include "ui/static_box.h" 2 | 3 | #include "wx/dcclient.h" 4 | #include "wx/sizer.h" 5 | 6 | namespace ui { 7 | 8 | static const wxColour kBorderColour(213, 223, 229); 9 | 10 | BEGIN_EVENT_TABLE(StaticBox, wxPanel) 11 | EVT_PAINT(StaticBox::OnPaint) 12 | END_EVENT_TABLE() 13 | 14 | StaticBox::StaticBox(wxWindow* parent, const wxString& label) 15 | : wxPanel(parent, wxID_ANY) 16 | , border_colour_(kBorderColour) { 17 | SetLabel(label); 18 | 19 | SetBackgroundColour(parent->GetBackgroundColour()); 20 | SetBackgroundStyle(wxBG_STYLE_PAINT); 21 | 22 | padding_.x = GetCharHeight() * 0.7; 23 | padding_.y = padding_.x; 24 | } 25 | 26 | StaticBox::~StaticBox() { 27 | } 28 | 29 | void StaticBox::SetBodySizer(wxSizer* body_sizer) { 30 | wxSizer* vsizer = new wxBoxSizer(wxVERTICAL); 31 | 32 | if (GetLabel().IsEmpty()) { 33 | vsizer->AddSpacer(padding_.y); 34 | } else { 35 | vsizer->AddSpacer(GetCharHeight() + padding_.y); 36 | } 37 | 38 | vsizer->Add(body_sizer, 1, wxEXPAND | wxLEFT | wxRIGHT, padding_.x); 39 | 40 | vsizer->AddSpacer(padding_.y); 41 | 42 | SetSizer(vsizer); 43 | } 44 | 45 | void StaticBox::OnPaint(wxPaintEvent& evt) { 46 | wxPaintDC dc(this); 47 | dc.SetBackground(GetBackgroundColour()); 48 | dc.Clear(); 49 | 50 | wxString label = GetLabel(); 51 | 52 | dc.SetPen(wxPen(border_colour_)); 53 | dc.SetBrush(*wxTRANSPARENT_BRUSH); 54 | 55 | wxRect border_rect = GetClientRect(); 56 | 57 | if (!label.IsEmpty()) { 58 | int half_char_height = GetCharHeight() / 2; 59 | border_rect.y += half_char_height; 60 | border_rect.height -= half_char_height; 61 | } 62 | 63 | dc.DrawRoundedRectangle(border_rect, 3.0f); 64 | 65 | if (!label.IsEmpty()) { 66 | // Draw a rect to erase the border line under the label. 67 | int w = 0; 68 | int h = 0; 69 | dc.GetTextExtent(label, &w, &h); 70 | 71 | dc.SetPen(*wxTRANSPARENT_PEN); 72 | dc.SetBrush(wxBrush(GetBackgroundColour())); 73 | 74 | dc.DrawRectangle(padding_.x - 3, 0, w + 6, h); 75 | 76 | // Draw the label. 77 | dc.DrawText(label, padding_.x, 0); 78 | } 79 | } 80 | 81 | } // namespace ui 82 | -------------------------------------------------------------------------------- /src/ui/bitmap_button_base.cc: -------------------------------------------------------------------------------- 1 | #include "ui/bitmap_button_base.h" 2 | 3 | #include "wx/dcbuffer.h" 4 | 5 | #include "ui/util.h" 6 | 7 | namespace ui { 8 | 9 | IMPLEMENT_CLASS(BitmapButtonBase, ButtonBase); 10 | 11 | BitmapButtonBase::BitmapButtonBase(SharedButtonStyle style) 12 | : ButtonBase(style) { 13 | } 14 | 15 | BitmapButtonBase::~BitmapButtonBase() { 16 | } 17 | 18 | bool BitmapButtonBase::Create(wxWindow* parent, wxWindowID id) { 19 | if (!ButtonBase::Create(parent, id)) { 20 | return false; 21 | } 22 | 23 | return true; 24 | } 25 | 26 | void BitmapButtonBase::SetBitmaps(const wxBitmap& normal, 27 | const wxBitmap& hover, 28 | const wxBitmap& pressed, 29 | const wxBitmap& disabled) { 30 | bitmaps_[ButtonStyle::NORMAL] = normal; 31 | bitmaps_[ButtonStyle::HOVER] = hover; 32 | bitmaps_[ButtonStyle::PRESSED] = pressed; 33 | bitmaps_[ButtonStyle::DISABLED] = disabled; 34 | } 35 | 36 | void BitmapButtonBase::SetBitmaps(const wxBitmap& bitmap) { 37 | SetBitmaps(bitmap, bitmap, bitmap, bitmap); 38 | } 39 | 40 | void BitmapButtonBase::SetBitmapsND(const wxBitmap& normal, 41 | const wxBitmap& disabled) { 42 | SetBitmaps(normal, normal, normal, disabled); 43 | } 44 | 45 | wxSize BitmapButtonBase::DoGetBestSize() const { 46 | wxSize best_size = GetBitmapSize(bitmaps_[ButtonStyle::NORMAL]); 47 | best_size.IncBy(2, 2); // For 1px border. 48 | 49 | if (min_size_ != wxDefaultSize) { 50 | if (best_size.x < min_size_.x) { 51 | best_size.x = min_size_.x; 52 | } 53 | if (best_size.y < min_size_.y) { 54 | best_size.y = min_size_.y; 55 | } 56 | } 57 | 58 | return best_size; 59 | } 60 | 61 | void BitmapButtonBase::DrawFg(wxDC& dc, ButtonStyle::State state) { 62 | const wxBitmap& bitmap = bitmaps_[state]; 63 | if (bitmap.IsOk()) { 64 | wxRect rect = GetClientRect(); 65 | int x = (rect.GetWidth() - bitmap.GetWidth()) / 2; 66 | int y = (rect.GetHeight() - bitmap.GetHeight()) / 2; 67 | dc.DrawBitmap(bitmap, x, y, true); 68 | } 69 | } 70 | 71 | } // namespace ui 72 | -------------------------------------------------------------------------------- /src/jil/navigation_dialog.h: -------------------------------------------------------------------------------- 1 | #ifndef JIL_NAVIGATION_DIALOG_H_ 2 | #define JIL_NAVIGATION_DIALOG_H_ 3 | 4 | #include 5 | 6 | #include "wx/dialog.h" 7 | 8 | #include "editor/theme.h" 9 | 10 | #include "jil/defs.h" 11 | 12 | namespace jil { 13 | 14 | class TextPage; 15 | 16 | class NavigationDialog : public wxDialog, public WithPopupTheme { 17 | DECLARE_EVENT_TABLE() 18 | 19 | public: 20 | explicit NavigationDialog(const editor::SharedTheme& theme); 21 | 22 | virtual ~NavigationDialog(); 23 | 24 | bool Create(wxWindow* parent, wxWindowID id); 25 | 26 | // Override to adjust the client size before show. 27 | virtual int ShowModal() override; 28 | 29 | // \param forward Switch to next or previous stack page initially. 30 | void SetTextPages(const std::vector& text_pages, bool forward); 31 | 32 | void set_column_width(int column_width) { 33 | column_width_ = column_width; 34 | } 35 | 36 | void set_max_rows(int max_rows) { 37 | max_rows_ = max_rows; 38 | } 39 | 40 | std::size_t select_index() const { 41 | return select_index_; 42 | } 43 | 44 | protected: 45 | virtual bool DoNavigateIn(int flags) override; 46 | 47 | void OnPaint(wxPaintEvent& evt); 48 | void OnClose(wxCloseEvent& evt); 49 | void OnActivate(wxActivateEvent& evt); 50 | void OnMouseLeftUp(wxMouseEvent& evt); 51 | void OnMouseMotion(wxMouseEvent& evt); 52 | void OnKeyDown(wxKeyEvent& evt); 53 | void OnKeyUp(wxKeyEvent& evt); 54 | void OnNavigationKey(wxNavigationKeyEvent& evt); 55 | 56 | private: 57 | void AdjustSize(); 58 | 59 | std::size_t GetIndexByPos(const wxPoint& pos) const; 60 | 61 | private: 62 | editor::SharedTheme theme_; 63 | 64 | wxSize margin_; 65 | int col_gap_; 66 | 67 | // Active text pages. 68 | std::vector text_pages_; 69 | 70 | std::size_t select_index_; 71 | 72 | int column_width_; // In pixel 73 | 74 | // The max number of items displayed in one column. 75 | int max_rows_; 76 | 77 | wxFont title_font_; 78 | 79 | wxRect title_rect_; 80 | std::vector text_rects_; 81 | wxRect path_rect_; 82 | }; 83 | 84 | } // namespace jil 85 | 86 | #endif // JIL_NAVIGATION_DIALOG_H_ 87 | -------------------------------------------------------------------------------- /src/ui/string_list_ctrl.h: -------------------------------------------------------------------------------- 1 | #ifndef UI_STRING_LIST_CTRL_H_ 2 | #define UI_STRING_LIST_CTRL_H_ 3 | 4 | // NOTE: 5 | // StringListCtrl emits the same event class (wxListEvent) as wxListCtrl: 6 | // - Event types: wxEVT_LIST_ITEM_SELECTED, wxEVT_LIST_ITEM_DESELECTED 7 | // - Macros: EVT_LIST_ITEM_SELECTED, EVT_LIST_ITEM_DESELECTED 8 | 9 | #include 10 | 11 | #include "wx/scrolwin.h" 12 | 13 | namespace ui { 14 | 15 | class StringListCtrl : public wxScrolledWindow { 16 | DECLARE_EVENT_TABLE() 17 | 18 | public: 19 | enum ColorId { 20 | COLOR_BG = 0, 21 | COLOR_BG_HL, 22 | COLOR_FG, 23 | COLOR_FG_HL, 24 | COLOR_BORDER, 25 | COLOR_COUNT, 26 | }; 27 | 28 | public: 29 | StringListCtrl(); 30 | virtual ~StringListCtrl(); 31 | 32 | bool AcceptsFocus() const override { 33 | return true; 34 | } 35 | 36 | bool Create(wxWindow* parent, 37 | wxWindowID id, 38 | const wxSize& size = wxDefaultSize, 39 | long style = wxScrolledWindowStyle); 40 | 41 | const wxColour& GetColor(ColorId id) const { 42 | return colors_[id]; 43 | } 44 | 45 | void SetColor(ColorId id, const wxColour& color) { 46 | colors_[id] = color; 47 | } 48 | 49 | void AppendString(const wxString& string); 50 | 51 | void UpdateSizes(); 52 | 53 | int GetCount() const { 54 | return static_cast(strings_.size()); 55 | } 56 | 57 | int selected_index() const { 58 | return selected_index_; 59 | } 60 | 61 | protected: 62 | void InitColors(); 63 | 64 | wxSize DoGetBestSize() const override; 65 | 66 | void OnPaint(wxPaintEvent& evt); 67 | void OnMouseLeftDown(wxMouseEvent& evt); 68 | void OnFocusChange(wxFocusEvent& evt); 69 | 70 | void DrawSelectedRow(wxDC& dc, const wxRect& row_rect, const wxString& label); 71 | 72 | void PostEvent(int index, bool select); 73 | 74 | private: 75 | wxColour colors_[COLOR_COUNT]; 76 | 77 | std::vector strings_; 78 | 79 | // 0-based index of the current selection. 80 | // No selection if it's wxNOT_FOUND (-1). 81 | int selected_index_; 82 | 83 | wxSize raw_padding_; 84 | wxSize row_size_; 85 | }; 86 | 87 | } // namespace ui 88 | 89 | #endif // UI_STRING_LIST_CTRL_H_ 90 | -------------------------------------------------------------------------------- /src/jil/find_result_page.h: -------------------------------------------------------------------------------- 1 | #ifndef JIL_FIND_RESULT_PAGE_H_ 2 | #define JIL_FIND_RESULT_PAGE_H_ 3 | 4 | // Text window as find result page in the tool book. 5 | 6 | #include "editor/text_window.h" 7 | 8 | #include "jil/book_page.h" 9 | 10 | namespace jil { 11 | 12 | BEGIN_DECLARE_EVENT_TYPES() 13 | // Check GetInt(), which returns enum FindResultPage::EventType, for the details. 14 | DECLARE_EVENT_TYPE(kFindResultPageEvent, 0) 15 | END_DECLARE_EVENT_TYPES() 16 | 17 | class FindResultPage : public editor::TextWindow, public BookPage { 18 | DECLARE_CLASS(FindResultPage) 19 | 20 | public: 21 | // Detailed event types of kFindResultPageEvent. 22 | enum { 23 | kLocalizeEvent = 1, 24 | 25 | // Find result page is destroyed. 26 | kDestroyEvent, 27 | }; 28 | 29 | public: 30 | // \param fr_buffer Find result text buffer (managed by BookFrame). 31 | explicit FindResultPage(editor::TextBuffer* fr_buffer); 32 | 33 | virtual ~FindResultPage(); 34 | 35 | bool Create(wxWindow* parent, wxWindowID id, bool hide = false); 36 | 37 | // Overriddens of BookPage: 38 | virtual bool Page_HasFocus() const override; 39 | virtual void Page_SetFocus() override; 40 | virtual void Page_Activate(bool active) override; 41 | virtual void Page_Close() override; 42 | virtual int Page_Type() const override; 43 | virtual wxString Page_Label() const override; 44 | virtual wxString Page_Description() const override; 45 | virtual int Page_Flags() const override; 46 | 47 | virtual void Page_EditMenu(wxMenu* edit_menu) override; 48 | virtual bool Page_EditMenuState(int menu_id) override; 49 | virtual bool Page_FileMenuState(int menu_id) override; 50 | virtual bool Page_OnMenu(int menu_id) override; 51 | virtual bool Page_Save() override; 52 | 53 | protected: 54 | // Overriddens of editor::TextWindow: 55 | virtual void HandleTextLeftDClick(wxMouseEvent& evt) override; 56 | virtual void HandleTextRightUp(wxMouseEvent& evt) override; 57 | 58 | void PostEvent(int event_type); 59 | }; 60 | 61 | } // namespace jil 62 | 63 | #define EVT_FIND_RESULT_PAGE(id, func)\ 64 | DECLARE_EVENT_TABLE_ENTRY(jil::kFindResultPageEvent, id, -1,\ 65 | wxCommandEventHandler(func), (wxObject*)NULL), 66 | 67 | #endif // JIL_FIND_RESULT_PAGE_H_ 68 | -------------------------------------------------------------------------------- /third_party/src/lua/lctype.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lctype.h,v 1.12 2011/07/15 12:50:29 roberto Exp $ 3 | ** 'ctype' functions for Lua 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef lctype_h 8 | #define lctype_h 9 | 10 | #include "lua.h" 11 | 12 | 13 | /* 14 | ** WARNING: the functions defined here do not necessarily correspond 15 | ** to the similar functions in the standard C ctype.h. They are 16 | ** optimized for the specific needs of Lua 17 | */ 18 | 19 | #if !defined(LUA_USE_CTYPE) 20 | 21 | #if 'A' == 65 && '0' == 48 22 | /* ASCII case: can use its own tables; faster and fixed */ 23 | #define LUA_USE_CTYPE 0 24 | #else 25 | /* must use standard C ctype */ 26 | #define LUA_USE_CTYPE 1 27 | #endif 28 | 29 | #endif 30 | 31 | 32 | #if !LUA_USE_CTYPE /* { */ 33 | 34 | #include 35 | 36 | #include "llimits.h" 37 | 38 | 39 | #define ALPHABIT 0 40 | #define DIGITBIT 1 41 | #define PRINTBIT 2 42 | #define SPACEBIT 3 43 | #define XDIGITBIT 4 44 | 45 | 46 | #define MASK(B) (1 << (B)) 47 | 48 | 49 | /* 50 | ** add 1 to char to allow index -1 (EOZ) 51 | */ 52 | #define testprop(c,p) (luai_ctype_[(c)+1] & (p)) 53 | 54 | /* 55 | ** 'lalpha' (Lua alphabetic) and 'lalnum' (Lua alphanumeric) both include '_' 56 | */ 57 | #define lislalpha(c) testprop(c, MASK(ALPHABIT)) 58 | #define lislalnum(c) testprop(c, (MASK(ALPHABIT) | MASK(DIGITBIT))) 59 | #define lisdigit(c) testprop(c, MASK(DIGITBIT)) 60 | #define lisspace(c) testprop(c, MASK(SPACEBIT)) 61 | #define lisprint(c) testprop(c, MASK(PRINTBIT)) 62 | #define lisxdigit(c) testprop(c, MASK(XDIGITBIT)) 63 | 64 | /* 65 | ** this 'ltolower' only works for alphabetic characters 66 | */ 67 | #define ltolower(c) ((c) | ('A' ^ 'a')) 68 | 69 | 70 | /* two more entries for 0 and -1 (EOZ) */ 71 | LUAI_DDEC const lu_byte luai_ctype_[UCHAR_MAX + 2]; 72 | 73 | 74 | #else /* }{ */ 75 | 76 | /* 77 | ** use standard C ctypes 78 | */ 79 | 80 | #include 81 | 82 | 83 | #define lislalpha(c) (isalpha(c) || (c) == '_') 84 | #define lislalnum(c) (isalnum(c) || (c) == '_') 85 | #define lisdigit(c) (isdigit(c)) 86 | #define lisspace(c) (isspace(c)) 87 | #define lisprint(c) (isprint(c)) 88 | #define lisxdigit(c) (isxdigit(c)) 89 | 90 | #define ltolower(c) (tolower(c)) 91 | 92 | #endif /* } */ 93 | 94 | #endif 95 | 96 | -------------------------------------------------------------------------------- /src/editor/text_extent.h: -------------------------------------------------------------------------------- 1 | #ifndef EDITOR_TEXT_EXTENT_H_ 2 | #define EDITOR_TEXT_EXTENT_H_ 3 | 4 | #include 5 | 6 | #include "wx/defs.h" 7 | #include "wx/gdicmn.h" 8 | #include "wx/string.h" 9 | 10 | #include "editor/text_point.h" 11 | 12 | class wxFont; 13 | class wxMemoryDC; 14 | 15 | namespace editor { 16 | 17 | class TextLine; 18 | 19 | // Text extent is used to measure the text size. 20 | class TextExtent { 21 | public: 22 | TextExtent(); 23 | ~TextExtent(); 24 | 25 | void SetFont(const wxFont& font); 26 | 27 | wxSize char_size() const { 28 | return char_size_; 29 | } 30 | 31 | wxCoord GetWidth(const std::wstring& text) const; 32 | wxCoord GetWidth(const std::wstring& text, Coord off, Coord len) const; 33 | 34 | // Get the sub line width. 35 | // \param tab_stop Used to expand tabs in case the line has tabs. 36 | wxCoord GetLineWidth(int tab_stop, 37 | const TextLine* line, 38 | Coord off, 39 | Coord len, 40 | Coord base = 0) const; 41 | 42 | // Binary search to get the char index with the given client x coordinate. 43 | // The return value might >= line length if vspace is true. 44 | Coord IndexChar(int tab_stop, 45 | const TextLine* line, 46 | Coord base, // TODO: Comments 47 | int client_x, 48 | bool vspace); 49 | 50 | private: 51 | void UpdateCharSize(); 52 | 53 | void GetExtent(const std::wstring& text, 54 | Coord off, 55 | Coord len, 56 | wxCoord* x, 57 | wxCoord* y, 58 | wxCoord* external_leading = NULL) const; 59 | 60 | // Binary search to get the char index. 61 | // The range is STL-style: [begin, end). 62 | // Called by IndexChar(). 63 | Coord IndexCharRecursively(int tab_stop, 64 | const TextLine* line, 65 | Coord base, 66 | Coord begin, 67 | Coord end, 68 | int client_x, 69 | bool vspace) const; 70 | 71 | private: 72 | wxMemoryDC* dc_; 73 | wxSize char_size_; 74 | }; 75 | 76 | } // namespace editor 77 | 78 | #endif // EDITOR_TEXT_EXTENT_H_ 79 | -------------------------------------------------------------------------------- /third_party/src/libconfig/scanctx.h: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------------- 2 | libconfig - A library for processing structured configuration files 3 | Copyright (C) 2005-2010 Mark A Lindner 4 | 5 | This file is part of libconfig. 6 | 7 | This library is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU Lesser General Public License 9 | as published by the Free Software Foundation; either version 2.1 of 10 | the License, or (at your option) any later version. 11 | 12 | This library is distributed in the hope that it will be useful, but 13 | WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | Lesser General Public License for more details. 16 | 17 | You should have received a copy of the GNU Library General Public 18 | License along with this library; if not, see 19 | . 20 | ---------------------------------------------------------------------------- 21 | */ 22 | 23 | #ifndef __libconfig_scanctx_h 24 | #define __libconfig_scanctx_h 25 | 26 | #include "libconfig.h" 27 | #include "strbuf.h" 28 | 29 | #include 30 | #include 31 | 32 | #define MAX_INCLUDE_DEPTH 10 33 | 34 | struct scan_context 35 | { 36 | config_t *config; 37 | const char *top_filename; 38 | const char *files[MAX_INCLUDE_DEPTH]; 39 | void *buffers[MAX_INCLUDE_DEPTH]; 40 | FILE *streams[MAX_INCLUDE_DEPTH]; 41 | int depth; 42 | strbuf_t string; 43 | const char **filenames; 44 | unsigned int num_filenames; 45 | }; 46 | 47 | extern void scanctx_init(struct scan_context *ctx, const char *top_filename); 48 | extern const char **scanctx_cleanup(struct scan_context *ctx, 49 | unsigned int *num_filenames); 50 | 51 | extern FILE *scanctx_push_include(struct scan_context *ctx, void *prev_buffer, 52 | const char **error); 53 | extern void *scanctx_pop_include(struct scan_context *ctx); 54 | 55 | #define scanctx_append_string(C, S) \ 56 | strbuf_append(&((C)->string), (S)) 57 | 58 | extern char *scanctx_take_string(struct scan_context *ctx); 59 | 60 | extern const char *scanctx_current_filename(struct scan_context *ctx); 61 | 62 | #endif /* __libconfig_scanctx_h */ 63 | -------------------------------------------------------------------------------- /third_party/src/gtest/gtest-all.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2008, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: mheule@google.com (Markus Heule) 31 | // 32 | // Google C++ Testing Framework (Google Test) 33 | // 34 | // Sometimes it's desirable to build Google Test by compiling a single file. 35 | // This file serves this purpose. 36 | 37 | // This line ensures that gtest.h can be compiled on its own, even 38 | // when it's fused. 39 | #include "gtest/gtest.h" 40 | 41 | // The following lines pull in the real gtest *.cc files. 42 | #include "gtest/gtest.cc" 43 | #include "gtest/gtest-death-test.cc" 44 | #include "gtest/gtest-filepath.cc" 45 | #include "gtest/gtest-port.cc" 46 | #include "gtest/gtest-printers.cc" 47 | #include "gtest/gtest-test-part.cc" 48 | #include "gtest/gtest-typed-test.cc" 49 | -------------------------------------------------------------------------------- /third_party/src/uchardet/nscore.h: -------------------------------------------------------------------------------- 1 | /* ***** BEGIN LICENSE BLOCK ***** 2 | * Version: MPL 1.1/GPL 2.0/LGPL 2.1 3 | * 4 | * The contents of this file are subject to the Mozilla Public License Version 5 | * 1.1 (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * http://www.mozilla.org/MPL/ 8 | * 9 | * Software distributed under the License is distributed on an "AS IS" basis, 10 | * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 11 | * for the specific language governing rights and limitations under the 12 | * License. 13 | * 14 | * The Original Code is Mozilla Universal charset detector code. 15 | * 16 | * The Initial Developer of the Original Code is 17 | * Netscape Communications Corporation. 18 | * Portions created by the Initial Developer are Copyright (C) 2001 19 | * the Initial Developer. All Rights Reserved. 20 | * 21 | * Contributor(s): 22 | * Kohei TAKETA 23 | * 24 | * Alternatively, the contents of this file may be used under the terms of 25 | * either the GNU General Public License Version 2 or later (the "GPL"), or 26 | * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), 27 | * in which case the provisions of the GPL or the LGPL are applicable instead 28 | * of those above. If you wish to allow use of your version of this file only 29 | * under the terms of either the GPL or the LGPL, and not to allow others to 30 | * use your version of this file under the terms of the MPL, indicate your 31 | * decision by deleting the provisions above and replace them with the notice 32 | * and other provisions required by the GPL or the LGPL. If you do not delete 33 | * the provisions above, a recipient may use your version of this file under 34 | * the terms of any one of the MPL, the GPL or the LGPL. 35 | * 36 | * ***** END LICENSE BLOCK ***** */ 37 | #ifndef nsDummyCore_h__ 38 | #define nsDummyCore_h__ 39 | 40 | typedef bool PRBool; 41 | typedef int PRInt32; 42 | typedef unsigned int PRUint32; 43 | typedef short PRInt16; 44 | typedef unsigned short PRUint16; 45 | typedef signed char PRInt8; 46 | typedef unsigned char PRUint8; 47 | 48 | #define PR_FALSE false 49 | #define PR_TRUE true 50 | #define nsnull 0 51 | 52 | 53 | enum nsresult 54 | { 55 | NS_OK, 56 | NS_ERROR_OUT_OF_MEMORY 57 | }; 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /data/jilfiles/ftplugin/cmake/lex.cfg: -------------------------------------------------------------------------------- 1 | // Lex for CMake 2 | // Last update: 2017-01-20 3 | 4 | // CMake ignores case for keywords. 5 | ignore_case = true; 6 | 7 | lex = ( 8 | { id = "comment"; quote = [ "#" ]; escape_eol = false; }, 9 | { id = "constant.string"; quote = [ "\"", "\"" ]; escape_eol = false; }, 10 | 11 | { id = "identifier"; quote = [ "${", "}" ]; }, 12 | 13 | { 14 | id = "identifier.function"; 15 | anyof = ""; 16 | }, 17 | { 18 | id = "statement"; 19 | // The keywords are generated as: cmake --help-command-list | tr "\n" " " 20 | anyof = "ADD_CUSTOM_COMMAND ADD_CUSTOM_TARGET ADD_DEFINITIONS ADD_DEPENDENCIES ADD_EXECUTABLE ADD_LIBRARY ADD_SUBDIRECTORY ADD_TEST AUX_SOURCE_DIRECTORY BUILD_COMMAND BUILD_NAME CMAKE_MINIMUM_REQUIRED CONFIGURE_FILE CREATE_TEST_SOURCELIST ELSE ELSEIF ENABLE_LANGUAGE ENABLE_TESTING ENDFOREACH ENDFUNCTION ENDIF ENDMACRO ENDWHILE EXEC_PROGRAM EXECUTE_PROCESS EXPORT_LIBRARY_DEPENDENCIES FILE FIND_FILE FIND_LIBRARY FIND_PACKAGE FIND_PATH FIND_PROGRAM FLTK_WRAP_UI FOREACH FUNCTION GET_CMAKE_PROPERTY GET_DIRECTORY_PROPERTY GET_FILENAME_COMPONENT GET_SOURCE_FILE_PROPERTY GET_TARGET_PROPERTY GET_TEST_PROPERTY IF INCLUDE INCLUDE_DIRECTORIES INCLUDE_EXTERNAL_MSPROJECT INCLUDE_REGULAR_EXPRESSION INSTALL INSTALL_FILES INSTALL_PROGRAMS INSTALL_TARGETS LINK_DIRECTORIES LINK_LIBRARIES LIST LOAD_CACHE LOAD_COMMAND MACRO MAKE_DIRECTORY MARK_AS_ADVANCED MATH MESSAGE OPTION OUTPUT_REQUIRED_FILES PROJECT QT_WRAP_CPP QT_WRAP_UI REMOVE REMOVE_DEFINITIONS SEPARATE_ARGUMENTS SET SET_DIRECTORY_PROPERTIES SET_SOURCE_FILES_PROPERTIES SET_TARGET_PROPERTIES SET_TESTS_PROPERTIES SITE_NAME SOURCE_GROUP STRING SUBDIR_DEPENDS SUBDIRS TARGET_LINK_LIBRARIES TRY_COMPILE TRY_RUN UNSET USE_MANGLED_MESA UTILITY_SOURCE VARIABLE_REQUIRES VTK_MAKE_INSTANTIATOR VTK_WRAP_JAVA VTK_WRAP_PYTHON VTK_WRAP_TCL WHILE WRITE_FILE"; 21 | }, 22 | { 23 | id = "statement.conditional"; 24 | anyof = ""; 25 | }, 26 | { 27 | id = "statement.repeat"; 28 | anyof = ""; 29 | }, 30 | { 31 | id = "statement.operator"; 32 | anyof = "ABSOLUTE AND BOOL CACHE COMMAND DEFINED DOC EQUAL EXISTS EXT FALSE GREATER INTERNAL LESS MATCHES NAME NAMES NAME_WE NOT OFF ON OR PATH PATHS PROGRAM STREQUAL STRGREATER STRING STRLESS TRUE"; 33 | }, 34 | 35 | { id = "constant.number"; prefix = "\d"; use_regex = true; } 36 | ); 37 | -------------------------------------------------------------------------------- /data/jilfiles/ftplugin/cpp/lex.cfg: -------------------------------------------------------------------------------- 1 | // Lex for C++ 2 | // Last update: 2015-10-26 3 | 4 | lex = ( 5 | { id = "comment"; quote = [ "/*", "*/" ]; multi_line = true; }, 6 | { id = "comment"; quote = [ "//" ]; escape_eol = true; }, 7 | { id = "constant.string"; quote = [ "\"", "\"" ]; escape_eol = true; }, 8 | { id = "constant.char"; quote = [ "'", "'" ]; }, 9 | 10 | { id = "constant.bool"; anyof = "true false"; }, 11 | { id = "constant.null"; anyof = "NULL"; }, 12 | // Vim takes 'this' as statement. 13 | //{ id = "identifier"; anyof = "this"; }, 14 | { id = "statement"; anyof = "break continue default goto return this using typedef"; }, 15 | { id = "statement.conditional"; anyof = "if else switch case"; }, 16 | { id = "statement.repeat"; anyof = "for do while"; }, 17 | { id = "statement.exception"; anyof = "try catch throw"; }, 18 | { id = "statement.operator"; anyof = "sizeof new delete"; }, 19 | { id = "type"; anyof = "void bool char short int long float double signed unsigned size_t wchar_t operator typeid"; }, 20 | { id = "type"; anyof = "static_cast dynamic_cast const_cast reinterpret_cast"; }, 21 | { id = "type.qualifier"; anyof = "auto static register extern const explicit volatile mutable typename virtual public protected private friend inline"; }, 22 | { id = "type.struct"; anyof = "class enum namespace struct union template"; }, 23 | // C++11 24 | { id = "constant"; anyof = "nullptr"; }, 25 | { id = "type.qualifier"; anyof = "override final constexpr decltype"; }, 26 | { id = "statement.exception"; anyof = "noexcept"; }, 27 | 28 | { id = "preproc"; regex = "#\s*ifdef\b"; }, 29 | { id = "preproc"; regex = "#\s*ifndef\b"; }, 30 | { id = "preproc"; regex = "#\s*if\s+!?\s*defined\b"; }, 31 | { id = "preproc"; regex = "#\s*if\b"; }, 32 | { id = "preproc"; regex = "#\s*elif\s+!?\s*defined\b"; }, 33 | { id = "preproc"; regex = "#\s*elif\b"; }, 34 | { id = "preproc"; regex = "#\s*else\b"; }, 35 | { id = "preproc"; regex = "#\s*define\b"; }, 36 | { id = "preproc"; regex = "#\s*endif\b"; }, 37 | { id = "preproc"; regex = "#\s*include\s*\".+\""; }, 38 | { id = "preproc"; regex = "#\s*include\s*<.+>"; }, 39 | { id = "preproc"; regex = "#\s*include\b"; }, 40 | { id = "preproc"; regex = "#\s*pragma\b"; }, 41 | 42 | { id = "constant.number"; prefix = "\d"; use_regex = true; } 43 | 44 | ); 45 | -------------------------------------------------------------------------------- /data/jilfiles/ftplugin/rust/lex.cfg: -------------------------------------------------------------------------------- 1 | // Lex for Rust 2 | // Last update: 2017-04-05 3 | 4 | lex = ( 5 | { id = "comment"; quote = [ "/*", "*/" ]; multi_line = true; }, 6 | { id = "comment"; quote = [ "//" ]; escape_eol = true; }, 7 | { id = "constant.string"; quote = [ "\"", "\"" ]; escape_eol = true; }, 8 | { id = "constant.char"; quote = [ "'", "'" ]; }, 9 | 10 | { id = "constant.bool"; anyof = "true false"; }, 11 | { id = "constant"; anyof = "self"; }, 12 | 13 | { 14 | id = "statement"; 15 | anyof = "break continue return type as box extern fn in impl let pub " 16 | "super unsafe where use mod"; 17 | }, 18 | 19 | { id = "statement.conditional"; anyof = "match if else"; }, 20 | { id = "statement.repeat"; anyof = "for loop while"; }, 21 | 22 | { id = "statement.operator"; anyof = "Copy Send Sized Sync Drop Fn FnMut FnOnce"; }, 23 | 24 | // Built-in types 25 | { id = "type"; anyof = "isize usize char bool u8 u16 u32 u64 u128 f32 f64 i8 i16 i32 i64 i128 str Self"; }, 26 | 27 | // traits 28 | { 29 | id = "type"; 30 | anyof = "Box ToOwned Clone PartialEq PartialOrd Eq Ord AsRef AsMut Into " 31 | "From Default Iterator Extend IntoIterator DoubleEndedIterator " 32 | "ExactSizeIterator SliceConcatExt String ToString Vec"; 33 | }, 34 | 35 | // enum 36 | { 37 | id = "type"; 38 | anyof = "Option Some None Result Ok Err"; 39 | }, 40 | 41 | { id = "type.qualifier"; anyof = "move mut ref static const"; }, 42 | { id = "type.struct"; anyof = "struct enum union"; }, 43 | 44 | { id = "preproc"; regex = "#\s*ifdef\b"; }, 45 | { id = "preproc"; regex = "#\s*ifndef\b"; }, 46 | { id = "preproc"; regex = "#\s*if\s+!?\s*defined\b"; }, 47 | { id = "preproc"; regex = "#\s*if\b"; }, 48 | { id = "preproc"; regex = "#\s*elif\s+!?\s*defined\b"; }, 49 | { id = "preproc"; regex = "#\s*elif\b"; }, 50 | { id = "preproc"; regex = "#\s*else\b"; }, 51 | { id = "preproc"; regex = "#\s*define\b"; }, 52 | { id = "preproc"; regex = "#\s*endif\b"; }, 53 | { id = "preproc"; regex = "#\s*include\s*\".+\""; }, 54 | { id = "preproc"; regex = "#\s*include\s*<.+>"; }, 55 | { id = "preproc"; regex = "#\s*include\b"; }, 56 | { id = "preproc"; regex = "#\s*pragma\b"; }, 57 | 58 | { id = "constant.number"; prefix = "\d"; use_regex = true; } 59 | 60 | ); 61 | --------------------------------------------------------------------------------