├── test ├── num.txt ├── hoge2.txt ├── spr.txt ├── TAB.txt ├── test-1.txt ├── UTF8_BOM-2.txt ├── keisen.txt ├── a.txt ├── test.html ├── EUC.txt ├── shikaru.txt ├── hoge.txt ├── test.todolog ├── UTF16BE_BOM.txt ├── UTF16LE_BOM.txt ├── TAB.cpp ├── comment2.cpp ├── UTF8.txt ├── UTF8_BOM.txt ├── SJIS.txt ├── test.txt ├── hello.cpp ├── comment.cpp ├── paiza.cpp ├── test.PRJ ├── test.cpp └── iland.cpp ├── vivi ├── vivi64 │ ├── ProjectView.cpp │ ├── version.h │ ├── tags │ ├── icon1.ico │ ├── icon2.ico │ ├── resource.h │ ├── vivi64.ico │ ├── vivi64.rc │ ├── assocParen.h │ ├── settingsMgr.h │ ├── zenCoding.h │ ├── NamedColorDlg.h │ ├── OutputView.cpp │ ├── drawTokenizer.h │ ├── settingsMgr.cpp │ ├── typeSettings.h │ ├── CompletionWidget.h │ ├── Resources │ │ ├── CPP.png │ │ ├── CS.png │ │ ├── CSS.png │ │ ├── FS.png │ │ ├── HLSL.png │ │ ├── HTML.png │ │ ├── JAVA.png │ │ ├── JS.png │ │ ├── LOG.png │ │ ├── PERL.png │ │ ├── PHP.png │ │ ├── RUBY.png │ │ ├── SPR.png │ │ ├── SQL.png │ │ ├── TS.png │ │ ├── TXT.png │ │ ├── copy.png │ │ ├── cut.png │ │ ├── PASCAL.png │ │ ├── PYTHON.png │ │ ├── Pencil.png │ │ ├── keisen.png │ │ ├── opt_ic.png │ │ ├── paste.png │ │ ├── power.png │ │ ├── search.png │ │ ├── GDScript.png │ │ ├── Markdown.png │ │ ├── Trapezoid.png │ │ ├── boxselect.png │ │ ├── opt_word.png │ │ ├── settings.png │ │ ├── access_time.png │ │ ├── build_black.png │ │ ├── exit_black.png │ │ ├── folder_open.png │ │ ├── info_black.png │ │ ├── new_window.png │ │ ├── opt_regexp.png │ │ ├── redo_black.png │ │ ├── save_black.png │ │ ├── star_border.png │ │ ├── undo_black.png │ │ ├── arrow_downward.png │ │ ├── arrow_upward.png │ │ ├── crop_portrait.png │ │ ├── folder_black.png │ │ ├── opt_word-000.png │ │ ├── pencil_orange.png │ │ ├── redo_lightgray.png │ │ ├── save_all_black.mdp │ │ ├── search_forward.png │ │ ├── undo_lightgray.png │ │ ├── search_backward.png │ │ ├── add_circle_outline.png │ │ ├── crop_portrait_gray.png │ │ └── close_circle_outline.png │ ├── TestViCommands.h │ ├── drawTokenizer.cpp │ ├── typeSettings.cpp │ ├── CompletionWidget.cpp │ ├── .vscode │ │ └── settings.json │ ├── ProjectView.h │ ├── .editorconfig │ ├── CTabBar.h │ ├── CTabWidget.h │ ├── GreppingDlg.cpp │ ├── FindLineEdit.h │ ├── GreppingDlg.h │ ├── FindLineEdit.cpp │ ├── OutlineBar.h │ ├── OutputView.h │ ├── ClipboardHistDlg.h │ ├── CommandLine.h │ ├── GlobalStgDlg.h │ ├── GrepEngine.h │ ├── CTabWidget.cpp │ ├── ClipboardHistDlg.cpp │ ├── singleapplication.h │ ├── GrepDlg.h │ ├── TypeStgDlg.h │ ├── AutoCompletionDlg.h │ ├── CommandLine.cpp │ ├── singleapplication.cpp │ ├── charEncoding.h │ ├── main.cpp │ ├── GreppingDlg.ui │ ├── viewLineMgr.h │ ├── CTabBar.cpp │ ├── MainWindow.qrc │ ├── tokenizer.h │ ├── ClipboardHistDlg.ui │ ├── OutlineBar.cpp │ ├── viEngine.txt │ ├── globalSettings.h │ ├── Document.h │ ├── ViewTokenizer.h │ ├── TextCursor.h │ ├── GrepEngine.cpp │ ├── grep.cpp │ ├── globalSettings.cpp │ ├── GlobalStgDlg.cpp │ ├── GrepDlg.cpp │ └── NamedColorDlg.cpp ├── buffer │ ├── UTF16.h │ ├── LineMgr.h │ ├── MarkMgr.h │ ├── UTF16.cpp │ ├── markItem.h │ ├── sssearch.h │ ├── undoMgr.h │ ├── MarkMgr.cpp │ ├── bufferUtl.cpp │ ├── bufferUtl.h │ ├── gap_deque.h │ ├── sssearch.cpp │ ├── BufferTokenizer.h │ ├── gap_buffer-000.h │ ├── BufferTokenizer.cpp │ ├── gap_buffer_MT.h │ ├── viewLineMgr-000.h │ └── viewLineMgr-000.cpp ├── keywords │ ├── java.txt │ ├── php.txt │ ├── python.txt │ ├── ruby.txt │ ├── GDScript.txt │ ├── html.txt │ ├── cs.txt │ ├── fs.txt │ ├── cpp.txt │ ├── Pascal.txt │ ├── HLSL.txt │ ├── JavaScript.txt │ ├── perl.txt │ └── css.txt ├── buffer-000 │ ├── LineMgr.h │ ├── MarkMgr.h │ ├── UTF16.cpp │ ├── UTF16.h │ ├── undoMgr.h │ ├── MarkMgr.cpp │ ├── bufferUtl.h │ ├── gap_deque.h │ ├── markItem.h │ ├── sssearch.h │ ├── undoMgr.cpp │ ├── bufferUtl.cpp │ ├── gap_buffer.h │ ├── sssearch.cpp │ ├── BufferTokenizer.cpp │ ├── BufferTokenizer.h │ ├── gap_buffer_MT.h │ ├── viewLineMgr.h │ └── viewLineMgr.cpp ├── colors │ ├── white.stg │ ├── darkblue.stg │ ├── black.stg │ ├── lightyellow.stg │ └── Black_LILIN.stg ├── vivi.sln ├── testBufferQt │ ├── testBufferQt.vcxproj.filters │ └── testBufferQt.vcxproj └── TestBuffer │ ├── TestBuffer.vcxproj.filters │ ├── main.cpp │ └── TestBuffer.vcxproj ├── icons ├── copy.png ├── cut.png ├── paste.png ├── keisen.png ├── opt_ic.png ├── project.png ├── search.mdp ├── search.png ├── Trapezoid.png ├── border_all.png ├── boxselect.png ├── edit_black.png ├── opt_regexp.png ├── opt_word.mdp ├── opt_word.png ├── search-2.mdp ├── search-2.png ├── settings.png ├── wordSearch.mdp ├── arrow_upward.png ├── edit_orange.mdp ├── edit_orange.png ├── folder_black.png ├── height_black.png ├── settings-000.png ├── arrow_downward.png ├── circle_outline.png ├── crop_portrait.png ├── edit_orange-000.png ├── search_backward.png ├── search_forward.png ├── search_backward-1.png ├── search_forward-1.png ├── Entypo_274e(2)_128.png ├── crop_portrait_gray.png ├── FontAwesome_f00e(1)_128.png └── FontAwesome_f010(0)_128.png ├── screen ├── viMode.png ├── toInsMode.png ├── MainWindow-001.png ├── MainWindow-002.png └── SettingsViCommand.png ├── docs ├── classes.md └── buffer.txt ├── .github └── FUNDING.yml ├── funcs.md ├── LICENSE ├── testSpec └── search.md └── README.md /test/num.txt: -------------------------------------------------------------------------------- 1 | ① 2 | -------------------------------------------------------------------------------- /test/hoge2.txt: -------------------------------------------------------------------------------- 1 | hoge2 -------------------------------------------------------------------------------- /test/spr.txt: -------------------------------------------------------------------------------- 1 | aaaaa 2 | -------------------------------------------------------------------------------- /test/TAB.txt: -------------------------------------------------------------------------------- 1 | int 0123456789 -------------------------------------------------------------------------------- /test/test-1.txt: -------------------------------------------------------------------------------- 1 | ho 2 | ge 3 | -------------------------------------------------------------------------------- /test/UTF8_BOM-2.txt: -------------------------------------------------------------------------------- 1 | UTF-8.BOM 2 | 3 | -------------------------------------------------------------------------------- /test/keisen.txt: -------------------------------------------------------------------------------- 1 | 2 | ───┐ 3 | ↑ │ 4 | └─┘ -------------------------------------------------------------------------------- /test/a.txt: -------------------------------------------------------------------------------- 1 | あいうえおかきくけこさしすせそたちつてと 2 | a 3 | xyzzz 4 | aiueo 5 | -------------------------------------------------------------------------------- /test/test.html: -------------------------------------------------------------------------------- 1 |

2 | <string> 3 | <string> 4 | -------------------------------------------------------------------------------- /vivi/vivi64/ProjectView.cpp: -------------------------------------------------------------------------------- 1 | #include "ProjectView.h" 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /test/EUC.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/test/EUC.txt -------------------------------------------------------------------------------- /icons/copy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/icons/copy.png -------------------------------------------------------------------------------- /icons/cut.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/icons/cut.png -------------------------------------------------------------------------------- /icons/paste.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/icons/paste.png -------------------------------------------------------------------------------- /test/shikaru.txt: -------------------------------------------------------------------------------- 1 | 叱る攻撃! 2 | 叱叱叱叱叱叱叱叱叱叱叱 3 | 𠮟𠮟𠮟𠮟𠮟𠮟 4 | 🐸🐸🐸🐸🐸🐸🐸 5 | 6 | -------------------------------------------------------------------------------- /vivi/vivi64/version.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define VERSION_STR "0.059 dev" 4 | -------------------------------------------------------------------------------- /icons/keisen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/icons/keisen.png -------------------------------------------------------------------------------- /icons/opt_ic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/icons/opt_ic.png -------------------------------------------------------------------------------- /icons/project.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/icons/project.png -------------------------------------------------------------------------------- /icons/search.mdp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/icons/search.mdp -------------------------------------------------------------------------------- /icons/search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/icons/search.png -------------------------------------------------------------------------------- /screen/viMode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/screen/viMode.png -------------------------------------------------------------------------------- /test/hoge.txt: -------------------------------------------------------------------------------- 1 | hoge 'd' あいうえお 2 | hoge '' あいうえお 3 | hoge d' あいうえお 4 | hoge hoge hoge -------------------------------------------------------------------------------- /test/test.todolog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/test/test.todolog -------------------------------------------------------------------------------- /vivi/vivi64/tags: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/vivi64/tags -------------------------------------------------------------------------------- /icons/Trapezoid.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/icons/Trapezoid.png -------------------------------------------------------------------------------- /icons/border_all.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/icons/border_all.png -------------------------------------------------------------------------------- /icons/boxselect.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/icons/boxselect.png -------------------------------------------------------------------------------- /icons/edit_black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/icons/edit_black.png -------------------------------------------------------------------------------- /icons/opt_regexp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/icons/opt_regexp.png -------------------------------------------------------------------------------- /icons/opt_word.mdp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/icons/opt_word.mdp -------------------------------------------------------------------------------- /icons/opt_word.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/icons/opt_word.png -------------------------------------------------------------------------------- /icons/search-2.mdp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/icons/search-2.mdp -------------------------------------------------------------------------------- /icons/search-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/icons/search-2.png -------------------------------------------------------------------------------- /icons/settings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/icons/settings.png -------------------------------------------------------------------------------- /icons/wordSearch.mdp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/icons/wordSearch.mdp -------------------------------------------------------------------------------- /screen/toInsMode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/screen/toInsMode.png -------------------------------------------------------------------------------- /test/UTF16BE_BOM.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/test/UTF16BE_BOM.txt -------------------------------------------------------------------------------- /test/UTF16LE_BOM.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/test/UTF16LE_BOM.txt -------------------------------------------------------------------------------- /vivi/buffer/UTF16.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/buffer/UTF16.h -------------------------------------------------------------------------------- /icons/arrow_upward.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/icons/arrow_upward.png -------------------------------------------------------------------------------- /icons/edit_orange.mdp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/icons/edit_orange.mdp -------------------------------------------------------------------------------- /icons/edit_orange.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/icons/edit_orange.png -------------------------------------------------------------------------------- /icons/folder_black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/icons/folder_black.png -------------------------------------------------------------------------------- /icons/height_black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/icons/height_black.png -------------------------------------------------------------------------------- /icons/settings-000.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/icons/settings-000.png -------------------------------------------------------------------------------- /vivi/buffer/LineMgr.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/buffer/LineMgr.h -------------------------------------------------------------------------------- /vivi/buffer/MarkMgr.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/buffer/MarkMgr.h -------------------------------------------------------------------------------- /vivi/buffer/UTF16.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/buffer/UTF16.cpp -------------------------------------------------------------------------------- /vivi/buffer/markItem.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/buffer/markItem.h -------------------------------------------------------------------------------- /vivi/buffer/sssearch.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/buffer/sssearch.h -------------------------------------------------------------------------------- /vivi/buffer/undoMgr.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/buffer/undoMgr.h -------------------------------------------------------------------------------- /vivi/keywords/java.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/keywords/java.txt -------------------------------------------------------------------------------- /vivi/keywords/php.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/keywords/php.txt -------------------------------------------------------------------------------- /vivi/vivi64/icon1.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/vivi64/icon1.ico -------------------------------------------------------------------------------- /vivi/vivi64/icon2.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/vivi64/icon2.ico -------------------------------------------------------------------------------- /vivi/vivi64/resource.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/vivi64/resource.h -------------------------------------------------------------------------------- /vivi/vivi64/vivi64.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/vivi64/vivi64.ico -------------------------------------------------------------------------------- /vivi/vivi64/vivi64.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/vivi64/vivi64.rc -------------------------------------------------------------------------------- /icons/arrow_downward.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/icons/arrow_downward.png -------------------------------------------------------------------------------- /icons/circle_outline.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/icons/circle_outline.png -------------------------------------------------------------------------------- /icons/crop_portrait.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/icons/crop_portrait.png -------------------------------------------------------------------------------- /icons/edit_orange-000.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/icons/edit_orange-000.png -------------------------------------------------------------------------------- /icons/search_backward.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/icons/search_backward.png -------------------------------------------------------------------------------- /icons/search_forward.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/icons/search_forward.png -------------------------------------------------------------------------------- /screen/MainWindow-001.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/screen/MainWindow-001.png -------------------------------------------------------------------------------- /screen/MainWindow-002.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/screen/MainWindow-002.png -------------------------------------------------------------------------------- /test/TAB.cpp: -------------------------------------------------------------------------------- 1 | 01234567890123456789 2 | // 行番号部分幅 3 | // 行番号部分幅 4 | // あいうえお 5 | // abc 0123456789 -------------------------------------------------------------------------------- /vivi/buffer-000/LineMgr.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/buffer-000/LineMgr.h -------------------------------------------------------------------------------- /vivi/buffer-000/MarkMgr.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/buffer-000/MarkMgr.h -------------------------------------------------------------------------------- /vivi/buffer-000/UTF16.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/buffer-000/UTF16.cpp -------------------------------------------------------------------------------- /vivi/buffer-000/UTF16.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/buffer-000/UTF16.h -------------------------------------------------------------------------------- /vivi/buffer-000/undoMgr.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/buffer-000/undoMgr.h -------------------------------------------------------------------------------- /vivi/buffer/MarkMgr.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/buffer/MarkMgr.cpp -------------------------------------------------------------------------------- /vivi/buffer/bufferUtl.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/buffer/bufferUtl.cpp -------------------------------------------------------------------------------- /vivi/buffer/bufferUtl.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/buffer/bufferUtl.h -------------------------------------------------------------------------------- /vivi/buffer/gap_deque.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/buffer/gap_deque.h -------------------------------------------------------------------------------- /vivi/buffer/sssearch.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/buffer/sssearch.cpp -------------------------------------------------------------------------------- /vivi/vivi64/assocParen.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/vivi64/assocParen.h -------------------------------------------------------------------------------- /vivi/vivi64/settingsMgr.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/vivi64/settingsMgr.h -------------------------------------------------------------------------------- /vivi/vivi64/zenCoding.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/vivi64/zenCoding.h -------------------------------------------------------------------------------- /icons/search_backward-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/icons/search_backward-1.png -------------------------------------------------------------------------------- /icons/search_forward-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/icons/search_forward-1.png -------------------------------------------------------------------------------- /vivi/buffer-000/MarkMgr.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/buffer-000/MarkMgr.cpp -------------------------------------------------------------------------------- /vivi/buffer-000/bufferUtl.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/buffer-000/bufferUtl.h -------------------------------------------------------------------------------- /vivi/buffer-000/gap_deque.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/buffer-000/gap_deque.h -------------------------------------------------------------------------------- /vivi/buffer-000/markItem.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/buffer-000/markItem.h -------------------------------------------------------------------------------- /vivi/buffer-000/sssearch.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/buffer-000/sssearch.h -------------------------------------------------------------------------------- /vivi/buffer-000/undoMgr.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/buffer-000/undoMgr.cpp -------------------------------------------------------------------------------- /vivi/vivi64/NamedColorDlg.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/vivi64/NamedColorDlg.h -------------------------------------------------------------------------------- /vivi/vivi64/OutputView.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/vivi64/OutputView.cpp -------------------------------------------------------------------------------- /vivi/vivi64/drawTokenizer.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/vivi64/drawTokenizer.h -------------------------------------------------------------------------------- /vivi/vivi64/settingsMgr.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/vivi64/settingsMgr.cpp -------------------------------------------------------------------------------- /vivi/vivi64/typeSettings.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/vivi64/typeSettings.h -------------------------------------------------------------------------------- /icons/Entypo_274e(2)_128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/icons/Entypo_274e(2)_128.png -------------------------------------------------------------------------------- /icons/crop_portrait_gray.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/icons/crop_portrait_gray.png -------------------------------------------------------------------------------- /screen/SettingsViCommand.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/screen/SettingsViCommand.png -------------------------------------------------------------------------------- /vivi/buffer-000/bufferUtl.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/buffer-000/bufferUtl.cpp -------------------------------------------------------------------------------- /vivi/buffer-000/gap_buffer.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/buffer-000/gap_buffer.h -------------------------------------------------------------------------------- /vivi/buffer-000/sssearch.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/buffer-000/sssearch.cpp -------------------------------------------------------------------------------- /vivi/buffer/BufferTokenizer.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/buffer/BufferTokenizer.h -------------------------------------------------------------------------------- /vivi/buffer/gap_buffer-000.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/buffer/gap_buffer-000.h -------------------------------------------------------------------------------- /vivi/vivi64/CompletionWidget.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/vivi64/CompletionWidget.h -------------------------------------------------------------------------------- /vivi/vivi64/Resources/CPP.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/vivi64/Resources/CPP.png -------------------------------------------------------------------------------- /vivi/vivi64/Resources/CS.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/vivi64/Resources/CS.png -------------------------------------------------------------------------------- /vivi/vivi64/Resources/CSS.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/vivi64/Resources/CSS.png -------------------------------------------------------------------------------- /vivi/vivi64/Resources/FS.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/vivi64/Resources/FS.png -------------------------------------------------------------------------------- /vivi/vivi64/Resources/HLSL.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/vivi64/Resources/HLSL.png -------------------------------------------------------------------------------- /vivi/vivi64/Resources/HTML.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/vivi64/Resources/HTML.png -------------------------------------------------------------------------------- /vivi/vivi64/Resources/JAVA.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/vivi64/Resources/JAVA.png -------------------------------------------------------------------------------- /vivi/vivi64/Resources/JS.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/vivi64/Resources/JS.png -------------------------------------------------------------------------------- /vivi/vivi64/Resources/LOG.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/vivi64/Resources/LOG.png -------------------------------------------------------------------------------- /vivi/vivi64/Resources/PERL.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/vivi64/Resources/PERL.png -------------------------------------------------------------------------------- /vivi/vivi64/Resources/PHP.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/vivi64/Resources/PHP.png -------------------------------------------------------------------------------- /vivi/vivi64/Resources/RUBY.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/vivi64/Resources/RUBY.png -------------------------------------------------------------------------------- /vivi/vivi64/Resources/SPR.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/vivi64/Resources/SPR.png -------------------------------------------------------------------------------- /vivi/vivi64/Resources/SQL.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/vivi64/Resources/SQL.png -------------------------------------------------------------------------------- /vivi/vivi64/Resources/TS.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/vivi64/Resources/TS.png -------------------------------------------------------------------------------- /vivi/vivi64/Resources/TXT.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/vivi64/Resources/TXT.png -------------------------------------------------------------------------------- /vivi/vivi64/Resources/copy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/vivi64/Resources/copy.png -------------------------------------------------------------------------------- /vivi/vivi64/Resources/cut.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/vivi64/Resources/cut.png -------------------------------------------------------------------------------- /vivi/vivi64/TestViCommands.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/vivi64/TestViCommands.h -------------------------------------------------------------------------------- /vivi/vivi64/drawTokenizer.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/vivi64/drawTokenizer.cpp -------------------------------------------------------------------------------- /vivi/vivi64/typeSettings.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/vivi64/typeSettings.cpp -------------------------------------------------------------------------------- /vivi/buffer/BufferTokenizer.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/buffer/BufferTokenizer.cpp -------------------------------------------------------------------------------- /vivi/vivi64/CompletionWidget.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/vivi64/CompletionWidget.cpp -------------------------------------------------------------------------------- /vivi/vivi64/Resources/PASCAL.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/vivi64/Resources/PASCAL.png -------------------------------------------------------------------------------- /vivi/vivi64/Resources/PYTHON.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/vivi64/Resources/PYTHON.png -------------------------------------------------------------------------------- /vivi/vivi64/Resources/Pencil.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/vivi64/Resources/Pencil.png -------------------------------------------------------------------------------- /vivi/vivi64/Resources/keisen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/vivi64/Resources/keisen.png -------------------------------------------------------------------------------- /vivi/vivi64/Resources/opt_ic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/vivi64/Resources/opt_ic.png -------------------------------------------------------------------------------- /vivi/vivi64/Resources/paste.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/vivi64/Resources/paste.png -------------------------------------------------------------------------------- /vivi/vivi64/Resources/power.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/vivi64/Resources/power.png -------------------------------------------------------------------------------- /vivi/vivi64/Resources/search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/vivi64/Resources/search.png -------------------------------------------------------------------------------- /icons/FontAwesome_f00e(1)_128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/icons/FontAwesome_f00e(1)_128.png -------------------------------------------------------------------------------- /icons/FontAwesome_f010(0)_128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/icons/FontAwesome_f010(0)_128.png -------------------------------------------------------------------------------- /test/comment2.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | 0123456789 3 | 4 | .................... 5 | adsjfadalfdalkfalfk 6 | iiiiiiii 7 | */ 8 | 9 | -------------------------------------------------------------------------------- /vivi/buffer-000/BufferTokenizer.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/buffer-000/BufferTokenizer.cpp -------------------------------------------------------------------------------- /vivi/buffer-000/BufferTokenizer.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/buffer-000/BufferTokenizer.h -------------------------------------------------------------------------------- /vivi/vivi64/Resources/GDScript.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/vivi64/Resources/GDScript.png -------------------------------------------------------------------------------- /vivi/vivi64/Resources/Markdown.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/vivi64/Resources/Markdown.png -------------------------------------------------------------------------------- /vivi/vivi64/Resources/Trapezoid.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/vivi64/Resources/Trapezoid.png -------------------------------------------------------------------------------- /vivi/vivi64/Resources/boxselect.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/vivi64/Resources/boxselect.png -------------------------------------------------------------------------------- /vivi/vivi64/Resources/opt_word.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/vivi64/Resources/opt_word.png -------------------------------------------------------------------------------- /vivi/vivi64/Resources/settings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/vivi64/Resources/settings.png -------------------------------------------------------------------------------- /vivi/vivi64/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "java.home": "G:/src/JavaHome" 3 | "java.home": "C:/Program Files/Java/ 4 | } -------------------------------------------------------------------------------- /vivi/vivi64/Resources/access_time.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/vivi64/Resources/access_time.png -------------------------------------------------------------------------------- /vivi/vivi64/Resources/build_black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/vivi64/Resources/build_black.png -------------------------------------------------------------------------------- /vivi/vivi64/Resources/exit_black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/vivi64/Resources/exit_black.png -------------------------------------------------------------------------------- /vivi/vivi64/Resources/folder_open.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/vivi64/Resources/folder_open.png -------------------------------------------------------------------------------- /vivi/vivi64/Resources/info_black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/vivi64/Resources/info_black.png -------------------------------------------------------------------------------- /vivi/vivi64/Resources/new_window.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/vivi64/Resources/new_window.png -------------------------------------------------------------------------------- /vivi/vivi64/Resources/opt_regexp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/vivi64/Resources/opt_regexp.png -------------------------------------------------------------------------------- /vivi/vivi64/Resources/redo_black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/vivi64/Resources/redo_black.png -------------------------------------------------------------------------------- /vivi/vivi64/Resources/save_black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/vivi64/Resources/save_black.png -------------------------------------------------------------------------------- /vivi/vivi64/Resources/star_border.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/vivi64/Resources/star_border.png -------------------------------------------------------------------------------- /vivi/vivi64/Resources/undo_black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/vivi64/Resources/undo_black.png -------------------------------------------------------------------------------- /test/UTF8.txt: -------------------------------------------------------------------------------- 1 | あいうえお 2 | カキクケコ 3 | 漢字美乳 4 | 01234567890123456789 5 | !"#$%&'() 6 |  !”#$%&’() 7 | abcdefgXYZZZ 8 | abcdefgXYZZZ 9 | -------------------------------------------------------------------------------- /vivi/vivi64/Resources/arrow_downward.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/vivi64/Resources/arrow_downward.png -------------------------------------------------------------------------------- /vivi/vivi64/Resources/arrow_upward.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/vivi64/Resources/arrow_upward.png -------------------------------------------------------------------------------- /vivi/vivi64/Resources/crop_portrait.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/vivi64/Resources/crop_portrait.png -------------------------------------------------------------------------------- /vivi/vivi64/Resources/folder_black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/vivi64/Resources/folder_black.png -------------------------------------------------------------------------------- /vivi/vivi64/Resources/opt_word-000.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/vivi64/Resources/opt_word-000.png -------------------------------------------------------------------------------- /vivi/vivi64/Resources/pencil_orange.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/vivi64/Resources/pencil_orange.png -------------------------------------------------------------------------------- /vivi/vivi64/Resources/redo_lightgray.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/vivi64/Resources/redo_lightgray.png -------------------------------------------------------------------------------- /vivi/vivi64/Resources/save_all_black.mdp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/vivi64/Resources/save_all_black.mdp -------------------------------------------------------------------------------- /vivi/vivi64/Resources/search_forward.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/vivi64/Resources/search_forward.png -------------------------------------------------------------------------------- /vivi/vivi64/Resources/undo_lightgray.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/vivi64/Resources/undo_lightgray.png -------------------------------------------------------------------------------- /vivi/vivi64/Resources/search_backward.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/vivi64/Resources/search_backward.png -------------------------------------------------------------------------------- /docs/classes.md: -------------------------------------------------------------------------------- 1 | |クラス名|概要|詳細| 2 | |-------|----|----| 3 | |MainWinndow|メインウィンドウクラス| 4 | |EditView|ビュー画面クラス| 5 | |TextCursor|テキストカーソルクラス| 6 | -------------------------------------------------------------------------------- /vivi/vivi64/Resources/add_circle_outline.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/vivi64/Resources/add_circle_outline.png -------------------------------------------------------------------------------- /vivi/vivi64/Resources/crop_portrait_gray.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/vivi64/Resources/crop_portrait_gray.png -------------------------------------------------------------------------------- /vivi/vivi64/Resources/close_circle_outline.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivisuke/openViVi/HEAD/vivi/vivi64/Resources/close_circle_outline.png -------------------------------------------------------------------------------- /test/UTF8_BOM.txt: -------------------------------------------------------------------------------- 1 | あいうえお 2 | 3 | 4 | カキクケコ 5 | 漢字美乳 6 | 01234567890123456789 7 | !"#$%&'() 8 |  !”#$%&’() 9 | abcdefgXYZZZ 10 | abcdefgXYZZZ 11 | -------------------------------------------------------------------------------- /vivi/vivi64/ProjectView.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class ProjectView : public QWidget 4 | { 5 | Q_OBJECT 6 | public: 7 | ProjectView(); 8 | 9 | }; 10 | -------------------------------------------------------------------------------- /test/SJIS.txt: -------------------------------------------------------------------------------- 1 | 01234567890123456789 2 | あいうえお 3 | カキクケコ 4 | 漢字美乳( ) 5 | 01234567890123456789 6 | !"# $%&'() 7 | 01234567890123456789 8 |  !”#$%&’() 9 | abcdefgXYZZZ 10 | 01234567890123456789 11 | abcdefgXYZZZ 12 | -------------------------------------------------------------------------------- /test/test.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | あいうえおかきくけこさしすせそたちつてと。あいうえおかきくけこさしすせそたちつてと。あいうえおかきくけこさしすせそたちつてと。 8 | カキクケコ 9 | 漢字美乳 10 | 01234567890123456789 // ほげ 11 | !"#$%&'() 12 |  !”#$%&’() 13 | abcdefgXYZZZ 14 | abcdefgXYZZZ 15 | -------------------------------------------------------------------------------- /vivi/vivi64/.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | [*] 3 | charset = utf-8 4 | end_of_line = lf 5 | insert_final_newline = true 6 | 7 | [*.{h,cpp}] 8 | charset = utf-8-bom 9 | trim_tailing_whitespace = true 10 | indent_style = tab 11 | indent_size = 4 12 | -------------------------------------------------------------------------------- /vivi/vivi64/CTabBar.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | class CTabBar : public QTabBar 6 | { 7 | public: 8 | CTabBar(QWidget *parent = nullptr); 9 | ~CTabBar(); 10 | protected: 11 | void paintEvent(QPaintEvent *event); 12 | }; 13 | -------------------------------------------------------------------------------- /test/hello.cpp: -------------------------------------------------------------------------------- 1 | hogehoge 2 | hoge() 3 | { 4 | hage(); 5 | 01 0123401 6 | } 7 | 8 | main() { 9 | 10 | } 11 | hoge() 12 | { 13 | foo bar 14 | foo bar 15 | foo bar 16 | HOGE 17 | hhoge 18 | hogege 19 | foo bar 20 | hoge(); 21 | } 22 | -------------------------------------------------------------------------------- /test/comment.cpp: -------------------------------------------------------------------------------- 1 | // hoge 2 | hoge 3 | /* 4 | hoge 5 | hoge 6 | hoge 7 | hoge */ 8 | hoge 9 | hoge 10 | hoge 11 | hoge 12 | hoge 13 | hoge 14 | hoge 15 | hoge 16 | */ 17 | 18 | hoge 19 | fuga 20 | fuga 21 | fuga 22 | fuga 23 | fuga 24 | -------------------------------------------------------------------------------- /test/paiza.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | using namespace std; 6 | int main(void){ 7 | int N; 8 | cin >> N; 9 | for (int i = 0; i < N; ++i) { 10 | int t; 11 | cin >> t; 12 | } 13 | cout << "\n"; 14 | return 0; 15 | } 16 | -------------------------------------------------------------------------------- /vivi/vivi64/CTabWidget.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | class CTabWidget : public QTabWidget 6 | { 7 | public: 8 | CTabWidget(QWidget *parent = nullptr); 9 | ~CTabWidget(); 10 | public: 11 | //int addTab(QWidget *page, const QIcon &icon, const QString &label); 12 | protected: 13 | void paintEvent(QPaintEvent *event); 14 | }; 15 | -------------------------------------------------------------------------------- /test/test.PRJ: -------------------------------------------------------------------------------- 1 | [settings] 2 | actTabIndex = 0 3 | autoOpen = 1 4 | dispTreeAllFiles = 0 5 | autoUpdateTags = 1 6 | autoUpdateDefineList = 1 7 | autoLoadVizInfo = 2 8 | viewModule = 0 9 | extList = 10 | todoKeyWord = todo,undone 11 | memFileColumnWd = 320 12 | [symbols] 13 | [globalMarks] 14 | [files] 15 | G:/src/VS2019/openViVi/vivi/vivi64/EditView.h (98,-440) 16 | [ToDo] 17 | -------------------------------------------------------------------------------- /vivi/keywords/python.txt: -------------------------------------------------------------------------------- 1 | False 2 | None 3 | Truetry 4 | and 5 | as 6 | assert 7 | break 8 | class 9 | continue 10 | def 11 | del 12 | elif 13 | else 14 | except 15 | exec 16 | finally 17 | for 18 | from 19 | global 20 | if 21 | import 22 | in 23 | is 24 | lambda 25 | nonlocal 26 | not 27 | or 28 | pass 29 | print 30 | raise 31 | return 32 | try 33 | while 34 | with 35 | yield 36 | -------------------------------------------------------------------------------- /vivi/vivi64/GreppingDlg.cpp: -------------------------------------------------------------------------------- 1 | #include "GreppingDlg.h" 2 | 3 | GreppingDlg::GreppingDlg(QWidget *parent) 4 | : QDialog(parent) 5 | { 6 | ui.setupUi(this); 7 | setWindowFlags(Qt::WindowStaysOnTopHint); 8 | } 9 | GreppingDlg::~GreppingDlg() 10 | { 11 | } 12 | void GreppingDlg::setGreppingDir(const QString &dirStr) 13 | { 14 | ui.dir->setText(dirStr); 15 | } 16 | #if 0 17 | void GreppingDlg::terminate() 18 | { 19 | } 20 | #endif 21 | -------------------------------------------------------------------------------- /vivi/keywords/ruby.txt: -------------------------------------------------------------------------------- 1 | BEGIN 2 | END 3 | alias 4 | and 5 | begin 6 | break 7 | case 8 | class 9 | def 10 | defined? 11 | do 12 | else 13 | elsif 14 | end 15 | ensure 16 | false 17 | for 18 | if 19 | in 20 | module 21 | next 22 | new 23 | nil 24 | not 25 | or 26 | print 27 | private 28 | public 29 | redo 30 | rescue 31 | retry 32 | require 33 | return 34 | self 35 | super 36 | then 37 | true 38 | undef 39 | unless 40 | until 41 | when 42 | while 43 | yield 44 | -------------------------------------------------------------------------------- /vivi/keywords/GDScript.txt: -------------------------------------------------------------------------------- 1 | False 2 | None 3 | Truetry 4 | and 5 | as 6 | assert 7 | break 8 | class 9 | const 10 | continue 11 | def 12 | del 13 | elif 14 | else 15 | except 16 | exec 17 | export 18 | extends 19 | false 20 | finally 21 | for 22 | from 23 | func 24 | global 25 | if 26 | import 27 | in 28 | is 29 | lambda 30 | nonlocal 31 | not 32 | or 33 | pass 34 | print 35 | raise 36 | range 37 | return 38 | true 39 | try 40 | var 41 | while 42 | with 43 | yield 44 | -------------------------------------------------------------------------------- /vivi/vivi64/FindLineEdit.h: -------------------------------------------------------------------------------- 1 | #ifndef FINDLINEEDIT_H 2 | #define FINDLINEEDIT_H 3 | 4 | #include 5 | 6 | class FindLineEdit : public QLineEdit 7 | { 8 | Q_OBJECT 9 | 10 | public: 11 | FindLineEdit(QWidget *parent = 0); 12 | ~FindLineEdit(); 13 | 14 | protected: 15 | void keyPressEvent(QKeyEvent *); 16 | void focusInEvent ( QFocusEvent * event ); 17 | 18 | signals: 19 | void focusIn(); 20 | void escPressed(); 21 | 22 | private: 23 | }; 24 | 25 | #endif // FINDLINEEDIT_H 26 | -------------------------------------------------------------------------------- /vivi/vivi64/GreppingDlg.h: -------------------------------------------------------------------------------- 1 | #ifndef GREPPINGDLG_H 2 | #define GREPPINGDLG_H 3 | 4 | #include 5 | #include "ui_GreppingDlg.h" 6 | 7 | class GreppingDlg : public QDialog 8 | { 9 | Q_OBJECT 10 | 11 | public: 12 | GreppingDlg(QWidget *parent = 0); 13 | ~GreppingDlg(); 14 | 15 | public slots: 16 | void setGreppingDir(const QString &); 17 | 18 | //public slots: 19 | signals: 20 | void terminate(); 21 | 22 | private: 23 | Ui::GreppingDlg ui; 24 | }; 25 | 26 | #endif // GREPPINGDLG_H 27 | -------------------------------------------------------------------------------- /vivi/buffer/gap_buffer_MT.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------- 2 | // 3 | // File: "gap_buffer_MT.h" 4 | // Created: 16-Mar-2020 5 | // Author: 津田伸秀 6 | // Description: 7 | // マルチスレッドを用いてデータ移動を行うギャップバッファ 8 | // 9 | //---------------------------------------------------------------------- 10 | 11 | #pragma once 12 | 13 | #include "gap_buffer.h" 14 | 15 | template 16 | class gap_buffer_MT : public gap_buffer 17 | { 18 | }; 19 | 20 | -------------------------------------------------------------------------------- /vivi/buffer-000/gap_buffer_MT.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------- 2 | // 3 | // File: "gap_buffer_MT.h" 4 | // Created: 16-Mar-2020 5 | // Author: 津田伸秀 6 | // Description: 7 | // マルチスレッドを用いてデータ移動を行うギャップバッファ 8 | // 9 | //---------------------------------------------------------------------- 10 | 11 | #pragma once 12 | 13 | #include "gap_buffer.h" 14 | 15 | template 16 | class gap_buffer_MT : public gap_buffer 17 | { 18 | }; 19 | 20 | -------------------------------------------------------------------------------- /vivi/vivi64/FindLineEdit.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "FindLineEdit.h" 3 | 4 | FindLineEdit::FindLineEdit(QWidget *parent) 5 | : QLineEdit(parent) 6 | { 7 | } 8 | FindLineEdit::~FindLineEdit() 9 | { 10 | } 11 | void FindLineEdit::focusInEvent( QFocusEvent * event ) 12 | { 13 | QLineEdit::focusInEvent(event); 14 | emit focusIn(); 15 | } 16 | void FindLineEdit::keyPressEvent(QKeyEvent *event) 17 | { 18 | QLineEdit::keyPressEvent(event); 19 | if( event->key() == Qt::Key_Escape ) { 20 | emit escPressed(); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /vivi/vivi64/OutlineBar.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | class OutlineBar : public QTreeWidget 6 | { 7 | Q_OBJECT 8 | 9 | public: 10 | OutlineBar(QWidget *parent = nullptr); 11 | 12 | protected: 13 | void mouseDoubleClickEvent(QMouseEvent *); 14 | void keyPressEvent(QKeyEvent *); 15 | void keyHPressed(); 16 | void keyJPressed(); 17 | void keyKPressed(); 18 | void keyLPressed(); 19 | 20 | signals: 21 | void doubleClicked(int); 22 | void doubleClicked(QTreeWidgetItem*); 23 | void enterPressed(); 24 | void colonPressed(); 25 | void keyQPressed(); 26 | }; 27 | -------------------------------------------------------------------------------- /vivi/vivi64/OutputView.h: -------------------------------------------------------------------------------- 1 | #ifndef OUTPUTVIEW_H 2 | #define OUTPUTVIEW_H 3 | 4 | #include 5 | 6 | class OutputView : public QPlainTextEdit 7 | { 8 | Q_OBJECT 9 | 10 | public: 11 | OutputView(QWidget *parent = 0); 12 | ~OutputView(); 13 | 14 | public: 15 | void clear(); 16 | void tagJump(); 17 | 18 | signals: 19 | void jump(int); 20 | void tagJump(const QString &, int); 21 | void tagsJump(const QString &, const QString &, const QString &); 22 | void mouseReleased(); 23 | void escPressed(); 24 | 25 | private: 26 | void mouseDoubleClickEvent(QMouseEvent *); 27 | void keyPressEvent ( QKeyEvent * event ); 28 | }; 29 | 30 | #endif // OUTPUTVIEW_H 31 | -------------------------------------------------------------------------------- /vivi/vivi64/ClipboardHistDlg.h: -------------------------------------------------------------------------------- 1 | #ifndef CLIPBOARDHISTDLG_H 2 | #define CLIPBOARDHISTDLG_H 3 | 4 | #include 5 | #include "ui_ClipboardHistDlg.h" 6 | 7 | class ClipboardHistDlg : public QDialog 8 | { 9 | Q_OBJECT 10 | 11 | public: 12 | ClipboardHistDlg(const QStringList &, QWidget *parent = 0); 13 | ~ClipboardHistDlg(); 14 | 15 | public: 16 | int index() const { return m_ix; } 17 | 18 | public slots: 19 | void accept (); 20 | 21 | protected: 22 | //void closeEvent(QCloseEvent *event); 23 | 24 | protected slots: 25 | void itemDoubleClicked ( QListWidgetItem * item ); 26 | 27 | private: 28 | Ui::ClipboardHistDlg ui; 29 | int m_ix; 30 | }; 31 | 32 | #endif // CLIPBOARDHISTDLG_H 33 | -------------------------------------------------------------------------------- /vivi/vivi64/CommandLine.h: -------------------------------------------------------------------------------- 1 | #ifndef COMMANDLINE_H 2 | #define COMMANDLINE_H 3 | 4 | #include 5 | 6 | class CommandLine : public QLineEdit 7 | { 8 | Q_OBJECT 9 | 10 | public: 11 | CommandLine(QWidget *parent = 0); 12 | ~CommandLine(); 13 | 14 | protected: 15 | void keyPressEvent(QKeyEvent *); 16 | void focusOutEvent ( QFocusEvent * event ); 17 | bool focusNextPrevChild(bool next); 18 | 19 | signals: 20 | void focusOut(); 21 | void escPressed(); 22 | void spacePressed(); 23 | void slashPressed(); // ディレクトリセパレータ押下 24 | void colonPressed(); 25 | void tabPressed(); 26 | void upPressed(); 27 | void downPressed(); 28 | 29 | private: 30 | 31 | }; 32 | 33 | #endif // COMMANDLINE_H 34 | -------------------------------------------------------------------------------- /vivi/vivi64/GlobalStgDlg.h: -------------------------------------------------------------------------------- 1 | #ifndef GLOBALSTGDLG_H 2 | #define GLOBALSTGDLG_H 3 | 4 | #include 5 | #include "ui_GlobalStgDlg.h" 6 | 7 | class GlobalSettings; 8 | 9 | class GlobalStgDlg : public QDialog 10 | { 11 | Q_OBJECT 12 | 13 | public: 14 | GlobalStgDlg(GlobalSettings *, QWidget *parent = 0); 15 | ~GlobalStgDlg(); 16 | 17 | public slots: 18 | void accept(); 19 | 20 | public slots: 21 | //void refPict1FilePath(); 22 | //void refPict2FilePath(); 23 | void ZenCodingFilePath(); 24 | void htdocsRootPath(); 25 | 26 | protected: 27 | void setFontFamily(const QString &name); 28 | 29 | private: 30 | Ui::GlobalStgDlg ui; 31 | GlobalSettings *m_globSettings; 32 | }; 33 | 34 | #endif // GLOBALSTGDLG_H 35 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] 4 | patreon: # Replace with a single Patreon username 5 | open_collective: # Replace with a single Open Collective username 6 | ko_fi: # Replace with a single Ko-fi username 7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | liberapay: # Replace with a single Liberapay username 10 | issuehunt: # Replace with a single IssueHunt username 11 | otechie: # Replace with a single Otechie username 12 | custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] 13 | -------------------------------------------------------------------------------- /vivi/keywords/html.txt: -------------------------------------------------------------------------------- 1 | a 2 | abbr 3 | acronym 4 | address 5 | applet 6 | area 7 | b 8 | backquote 9 | base 10 | basefont 11 | bdo 12 | big 13 | blockquote 14 | body 15 | br 16 | button 17 | caption 18 | center 19 | cite 20 | code 21 | col 22 | colgroup 23 | dd 24 | del 25 | dfn 26 | dir 27 | div 28 | dl 29 | dt 30 | em 31 | fieldset 32 | font 33 | form 34 | frame 35 | frameset 36 | head 37 | h1 38 | h2 39 | h3 40 | h4 41 | h5 42 | h6 43 | hr 44 | html 45 | i 46 | iframe 47 | img 48 | input 49 | ins 50 | kbd 51 | label 52 | legend 53 | li 54 | link 55 | map 56 | menu 57 | meta 58 | noframes 59 | noscript 60 | object 61 | ol 62 | optgroup 63 | option 64 | p 65 | param 66 | pre 67 | q 68 | s 69 | samp 70 | script 71 | select 72 | small 73 | span 74 | strike 75 | strong 76 | style 77 | sub 78 | sup 79 | table 80 | tbody 81 | td 82 | textarea 83 | tfoot 84 | th 85 | thead 86 | title 87 | tr 88 | tt 89 | u 90 | ul 91 | var 92 | -------------------------------------------------------------------------------- /vivi/vivi64/GrepEngine.h: -------------------------------------------------------------------------------- 1 | #ifndef GREPENGINE_H 2 | #define GREPENGINE_H 3 | 4 | #include 5 | #include 6 | 7 | class GlobalSettings; 8 | class SSSearch; 9 | 10 | class GrepEngine : public QObject 11 | { 12 | Q_OBJECT 13 | 14 | public: 15 | GrepEngine(GlobalSettings *, QObject *parent = 0); 16 | ~GrepEngine(); 17 | 18 | public slots: 19 | void doGrep(QString pat, QString ext, QString dirStr, QString exclude); 20 | void terminate(); 21 | 22 | protected: 23 | int doGrepDir(QString pat, QString ext, QString dirStr, const QRegExp &); 24 | int doGrepFile(const QString &fullPath, const QString &pat, const QRegExp &); 25 | 26 | signals: 27 | void greppingDir(const QString &); 28 | void doOutput(const QString &); 29 | void finished(int); 30 | 31 | private: 32 | GlobalSettings *m_globSettings; 33 | SSSearch *m_sssrc; 34 | bool m_toTerminate; 35 | bool m_terminated; 36 | }; 37 | 38 | #endif // GREPENGINE_H 39 | -------------------------------------------------------------------------------- /vivi/keywords/cs.txt: -------------------------------------------------------------------------------- 1 | abstract 2 | add 3 | as 4 | async 5 | await 6 | base 7 | bool 8 | break 9 | byte 10 | case 11 | catch 12 | char 13 | checked 14 | class 15 | const 16 | continue 17 | decimal 18 | default 19 | delegate 20 | do 21 | double 22 | dynamic 23 | else 24 | enum 25 | event 26 | explicit 27 | extern 28 | false 29 | finally 30 | fixed 31 | float 32 | for 33 | foreach 34 | get 35 | goto 36 | if 37 | implicit 38 | in 39 | int 40 | interface 41 | internal 42 | is 43 | lock 44 | long 45 | namespace 46 | new 47 | null 48 | object 49 | operator 50 | out 51 | override 52 | params 53 | partial 54 | private 55 | protected 56 | public 57 | readonly 58 | ref 59 | remove 60 | return 61 | sbyte 62 | sealed 63 | set 64 | short 65 | sizeof 66 | stackalloc 67 | static 68 | string 69 | struct 70 | switch 71 | this 72 | throw 73 | true 74 | try 75 | typeof 76 | uint 77 | ulong 78 | unchecked 79 | unsafe 80 | ushort 81 | using 82 | value 83 | var 84 | virtual 85 | void 86 | volatile 87 | where 88 | while 89 | yield 90 | -------------------------------------------------------------------------------- /test/test.cpp: -------------------------------------------------------------------------------- 1 | 2 | main() 3 | { 4 | f 5 | 6 | return 0; 7 | return; 8 | zyx 9 | } 10 | hoge ) 11 | if( ) { 12 | 13 | QString curdir = QDir::currentPath(); 14 | qDebug() << "cur = " << cur; 15 | 16 | abc_xyz_txt 17 | 18 | abc_xyz_txttxt 19 | 20 | abc_xyz_zzz 21 | abc_xyz_zzzzzz 22 | 23 | 123 24 | #include < 25 | 26 | bool a = false; // 27 | uns 28 | 29 | #include < 30 | fo 31 | 11111 32 | void MainWindow::onRecieved(const QString args) 33 | { 34 | qDebug() << "onRecieved(" << txt << ")"; 35 | if( txt.isEmpty() || txt == ":" ) 36 | on_action_NewWindow_triggered(); 37 | else { 38 | auto lst = txt.split("\t"); 39 | } 40 | //assert(0); 41 | } 42 | 43 | 22222 44 | main() { 45 | { 46 | dldldl 47 | } 48 | } 49 | 33333 50 | 44444 51 | 5555 52 | 6666(【】) 53 | hoge::hoge() 54 | { 55 | 0 hoge() hoge hoge 56 | 0 hogehoge(123) hoge 57 | 0 hoge() hoge 58 | 0 hoge() hoge 59 | 0 hoge() hoge 60 | xyzF() xxhoge 61 | hdx() hoge 62 | dx() hoge 63 | dx() hogeoe 64 | hoge() hoge 65 | hoge() hoge 66 | } 67 | -------------------------------------------------------------------------------- /funcs.md: -------------------------------------------------------------------------------- 1 | # 機能 2 | ## メインウィンドウ 3 | - [X] MDITabs 4 | 5 | ## ファイル 6 | - [X] File > New 7 | - [X] File > Open 8 | - [X] File > Close 9 | - [ ] File > Save 10 | - [ ] File > SaveAs 11 | - [ ] File > SaveAll 12 | - [X] File > RecentFiles 13 | - [X] File > FavoriteFiles 14 | 15 | ## 表示 16 | - [X] テキスト・[EOF] 表示 17 | - [X] 行番号表示 18 | - [X] キーワード強調 19 | - [X] ブロック・行コメント色表示 20 | - [ ] 編集行強調(黄) 21 | - [ ] 編集保存行強調(緑) 22 | - [ ] ミニマップ 23 | 24 | ## テキストカーソル 25 | - [X] テキストカーソル表示・ブリンク 26 | - [X] 上下左右移動 27 | - [X] Home, End, C-Home, C-End 28 | - [ ] 選択状態カーソル表示 29 | - [ ] S-上下左右カーソルキーによる選択 30 | - [ ] マウスクリック位置にカーソル設定 31 | - [ ] マウスクリック+ドラッグによるテキスト選択 32 | 33 | ## 編集 34 | - [X] 文字挿入 35 | - [X] カーソル位置文字削除(Del, BackSpace) 36 | - [ ] 削除文字落下アニメーション 37 | - [X] IMEオンザスポット 38 | - [ ] Undo/Redo 39 | - [ ] 選択文字削除(Del, BackSpace) 40 | 41 | ## 検索 42 | - [X] ツールバー:検索ボックス設置 43 | - [ ] 検索処理 44 | - [ ] 順方向・逆方向再検索 45 | - [ ] カーソル位置単語検索 46 | - [ ] マッチテキスト強調(本文・ミニマップ) 47 | - [ ] 置換ダイアログ 48 | - [ ] grep 49 | 50 | ## 設定 51 | - [X] タイプ設定ダイアログ 52 | - [ ] 全体設定ダイアログ 53 | 54 | ## その他 55 | - [ ] About 56 | -------------------------------------------------------------------------------- /vivi/vivi64/CTabWidget.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "CTabWidget.h" 4 | #include "CTabBar.h" 5 | 6 | CTabWidget::CTabWidget(QWidget *parent) 7 | : QTabWidget(parent) 8 | { 9 | setTabBar(new CTabBar()); 10 | } 11 | CTabWidget::~CTabWidget() 12 | { 13 | } 14 | #if 0 15 | int CTabWidget::addTab(QWidget *page, const QIcon &icon, const QString &label) 16 | { 17 | int rc = QTabWidget::addTab(page, icon, label); 18 | auto tb = tabBar(); 19 | auto g = tb->geometry(); 20 | g.setWidth(g.width() + 100); 21 | tb->setGeometry(g); 22 | //auto sz = tb->size(); 23 | //tb->resize(sz.width()+10, sz.height()); 24 | return rc; 25 | } 26 | #endif 27 | 28 | void CTabWidget::paintEvent(QPaintEvent *event) 29 | { 30 | auto rct = rect(); 31 | QPainter pt(this); 32 | //pt.setBrush(QColor("skyblue")); 33 | pt.setBrush(QColor("#c0c0c0")); 34 | pt.setPen(Qt::transparent); 35 | pt.drawRect(rct); 36 | #if 0 37 | pt.setPen(Qt::black); 38 | pt.drawLine(0, 0, rct.width(), rct.height()); 39 | pt.drawLine(0, rct.height(), rct.width(), 0); 40 | #endif 41 | } 42 | -------------------------------------------------------------------------------- /vivi/vivi64/ClipboardHistDlg.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "ClipboardHistDlg.h" 3 | 4 | ClipboardHistDlg::ClipboardHistDlg(const QStringList &lst, QWidget *parent) 5 | : QDialog(parent) 6 | , m_ix(-1) 7 | { 8 | ui.setupUi(this); 9 | foreach(QString txt, lst) { 10 | txt.replace("\r\n", " "); 11 | txt.replace("\r", " "); 12 | txt.replace("\n", " "); 13 | txt.replace("\t", " "); // 半角空白*2 14 | ui.listWidget->addItem(txt); 15 | } 16 | ui.listWidget->setCurrentRow(0); 17 | connect(ui.listWidget, SIGNAL(itemDoubleClicked(QListWidgetItem *)), 18 | this, SLOT(itemDoubleClicked(QListWidgetItem *))); 19 | } 20 | ClipboardHistDlg::~ClipboardHistDlg() 21 | { 22 | } 23 | void ClipboardHistDlg::accept () 24 | { 25 | m_ix = ui.listWidget->currentRow(); 26 | QDialog::accept(); 27 | } 28 | void ClipboardHistDlg::itemDoubleClicked( QListWidgetItem * item ) 29 | { 30 | accept(); 31 | } 32 | #if 0 33 | void ClipboardHistDlg::closeEvent(QCloseEvent *event) 34 | { 35 | m_ix = ui.listWidget->currentRow(); 36 | QDialog::closeEvent(event); 37 | } 38 | #endif 39 | -------------------------------------------------------------------------------- /vivi/vivi64/singleapplication.h: -------------------------------------------------------------------------------- 1 | #ifndef SINGLEAPPLICATION_H 2 | #define SINGLEAPPLICATION_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | 10 | class SingleApplication : public QApplication 11 | { 12 | Q_OBJECT 13 | 14 | public: 15 | SingleApplication(int &argc, char *argv[], const QString uniqKeyString); 16 | 17 | public: 18 | bool isFirstApp(); // 最初のインスタンスか? 19 | // 最初に起動されたインスタンスへメッセージ送信 20 | void sendMessage(const QString &text); 21 | 22 | public slots: 23 | void onAccepted(); 24 | void onReadyRead(); // 2度目以降に起動されたインスタンスからのメッセージ受信 25 | 26 | protected: 27 | #ifdef WIN32 28 | bool winEventFilter ( MSG * msg, long * result ); 29 | #endif 30 | 31 | signals: 32 | void onRecieved(const QString); // 2度目以降に起動されたインスタンスからのメッセージ受信 33 | void imeOpenStatusChanged(); 34 | 35 | private: 36 | bool m_connected; 37 | const QString m_uniqKeyString; 38 | QLocalSocket m_localSocket; 39 | QLocalServer m_localServer; 40 | QLocalSocket *m_sock; 41 | }; 42 | 43 | #endif // SINGLEAPPLICATION_H 44 | -------------------------------------------------------------------------------- /vivi/vivi64/GrepDlg.h: -------------------------------------------------------------------------------- 1 | #ifndef GREPDLG_H 2 | #define GREPDLG_H 3 | 4 | #include 5 | #include 6 | #include "ui_GrepDlg.h" 7 | 8 | class GlobalSettings; 9 | 10 | class GrepDlg : public QDialog 11 | { 12 | Q_OBJECT 13 | 14 | public: 15 | GrepDlg(GlobalSettings *globSettings, const QStringList &, int, QWidget *parent = 0); 16 | ~GrepDlg(); 17 | 18 | public: 19 | QString findString() const; 20 | QString extentions() const; 21 | QString dir() const; 22 | QString exclude() const; 23 | bool ignoreCase() const; 24 | bool wholeWordOnly() const; 25 | bool regExp() const; 26 | bool grepSubDir() const; 27 | bool grepView() const; 28 | 29 | public: 30 | void setFindString(const QString &); 31 | void setTypeName(const QString &); 32 | 33 | protected: 34 | void keyPressEvent(QKeyEvent *); 35 | 36 | protected slots: 37 | void dirViewDoubleClicked ( QModelIndex index ); 38 | void dirViewClicked ( QModelIndex index ); 39 | void regexpHelp(); 40 | 41 | private: 42 | Ui::GrepDlg ui; 43 | GlobalSettings *m_globSettings; 44 | QFileSystemModel m_fileSystemModel; 45 | }; 46 | 47 | #endif // GREPDLG_H 48 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Nobuhide Tsuda 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /vivi/buffer-000/viewLineMgr.h: -------------------------------------------------------------------------------- 1 | #include "gap_buffer.h" 2 | 3 | class Buffer; 4 | 5 | struct ViewLine 6 | { 7 | public: 8 | enum { 9 | HEADING = 0x0001, 10 | }; 11 | public: 12 | ViewLine(int docLine = 0, int offset = 0 /*, int flags = 0*/) 13 | : m_docLine(docLine) 14 | , m_offset(offset) 15 | //, m_flags(flags) 16 | {} 17 | ViewLine(const ViewLine &x) 18 | : m_docLine(x.m_docLine) 19 | , m_offset(x.m_offset) 20 | //, m_flags(x.m_flags) 21 | {} 22 | public: 23 | int m_docLine; 24 | int m_offset; // 表示開始オフセット 25 | //int m_flags; 26 | }; 27 | 28 | class ViewLineMgr 29 | { 30 | public: 31 | ViewLineMgr(Buffer *); 32 | 33 | public: 34 | bool isEmpty() const; // テーブルが空か? 35 | int size() const; // テーブルサイズ 36 | int EOFLine() const; 37 | int viewLineToDocLine(int ln) const; 38 | int docLineToViewLine(int ln) const; 39 | bool isCollapsed(int vln) const; 40 | 41 | public: 42 | void clear(); 43 | void inserted(int dln, int d); 44 | void deleted(int dln, int d); // d should be > 0 45 | void collapse(int ln1, int ln2); // (ln1, ln2) 行を削除 46 | void expand(int ln); 47 | 48 | void doLayoutAll(); 49 | 50 | private: 51 | Buffer *m_buffer; 52 | gap_buffer m_lv; // ビュー行→バッファ行変換テーブル 53 | }; 54 | -------------------------------------------------------------------------------- /vivi/vivi64/TypeStgDlg.h: -------------------------------------------------------------------------------- 1 | #ifndef TYPESTGDLG_H 2 | #define TYPESTGDLG_H 3 | 4 | #include 5 | #include "ui_TypeStgDlg.h" 6 | 7 | class TypeSettings; 8 | class EditView; 9 | 10 | class TypeStgDlg : public QDialog 11 | { 12 | Q_OBJECT 13 | 14 | public: 15 | TypeStgDlg(EditView *, TypeSettings *typeStg, QWidget *parent = 0); 16 | ~TypeStgDlg(); 17 | 18 | protected: 19 | void setupColorButtons(); 20 | void setupCheckButtons(); 21 | void selectColor(int); 22 | void setFontFamily(const QString &); 23 | 24 | protected slots: 25 | void btnSelectColor(); 26 | void selectColor(); 27 | void namedColor(); 28 | void onCheckToggled(bool); 29 | void onReset(); 30 | void onLoad(); 31 | void onSave(); 32 | void onFontNameChanged(const QString &); 33 | void onFontSizeChanged(int); 34 | void onTab2(bool); 35 | void onTab4(bool); 36 | void onTab8(bool); 37 | void onCommentChanged(); 38 | void onKeyword1Edited(const QString &); 39 | void onKeyword2Edited(const QString &); 40 | void refKW1Clicked(); 41 | void refKW2Clicked(); 42 | void accept(); 43 | 44 | private: 45 | Ui::TypeStgDlg ui; 46 | EditView *m_view; 47 | TypeSettings *m_typeSettings; 48 | QHash m_ixToButtonHash; 49 | }; 50 | 51 | #endif // TYPESTGDLG_H 52 | -------------------------------------------------------------------------------- /vivi/keywords/fs.txt: -------------------------------------------------------------------------------- 1 | #light 2 | abstract 3 | and 4 | as 5 | asr 6 | assert 7 | atomic 8 | base 9 | begin 10 | break 11 | checked 12 | class 13 | component 14 | const 15 | constraint 16 | constructor 17 | continue 18 | default 19 | delegate 20 | do 21 | done 22 | downcast 23 | downto 24 | eager 25 | elif 26 | else 27 | end 28 | exception 29 | extern 30 | false 31 | finally 32 | fixed 33 | for 34 | fori 35 | fun 36 | function 37 | functor 38 | global 39 | if 40 | in 41 | include 42 | inherit 43 | inline 44 | interface 45 | internal 46 | land 47 | lazy 48 | let 49 | let 50 | let! 51 | lor 52 | lsl 53 | lsr 54 | lxor 55 | match 56 | member 57 | method 58 | mixin 59 | mod 60 | module 61 | mutable 62 | namespace 63 | new 64 | not 65 | null 66 | object 67 | of 68 | open 69 | or 70 | override 71 | parallel 72 | params 73 | private 74 | process 75 | protected 76 | public 77 | pure 78 | rec 79 | return 80 | return! 81 | sealed 82 | select 83 | sig 84 | static 85 | struct 86 | tailcall 87 | then 88 | to 89 | trait 90 | true 91 | try 92 | type 93 | upcast 94 | use 95 | use! 96 | val 97 | virtual 98 | void 99 | volatile 100 | when 101 | while 102 | with 103 | yield 104 | yield! 105 | -------------------------------------------------------------------------------- /vivi/buffer/viewLineMgr-000.h: -------------------------------------------------------------------------------- 1 | #include "gap_buffer.h" 2 | 3 | class Buffer; 4 | 5 | struct ViewLine 6 | { 7 | public: 8 | enum { 9 | HEADING = 0x0001, 10 | }; 11 | public: 12 | ViewLine(int docLine = 0, int offset = 0 /*, int flags = 0*/) 13 | : m_docLine(docLine) 14 | , m_offset(offset) 15 | //, m_flags(flags) 16 | {} 17 | ViewLine(const ViewLine &x) 18 | : m_docLine(x.m_docLine) 19 | , m_offset(x.m_offset) 20 | //, m_flags(x.m_flags) 21 | {} 22 | public: 23 | int m_docLine; 24 | int m_offset; // 表示開始オフセット 25 | //int m_flags; 26 | }; 27 | 28 | class ViewLineMgr 29 | { 30 | public: 31 | ViewLineMgr(Buffer *); 32 | 33 | public: 34 | bool isEmpty() const; // テーブルが空か? 35 | int size() const; // テーブルサイズ 36 | int viewLineCount() const; 37 | int EOFLine() const; 38 | int viewLineToDocLine(int ln) const; 39 | int docLineToViewLine(int ln) const; 40 | bool isCollapsed(int vln) const; 41 | 42 | public: 43 | void clear(); 44 | void inserted(int dln, int d); 45 | void deleted(int dln, int d); // d should be > 0 46 | void collapse(int ln1, int ln2); // (ln1, ln2) 行を削除 47 | void expand(int ln); 48 | 49 | void doLayoutAll(); 50 | 51 | private: 52 | Buffer *m_buffer; 53 | gap_buffer m_lv; // ビュー行→バッファ行変換テーブル 54 | }; 55 | -------------------------------------------------------------------------------- /vivi/keywords/cpp.txt: -------------------------------------------------------------------------------- 1 | // C/C++ キーワード 2 | // 3 | // 97/06/01 VC5の予約語(bool、explicit、false、mutable、true、typename)を追加 4 | // 05/12/15 const_cast, dynamic_cast, namespace, reinterpret_cast, static_cast, 5 | // typeid using, wchar_t を追加 6 | // # に存在するキーワードを削除 7 | 8 | #define 9 | #elif 10 | #else 11 | #endif 12 | #error 13 | #if 14 | #ifdef 15 | #ifndef 16 | #include 17 | #line 18 | #pragma 19 | #undef 20 | __FILE__ ファイル名 21 | __LINE__ 22 | __declspec 23 | asm 24 | auto 25 | bool 26 | break 27 | case 28 | catch 29 | char 30 | class 31 | const 32 | const_cast 33 | continue 34 | default 35 | define 36 | defined 37 | delete 38 | do 39 | double 40 | dynamic_cast 41 | elif 42 | else 43 | endif 44 | enum 45 | error 46 | explicit 47 | extern 48 | false 49 | float 50 | for 51 | friend 52 | goto 53 | if 54 | ifdef 55 | ifndef 56 | include 57 | inline 58 | int 59 | long 60 | max_align_t 61 | mutable 62 | namespace 63 | new 64 | nullptr_t 65 | operator 66 | pragma 67 | private 68 | protected 69 | ptrdiff_t 70 | public 71 | register 72 | reinterpret_cast 73 | return 74 | short 75 | signed 76 | size_t 77 | sizeof 78 | static 79 | static_cast 80 | struct 81 | switch 82 | template 83 | this 84 | throw 85 | true 86 | try 87 | typedef 88 | typeid 89 | typename 90 | undef 91 | union 92 | unsigned 93 | using 94 | virtual 95 | void 96 | volatile 97 | wchar_t 98 | while 99 | -------------------------------------------------------------------------------- /vivi/keywords/Pascal.txt: -------------------------------------------------------------------------------- 1 | absolute 2 | abstract 3 | and 4 | array 5 | as 6 | asm 7 | assembler 8 | automated 9 | begin 10 | case 11 | cdecl 12 | class 13 | const 14 | constructor 15 | contains 16 | default 17 | delayed 18 | deprecated 19 | destructor 20 | dispid 21 | dispinterface 22 | div 23 | do 24 | downto 25 | dynamic 26 | else 27 | end 28 | except 29 | experimental 30 | export 31 | exports 32 | external 33 | far 34 | file 35 | final 36 | finalization 37 | finally 38 | for 39 | forward 40 | function 41 | goto 42 | helper 43 | if 44 | implementation 45 | implements 46 | in 47 | index 48 | inherited 49 | initialization 50 | inline 51 | inline 52 | interface 53 | is 54 | label 55 | library 56 | library 57 | local 58 | message 59 | mod 60 | name 61 | near 62 | nil 63 | nodefault 64 | not 65 | object 66 | of 67 | operator 68 | or 69 | out 70 | overload 71 | override 72 | package 73 | packed 74 | pascal 75 | platform 76 | private 77 | procedure 78 | program 79 | property 80 | protected 81 | public 82 | published 83 | raise 84 | read 85 | readln 86 | readonly 87 | record 88 | reference 89 | register 90 | reintroduce 91 | repeat 92 | requires 93 | resident 94 | resourcestring 95 | safecall 96 | sealed 97 | set 98 | shl 99 | shr 100 | static 101 | stdcall 102 | stored 103 | strict 104 | string 105 | then 106 | threadvar 107 | to 108 | try 109 | type 110 | unit 111 | unsafe 112 | until 113 | uses 114 | var 115 | varargs 116 | virtual 117 | while 118 | winapi 119 | with 120 | write 121 | writeln 122 | writeonly 123 | xor 124 | -------------------------------------------------------------------------------- /vivi/vivi64/AutoCompletionDlg.h: -------------------------------------------------------------------------------- 1 | #ifndef AUTOCompletionDLG_H 2 | #define AUTOCompletionDLG_H 3 | 4 | #define BASE_QWIDGET 0 5 | 6 | #include 7 | 8 | class EditView; 9 | class QListWidget; 10 | class QListWidgetItem; 11 | 12 | class AutoCompletionDlg 13 | #if BASE_QWIDGET 14 | : public QWidget 15 | #else 16 | : public QDialog 17 | #endif 18 | { 19 | Q_OBJECT 20 | 21 | public: 22 | AutoCompletionDlg(const QStringList &, QString = QString(), bool = false, QWidget *parent = 0); 23 | ~AutoCompletionDlg(); 24 | 25 | public: 26 | QString text() const; // カレントテキストを返す 27 | int count() const; 28 | 29 | public: 30 | void nextRow(); 31 | void prevRow(); 32 | void setFilterText(const QString &); 33 | bool appendFilterText(const QString &); // 絞込テキストに追加 34 | void setFilterCaseSensitive(bool b) { m_filterCaseSensitive = b; } 35 | void setResizable(bool b); 36 | 37 | protected: 38 | bool eventFilter ( QObject * watched, QEvent * event ); 39 | void keyPressEvent(QKeyEvent *event); 40 | //void focusOutEvent ( QFocusEvent * event ); // フォーカスは QListWidget が元々持っているので効かない 41 | 42 | protected slots: 43 | void itemDoubleClicked ( QListWidgetItem * item ); 44 | 45 | signals: 46 | //void focusOut(); 47 | void decided(QString, bool = false); 48 | void keyPressed(QString); 49 | void backSpace(); 50 | void delPressed(bool ctrl, bool shift); 51 | void leftPressed(bool ctrl, bool shift); 52 | void rightPressed(bool ctrl, bool shift); 53 | void zenCoding(); 54 | void pasted(); 55 | 56 | private: 57 | const QStringList m_candidates; // 絞込前のリスト 58 | bool m_filterCaseSensitive; // 絞込時:大文字小文字区別 59 | QString m_filterText; // 絞り込みテキスト 60 | QListWidget *m_listWidget; 61 | }; 62 | 63 | #endif // AUTOCompletionDLG_H 64 | -------------------------------------------------------------------------------- /vivi/colors/white.stg: -------------------------------------------------------------------------------- 1 | colorText = #000000 2 | colorBackGround = #ffffff 3 | colorSelText = #000000 4 | colorSelBG = #98fb98 5 | colorPreEditBG = #e0e0e0 6 | colorDelText = #808080 7 | colorString = #800080 8 | colorDigits = #d2691e 9 | colorComment = #00c000 10 | colorHTML = #a52a2a 11 | colorKeyWord1 = #0000ff 12 | colorKeyWord2 = #a52a2a 13 | colorKeyWord3 = #8b0000 14 | colorTab = #add8e6 15 | colorZenSpace = #add8e6 16 | colorNewLine = #add8e6 17 | colorEOF = #0000ff 18 | colorMarkBG = #add8e6 19 | colorMatchedBG = #ffd700 20 | colorCurWordBG = #ffffff 21 | colorMatchParenBG = #d3d3d3 22 | colorCursor = #ff0000 23 | colorLineCursor = #ff0000 24 | colorLineNum = #000000 25 | colorLineNumBG = #e0e0e0 26 | colorLineModified = #ffff00 27 | colorLineSaved = #90ee90 28 | colorURL = blue 29 | boolTab = on 30 | boolZenSpace = on 31 | boolNewLine = on 32 | boolLineNum = on 33 | boolMarkBG = on 34 | boolHTMLTag = off 35 | boolCurWordBG = on 36 | boolJumpEOF = off 37 | boolIgnoreCaseKW1 = off 38 | boolIgnoreCaseKW2 = off 39 | boolKeyWord1Bold = off 40 | boolKeyWord2Bold = off 41 | boolKeyWord3Bold = off 42 | intFontSize = 16 43 | intTabWidth = 4 44 | textFontName = MS ゴシック 45 | textLineComment = 46 | textBlockCommentBeg = 47 | textBlockCommentEnd = 48 | textKeyWord1File = 49 | textKeyWord2File = 50 | textKeyWord3File = 51 | textShortText0 = 52 | textShortText1 = 53 | textShortText2 = 54 | textShortText3 = 55 | textShortText4 = 56 | textShortText5 = 57 | textShortText6 = 58 | textShortText7 = 59 | textShortText8 = 60 | textShortText9 = 61 | textShortTextSel0 = 62 | textShortTextSel1 = 63 | textShortTextSel2 = 64 | textShortTextSel3 = 65 | textShortTextSel4 = 66 | textShortTextSel5 = 67 | textShortTextSel6 = 68 | textShortTextSel7 = 69 | textShortTextSel8 = 70 | textShortTextSel9 = 71 | -------------------------------------------------------------------------------- /vivi/colors/darkblue.stg: -------------------------------------------------------------------------------- 1 | colorText = #dcdcdc 2 | colorBackGround = #000071 3 | colorSelText = #000000 4 | colorSelBG = #98fb98 5 | colorPreEditBG = #37461e 6 | colorDelText = #808080 7 | colorString = #ffc0cb 8 | colorDigits = #d2691e 9 | colorComment = #00c000 10 | colorHTML = #a52a2a 11 | colorKeyWord1 = #deb887 12 | colorKeyWord2 = #00d0d0 13 | colorKeyWord3 = #8b0000 14 | colorTab = #6d8991 15 | colorZenSpace = #add8e6 16 | colorNewLine = #add8e6 17 | colorEOF = #0000ff 18 | colorMarkBG = #add8e6 19 | colorMatchedBG = #9d8300 20 | colorCurWordBG = #424200 21 | colorMatchParenBG = #66868a 22 | colorCursor = #ff6c03 23 | colorLineCursor = #ff0000 24 | colorLineNum = #e1e1e1 25 | colorLineNumBG = #00008b 26 | colorLineModified = #ffff00 27 | colorLineSaved = #90ee90 28 | colorURL = blue 29 | boolTab = on 30 | boolZenSpace = on 31 | boolNewLine = on 32 | boolLineNum = on 33 | boolMarkBG = on 34 | boolHTMLTag = off 35 | boolCurWordBG = on 36 | boolJumpEOF = off 37 | boolIgnoreCaseKW1 = off 38 | boolIgnoreCaseKW2 = off 39 | boolKeyWord1Bold = on 40 | boolKeyWord2Bold = off 41 | boolKeyWord3Bold = off 42 | intFontSize = 14 43 | intTabWidth = 4 44 | textFontName = メイリオ 45 | textLineComment = // 46 | textBlockCommentBeg = /* 47 | textBlockCommentEnd = */ 48 | textKeyWord1File = cpp.txt 49 | textKeyWord2File = Qt5.txt 50 | textKeyWord3File = 51 | textShortText0 = 52 | textShortText1 = 53 | textShortText2 = 54 | textShortText3 = 55 | textShortText4 = 56 | textShortText5 = 57 | textShortText6 = 58 | textShortText7 = 59 | textShortText8 = 60 | textShortText9 = 61 | textShortTextSel0 = /*,*/ 62 | textShortTextSel1 = 63 | textShortTextSel2 = 64 | textShortTextSel3 = 65 | textShortTextSel4 = 66 | textShortTextSel5 = 67 | textShortTextSel6 = 68 | textShortTextSel7 = 69 | textShortTextSel8 = 70 | textShortTextSel9 = 71 | -------------------------------------------------------------------------------- /vivi/vivi64/CommandLine.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "CommandLine.h" 3 | 4 | CommandLine::CommandLine(QWidget *parent) 5 | : QLineEdit(parent) 6 | { 7 | } 8 | 9 | CommandLine::~CommandLine() 10 | { 11 | } 12 | void CommandLine::focusOutEvent( QFocusEvent * event ) 13 | { 14 | QLineEdit::focusOutEvent(event); 15 | emit focusOut(); 16 | } 17 | void CommandLine::keyPressEvent(QKeyEvent *event) 18 | { 19 | const bool ctrl = (event->modifiers() & Qt::ControlModifier) != 0; 20 | const bool shift = (event->modifiers() & Qt::ShiftModifier) != 0; 21 | const bool alt = (event->modifiers() & Qt::AltModifier) != 0; 22 | if( event->key() == Qt::Key_Backspace 23 | && !hasSelectedText() && cursorPosition() == 1 ) 24 | { 25 | emit escPressed(); 26 | return; 27 | } 28 | if( event->key() == Qt::Key_Home ) { 29 | setCursorPosition(1); 30 | return; 31 | } 32 | if( event->key() == Qt::Key_Up ) { 33 | emit upPressed(); 34 | return; 35 | } 36 | if( event->key() == Qt::Key_Down ) { 37 | emit downPressed(); 38 | return; 39 | } 40 | if( event->key() == Qt::Key_Left && cursorPosition() == 1 ) { 41 | return; 42 | } 43 | if( event->key() == Qt::Key_A && ctrl ) { 44 | setSelection(1, text().size()); 45 | return; 46 | } 47 | QLineEdit::keyPressEvent(event); // 基底クラスの処理 48 | if( event->key() == Qt::Key_Escape ) { 49 | emit escPressed(); 50 | } 51 | if( event->key() == Qt::Key_Space ) { 52 | emit spacePressed(); 53 | } 54 | if( event->key() == Qt::Key_Slash || event->key() == Qt::Key_Backslash ) { 55 | emit slashPressed(); // ディレクトリ区切り文字が入力された 56 | } 57 | if( event->key() == Qt::Key_Colon) { 58 | emit colonPressed(); 59 | } 60 | if( event->key() == Qt::Key_Tab) { 61 | emit tabPressed(); 62 | } 63 | } 64 | bool CommandLine::focusNextPrevChild(bool next) 65 | { 66 | return false; 67 | } 68 | -------------------------------------------------------------------------------- /vivi/colors/black.stg: -------------------------------------------------------------------------------- 1 | colorText = #dcdcdc 2 | colorBackGround = #000000 3 | colorSelText = #000000 4 | colorSelBG = #98fb98 5 | colorPreEditBG = #37461e 6 | colorDelText = #808080 7 | colorString = #ffc0cb 8 | colorDigits = #d2691e 9 | colorComment = #00c000 10 | colorHTML = #a52a2a 11 | colorKeyWord1 = #deb887 12 | colorKeyWord2 = #00d0d0 13 | colorKeyWord3 = #8b0000 14 | colorTab = #6d8991 15 | colorZenSpace = #add8e6 16 | colorNewLine = #add8e6 17 | colorEOF = #0000ff 18 | colorMarkBG = #add8e6 19 | colorMatchedBG = #9d8300 20 | colorCurWordBG = #424200 21 | colorMatchParenBG = #66868a 22 | colorCursor = #ff6c03 23 | colorLineCursor = #ff0000 24 | colorLineNum = #e1e1e1 25 | colorLineNumBG = #4f4f4f 26 | colorLineModified = #ffff00 27 | colorLineSaved = #90ee90 28 | colorURL = blue 29 | boolTab = on 30 | boolZenSpace = on 31 | boolNewLine = on 32 | boolLineNum = on 33 | boolMarkBG = on 34 | boolHTMLTag = off 35 | boolCurWordBG = on 36 | boolLineCursor = on 37 | boolJumpEOF = off 38 | boolIgnoreCaseKW1 = off 39 | boolIgnoreCaseKW2 = off 40 | boolKeyWord1Bold = on 41 | boolKeyWord2Bold = off 42 | boolKeyWord3Bold = off 43 | intFontSize = 15 44 | intTabWidth = 4 45 | textFontName = メイリオ 46 | textLineComment = // 47 | textBlockCommentBeg = /* 48 | textBlockCommentEnd = */ 49 | textKeyWord1File = cpp.txt 50 | textKeyWord2File = Qt5.txt 51 | textKeyWord3File = 52 | textShortText0 = 53 | textShortText1 = 54 | textShortText2 = 55 | textShortText3 = 56 | textShortText4 = 57 | textShortText5 = 58 | textShortText6 = 59 | textShortText7 = 60 | textShortText8 = 61 | textShortText9 = 62 | textShortTextSel0 = /*,*/ 63 | textShortTextSel1 = 64 | textShortTextSel2 = 65 | textShortTextSel3 = 66 | textShortTextSel4 = 67 | textShortTextSel5 = 68 | textShortTextSel6 = 69 | textShortTextSel7 = 70 | textShortTextSel8 = 71 | textShortTextSel9 = 72 | -------------------------------------------------------------------------------- /vivi/colors/lightyellow.stg: -------------------------------------------------------------------------------- 1 | colorText = #000000 2 | colorBackGround = #fff8dc 3 | colorSelText = #000000 4 | colorSelBG = #98fb98 5 | colorPreEditBG = #e0e0e0 6 | colorDelText = #808080 7 | colorString = #800080 8 | colorDigits = #d2691e 9 | colorComment = #00c000 10 | colorHTML = #a52a2a 11 | colorKeyWord1 = #0270ff 12 | colorKeyWord2 = #a52a2a 13 | colorKeyWord3 = #8b0000 14 | colorTab = #add8e6 15 | colorZenSpace = #add8e6 16 | colorNewLine = #add8e6 17 | colorEOF = #0000ff 18 | colorMarkBG = #add8e6 19 | colorMatchedBG = #ffd700 20 | colorCurWordBG = #ffffff 21 | colorMatchParenBG = #ffff00 22 | colorCursor = #ff0000 23 | colorLineCursor = #ff0000 24 | colorLineNum = #000000 25 | colorLineNumBG = #e0e0e0 26 | colorLineModified = #ffff00 27 | colorLineSaved = #90ee90 28 | colorURL = blue 29 | boolTab = on 30 | boolZenSpace = on 31 | boolNewLine = on 32 | boolLineNum = on 33 | boolMarkBG = on 34 | boolHTMLTag = on 35 | boolCurWordBG = on 36 | boolJumpEOF = off 37 | boolIgnoreCaseKW1 = off 38 | boolIgnoreCaseKW2 = off 39 | boolKeyWord1Bold = on 40 | boolKeyWord2Bold = off 41 | boolKeyWord3Bold = off 42 | intFontSize = 12 43 | intTabWidth = 4 44 | textFontName = メイリオ 45 | textLineComment = 46 | textBlockCommentBeg = 48 | textKeyWord1File = html.txt 49 | textKeyWord2File = 50 | textKeyWord3File = 51 | textShortText0 =

52 | textShortText1 =
53 | textShortText2 = 54 | textShortText3 = 55 | textShortText4 = 56 | textShortText5 = 57 | textShortText6 = 58 | textShortText7 = 59 | textShortText8 = 60 | textShortText9 = 61 | textShortTextSel0 = , 62 | textShortTextSel1 = , 63 | textShortTextSel2 = 64 | textShortTextSel3 = 65 | textShortTextSel4 = 66 | textShortTextSel5 = 67 | textShortTextSel6 = 68 | textShortTextSel7 = 69 | textShortTextSel8 = 70 | textShortTextSel9 = 71 | -------------------------------------------------------------------------------- /vivi/colors/Black_LILIN.stg: -------------------------------------------------------------------------------- 1 | colorText = #dcdcdc 2 | colorBackGround = #000000 3 | colorSelText = #000000 4 | colorSelBG = #aaffff 5 | colorPreEditBG = #37461e 6 | colorDelText = #808080 7 | colorString = #aa0000 8 | colorDigits = #d2691e 9 | colorComment = #666666 10 | colorHTML = #a52a2a 11 | colorKeyWord1 = #55aa00 12 | colorKeyWord2 = #00d0d0 13 | colorKeyWord3 = #8b0000 14 | colorTab = #232d30 15 | colorZenSpace = #add8e6 16 | colorNewLine = #181e21 17 | colorEOF = #707070 18 | colorMarkBG = #add8e6 19 | colorMatchedBG = #9d8300 20 | colorCurWordBG = #424200 21 | colorMatchParenBG = #0000ff 22 | colorCursor = #ff5500 23 | colorLineCursor = #5e5e5e 24 | colorLineNum = #006695 25 | colorLineNumBG = #141414 26 | colorLineModified = #141414 27 | colorLineSaved = #141414 28 | colorURL = blue 29 | boolTab = on 30 | boolZenSpace = on 31 | boolNewLine = off 32 | boolLineNum = on 33 | boolMarkBG = on 34 | boolHTMLTag = off 35 | boolCurWordBG = on 36 | boolLineCursor = off 37 | boolJumpEOF = off 38 | boolIgnoreCaseKW1 = on 39 | boolIgnoreCaseKW2 = off 40 | boolKeyWord1Bold = off 41 | boolKeyWord2Bold = off 42 | boolKeyWord3Bold = off 43 | intFontSize = 14 44 | intTabWidth = 4 45 | textFontName = Consolas 46 | textLineComment = // 47 | textBlockCommentBeg = /* 48 | textBlockCommentEnd = */ 49 | textKeyWord1File = cpp.txt 50 | textKeyWord2File = Qt5.txt 51 | textKeyWord3File = 52 | textShortText0 = 53 | textShortText1 = 54 | textShortText2 = 55 | textShortText3 = 56 | textShortText4 = 57 | textShortText5 = 58 | textShortText6 = 59 | textShortText7 = 60 | textShortText8 = 61 | textShortText9 = 62 | textShortTextSel0 = /*,*/ 63 | textShortTextSel1 = 64 | textShortTextSel2 = 65 | textShortTextSel3 = 66 | textShortTextSel4 = 67 | textShortTextSel5 = 68 | textShortTextSel6 = 69 | textShortTextSel7 = 70 | textShortTextSel8 = 71 | textShortTextSel9 = 72 | -------------------------------------------------------------------------------- /vivi/vivi64/singleapplication.cpp: -------------------------------------------------------------------------------- 1 | #include "SingleApplication.h" 2 | #include 3 | #include 4 | 5 | SingleApplication::SingleApplication(int &argc, char *argv[], const QString uniqKeyString) 6 | : m_connected(false), m_uniqKeyString(uniqKeyString), QApplication(argc, argv) 7 | { 8 | connect(&m_localServer, SIGNAL(newConnection()), this, SLOT(onAccepted())); 9 | connect(&m_localServer, SIGNAL(readyRead()), this, SLOT(onReadyRead())); 10 | } 11 | 12 | bool SingleApplication::isFirstApp() 13 | { 14 | m_localSocket.connectToServer(m_uniqKeyString); 15 | if( m_localSocket.waitForConnected(200) ) { 16 | return false; 17 | } else { 18 | m_localServer.listen(m_uniqKeyString); 19 | return true; 20 | } 21 | } 22 | void SingleApplication::onAccepted() 23 | { 24 | #if 1 25 | //QLocalSocket * 26 | m_sock = m_localServer.nextPendingConnection(); 27 | //sock->waitForReadyRead(30*1000); 28 | connect(m_sock, SIGNAL(readyRead()), this, SLOT(onReadyRead())); 29 | #endif 30 | } 31 | void SingleApplication::onReadyRead() 32 | { 33 | //QLocalSocket *sock = m_localServer.nextPendingConnection(); 34 | QByteArray ba = m_sock->readAll(); 35 | QTextCodec *codec = QTextCodec::codecForName("UTF-8"); 36 | QString buff = codec->toUnicode(ba); 37 | emit onRecieved(buff); 38 | } 39 | // 最初に起動されたインスタンスへメッセージ送信 40 | void SingleApplication::sendMessage(const QString &text) 41 | { 42 | m_localSocket.write(text.toUtf8()); 43 | m_localSocket.flush(); 44 | if( !m_localSocket.waitForBytesWritten(1000) ) { 45 | return; 46 | } 47 | } 48 | bool SingleApplication::winEventFilter( MSG * msg, long * result ) 49 | { 50 | if( msg->message == WM_IME_NOTIFY ) { 51 | qDebug() << "winEventFilter()"; 52 | DWORD dwCommand = (DWORD) msg->wParam; 53 | if( dwCommand == IMN_SETOPENSTATUS ) // IME ON 54 | emit imeOpenStatusChanged(); 55 | } 56 | return false; 57 | } 58 | -------------------------------------------------------------------------------- /testSpec/search.md: -------------------------------------------------------------------------------- 1 | # 検索 テスト仕様書 2 | 3 | |Key・操作|条件|期待される結果| 4 | |---|----|----| 5 | |Ctrl+F|挿入・上書きモード、非選択状態|検索BOXにフォーカス移動、検索BOXに文字列がある場合は選択、検索オプション無変化| 6 | |Ctrl+F|挿入・上書きモード、選択状態|検索BOXにフォーカス移動、検索BOXに被選択文字列設定、検索オプション無変化| 7 | | |vi・exモード|無視| 8 | | |検索BOXフォーカス|無視| 9 | |Ctrl+F3|挿入・上書きモード、非選択状態|検索BOXにフォーカス移動、カーソル位置単語を検索BOXに設定、単語単位検索オプション強制ON| 10 | |Ctrl+F3|挿入・上書きモード、選択状態|検索BOXにフォーカス移動、検索BOXに被選択文字列設定、単語単位検索オプション強制ON| 11 | | |vi・exモード|無視| 12 | | |検索BOXフォーカス|無視| 13 | |通常文字|検索BOXフォーカス|検索BOXに文字列挿入、インクリメンタルサーチ、検索マッチ強調| 14 | |BackSpace|検索BOXフォーカス|検索BOX文字列削除、インクリメンタルサーチ、検索マッチ強調| 15 | |Delete|検索BOXフォーカス|検索BOX文字列削除、インクリメンタルサーチ、検索マッチ強調| 16 | |コピペ|検索BOXフォーカス|検索BOX内コピペ、インクリメンタルサーチ、検索マッチ強調| 17 | |←・→|検索BOXフォーカス|検索BOX内カーソル移動、インクリメンタルサーチ、検索マッチ強調| 18 | |↑・↓|検索BOXフォーカス|検索履歴に置換、インクリメンタルサーチ、検索マッチ強調| 19 | |Enter|検索BOXフォーカス|順方向検索、フォーカスは検索BOXのまま| 20 | |Shift+Enter|検索BOXフォーカス|逆方向検索、フォーカスは検索BOXのまま| 21 | |Esc|検索BOXフォーカス|ビューにフォーカス移動、検索マッチ強調解除?| 22 | |Esc|挿入・上書きモード|検索マッチ強調解除| 23 | |F3|検索BOXフォーカス|順方向検索、フォーカスは検索BOXのまま| 24 | |Shift+F3|検索BOXフォーカス|逆方向検索、フォーカスは検索BOXのまま| 25 | |検索オプション変更|検索BOXフォーカス|変更されたオプションで順方向検索、フォーカスは検索BOXのまま| 26 | |ビュークリック|検索BOXフォーカス|ビューにフォーカス移動、検索マッチ強調解除?| 27 | |/・?|viモード|ステータスバーにコマンドライン表示、ex(/?)モード遷移、正規表現オプションを強制ON| 28 | |通常文字|/?検索モード|コマンドラインに文字列挿入、インクリメンタルサーチ、検索マッチ強調| 29 | |BackSpace|/?検索モード|コマンドライン文字列削除、インクリメンタルサーチ、検索マッチ強調| 30 | |Delete|/?検索モード|コマンドライン字列削除、インクリメンタルサーチ、検索マッチ強調| 31 | |コピペ|/?検索モード|コマンドラインX内コピペ、インクリメンタルサーチ、検索マッチ強調| 32 | |←・→|/?検索モード|コマンドライン内カーソル移動、インクリメンタルサーチ、検索マッチ強調| 33 | |↑・↓|/?検索モード|検索履歴に置換、インクリメンタルサーチ、検索マッチ強調| 34 | |Enter|/?検索モード|viモードに遷移、ビューにフォーカス移動、インクリメンタルサーチ位置のまま、検索マッチ強調そのまま| 35 | |Esc|/?検索モード|viモードに遷移、ビューにフォーカス移動、/?入力時位置にカーソルを戻す、検索マッチ強調解除| 36 | |ビュークリック|/?検索モード|ビューにフォーカス移動、検索マッチ強調そのまま| 37 | | * |viモード|カーソル位置単語順方向検索、単語単位検索オプション強制ON、検索マッチ強調| 38 | |n|viモード|現在の検索オプションに従って順方向再検索、検索マッチ強調| 39 | |N|viモード|現在の検索オプションに従って逆方向再検索、検索マッチ強調| 40 | |Esc|viモード|検索マッチ強調解除| 41 | 42 | ※ インクリメンタルサーチ:常に検索開始位置から現検索パターンが検索される 43 | -------------------------------------------------------------------------------- /vivi/vivi64/charEncoding.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------- 2 | // 3 | // File: "charEncoding.h" 4 | // Created: 03-Mar-2011 5 | // Author: 津田伸秀 6 | // Description: 文字コード判定関数宣言 7 | // 8 | //---------------------------------------------------------------------- 9 | 10 | /* 11 | 12 | Copyright (C) 2011 by Nobuhide Tsuda 13 | 14 | 15 | */ 16 | 17 | #pragma once 18 | 19 | #ifndef _HEADER_CHARENCODING_H 20 | #define _HEADER_CHARENCODING_H 21 | 22 | #include 23 | typedef unsigned char byte; 24 | typedef unsigned __int8 byte_t; 25 | typedef const unsigned char cbyte; 26 | typedef unsigned char uchar; 27 | typedef const char cchar; 28 | typedef const unsigned char cuchar; 29 | 30 | #define UTF8_BOM_LENGTH 3 31 | #define UTF16_BOM_LENGTH 2 32 | 33 | extern uchar UTF8_BOM[]; 34 | extern uchar UTF16LE_BOM[]; 35 | extern uchar UTF16BE_BOM[]; 36 | 37 | namespace CharEncoding { 38 | enum { 39 | UNKNOWN = -1, 40 | UTF8, 41 | UTF16LE, 42 | UTF16BE, 43 | SJIS, 44 | EUC, 45 | N_CHAR_ENC, 46 | }; 47 | enum { 48 | CRLF = 0, 49 | LF, 50 | CR, 51 | }; 52 | } 53 | 54 | inline bool isHankakuKana(uchar uch) 55 | { 56 | return uch >= 0xa1 && uch < 0xe0; 57 | } 58 | inline int isEUCcode(uchar uch) 59 | { 60 | return uch >= 0xa1 && uch <= 0xfe; 61 | } 62 | bool isDBCSLeadByte(uchar ch); 63 | bool isDBCSSecondByte(uchar ch); 64 | uchar checkCharEncoding(cuchar *, cuchar *, int &bomLength); 65 | bool loadFile(const QString& pathName, QString& buf, QString& errMess, uchar& charEncoding, int& bomLength); 66 | //bool loadFile(const QString &, QString &, QString &, uchar * = 0, bool * = 0); 67 | bool getTextCodec(const QString &fileName, QString &errorString, QTextCodec *&codec, 68 | int &bomLength, byte_t &); 69 | 70 | byte_t checkNewLineCode(cbyte *ptr, cbyte *endptr, byte_t charCode); 71 | 72 | #endif //_HEADER_CHARENCODING_H 73 | -------------------------------------------------------------------------------- /vivi/vivi.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.29806.167 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestBuffer", "TestBuffer\TestBuffer.vcxproj", "{43F913F6-9F36-43A2-9885-72EEEB34279A}" 7 | EndProject 8 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vivi64", "vivi64\vivi64.vcxproj", "{20E57EE2-5E9A-4F00-9785-C8A6BA378FE6}" 9 | EndProject 10 | Global 11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 12 | Debug|x64 = Debug|x64 13 | Debug|x86 = Debug|x86 14 | Release|x64 = Release|x64 15 | Release|x86 = Release|x86 16 | EndGlobalSection 17 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 18 | {43F913F6-9F36-43A2-9885-72EEEB34279A}.Debug|x64.ActiveCfg = Debug|x64 19 | {43F913F6-9F36-43A2-9885-72EEEB34279A}.Debug|x64.Build.0 = Debug|x64 20 | {43F913F6-9F36-43A2-9885-72EEEB34279A}.Debug|x86.ActiveCfg = Debug|x64 21 | {43F913F6-9F36-43A2-9885-72EEEB34279A}.Release|x64.ActiveCfg = Release|x64 22 | {43F913F6-9F36-43A2-9885-72EEEB34279A}.Release|x64.Build.0 = Release|x64 23 | {43F913F6-9F36-43A2-9885-72EEEB34279A}.Release|x86.ActiveCfg = Release|x64 24 | {20E57EE2-5E9A-4F00-9785-C8A6BA378FE6}.Debug|x64.ActiveCfg = Debug|x64 25 | {20E57EE2-5E9A-4F00-9785-C8A6BA378FE6}.Debug|x64.Build.0 = Debug|x64 26 | {20E57EE2-5E9A-4F00-9785-C8A6BA378FE6}.Debug|x86.ActiveCfg = Debug|x64 27 | {20E57EE2-5E9A-4F00-9785-C8A6BA378FE6}.Release|x64.ActiveCfg = Release|x64 28 | {20E57EE2-5E9A-4F00-9785-C8A6BA378FE6}.Release|x64.Build.0 = Release|x64 29 | {20E57EE2-5E9A-4F00-9785-C8A6BA378FE6}.Release|x86.ActiveCfg = Release|x64 30 | EndGlobalSection 31 | GlobalSection(SolutionProperties) = preSolution 32 | HideSolutionNode = FALSE 33 | EndGlobalSection 34 | GlobalSection(ExtensibilityGlobals) = postSolution 35 | SolutionGuid = {F0C793A9-0A58-4312-B116-1C0CCD0C33F1} 36 | EndGlobalSection 37 | EndGlobal 38 | -------------------------------------------------------------------------------- /vivi/keywords/HLSL.txt: -------------------------------------------------------------------------------- 1 | #define 2 | #elif 3 | #else 4 | #endif 5 | #error 6 | #if 7 | #ifdef 8 | #ifndef 9 | #include 10 | #line 11 | #undef 12 | BlendState 13 | Bool 14 | Break 15 | Buffer 16 | CBuffer 17 | Compile 18 | Const 19 | Continue 20 | DepthStencilState 21 | DepthStencilView 22 | Discard 23 | Do 24 | Double 25 | Double2 26 | Double3 27 | Double4 28 | Else 29 | Extern 30 | False 31 | Float 32 | Float2 33 | Float3 34 | Float4 35 | For 36 | GeometryShader 37 | Half 38 | If 39 | In 40 | Inline 41 | Inout 42 | Int 43 | Namespace 44 | Nointerpolation 45 | Pass 46 | PixelShader 47 | RasterizerState 48 | Register 49 | RenderTargetView 50 | Return 51 | Sampler 52 | Sampler1D 53 | Sampler2D 54 | Sampler3D 55 | SamplerCUBE 56 | SamplerComparisonState 57 | Sampler_State 58 | Shared 59 | Stateblock 60 | Stateblock_state 61 | Static 62 | String 63 | Struct 64 | Switch 65 | TBuffer 66 | Technique 67 | Technique10 68 | Texture1D 69 | Texture1DArray 70 | Texture2D 71 | Texture2DArray 72 | Texture2DMS 73 | Texture2DMSArray 74 | Texture3D 75 | TextureCube 76 | TextureCubeArray 77 | True 78 | Typedef 79 | Uniform 80 | Vector 81 | VertexShader 82 | Void 83 | Volatile 84 | While 85 | auto 86 | bool 87 | branch 88 | break 89 | call 90 | case 91 | catch 92 | char 93 | class 94 | const 95 | const_cast 96 | continue 97 | default 98 | delete 99 | discard 100 | do 101 | double 102 | double2 103 | double3 104 | double4 105 | dynamic_cast 106 | else 107 | enum 108 | explicit 109 | flatten 110 | float 111 | float2 112 | float3 113 | float4 114 | for 115 | forcecase 116 | friend 117 | goto 118 | half 119 | if 120 | int 121 | long 122 | mutable 123 | new 124 | operator 125 | private 126 | protected 127 | public 128 | reinterpret_cast 129 | return 130 | short 131 | signed 132 | sizeof 133 | snorm 134 | static 135 | static_cast 136 | struct 137 | switch 138 | template 139 | texture1 140 | this 141 | throw 142 | try 143 | typename 144 | unorm 145 | union 146 | unsigned 147 | using 148 | vector 149 | virtual 150 | void 151 | while 152 | -------------------------------------------------------------------------------- /vivi/keywords/JavaScript.txt: -------------------------------------------------------------------------------- 1 | abs 2 | acos 3 | anchor 4 | arguments 5 | Array 6 | asin 7 | atan 8 | atan2 9 | big 10 | blink 11 | bold 12 | Boolean 13 | break 14 | case 15 | caller 16 | ceil 17 | charAt 18 | charCodeAt 19 | compile 20 | concat 21 | constructor 22 | continue 23 | cos 24 | Date 25 | delete 26 | do 27 | E 28 | else 29 | escape 30 | eval 31 | exec 32 | exp 33 | false 34 | fixed 35 | floor 36 | fontcolor 37 | fontsize 38 | for 39 | fromCharCode 40 | function 41 | getDate 42 | getDay 43 | getFullYear 44 | getHours 45 | getMilliseconds 46 | getMinutes 47 | getMonth 48 | getSeconds 49 | getTime 50 | getTimezoneOffset 51 | getUTCDate 52 | getUTCDay 53 | getUTCFullYear 54 | getUTCHours 55 | getUTCMilliseconds 56 | getUTCMinutes 57 | getUTCMonth 58 | getUTCSeconds 59 | getYear 60 | Global 61 | if 62 | in 63 | index 64 | indexOf 65 | Infinity 66 | input 67 | isFinite 68 | isNaN 69 | italics 70 | join 71 | lastIndex 72 | lastIndexOf 73 | length 74 | link 75 | LN10 76 | LN2 77 | log 78 | LOG10E 79 | LOG2E 80 | match 81 | Math 82 | max 83 | MAX_VALUE 84 | min 85 | MIN_VALUE 86 | NaN 87 | NEGATIVE_INFINITY 88 | new 89 | null 90 | Number 91 | Object 92 | parse 93 | parseFloat 94 | parseInt 95 | PI 96 | POSITIVE_INFINITY 97 | pow 98 | prototype 99 | random 100 | RegExp 101 | replace 102 | return 103 | reverse 104 | round 105 | search 106 | setDate 107 | setFullYear 108 | setHours 109 | setMilliseconds 110 | setMinutes 111 | setMonth 112 | setSeconds 113 | setTime 114 | setUTCDate 115 | setUTCFullYear 116 | setUTCHours 117 | setUTCMilliseconds 118 | setUTCMinutes 119 | setUTCMonth 120 | setUTCSeconds 121 | setYear 122 | sin 123 | slice 124 | small 125 | sort 126 | source 127 | split 128 | sqrt 129 | SQRT1_2 130 | SQRT2 131 | strike 132 | String 133 | sub 134 | sup 135 | switch 136 | tan 137 | test 138 | this 139 | toGMTString 140 | toLocaleString 141 | toLowerCase 142 | toString 143 | toUpperCase 144 | toUTCString 145 | true 146 | typeof 147 | undefined 148 | unescape 149 | UTC 150 | valueOf 151 | var 152 | void 153 | while 154 | with 155 | -------------------------------------------------------------------------------- /vivi/vivi64/main.cpp: -------------------------------------------------------------------------------- 1 | #include "MainWindow.h" 2 | #include "SingleApplication.h" 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | QApplication* g_app = nullptr; 10 | //SingleApplication* g_app = nullptr; 11 | 12 | 13 | int main(int argc, char *argv[]) 14 | { 15 | //QApplication app(argc, argv); 16 | QString uniqKeyString = "ViVi64"; // ローカルサーバ名 17 | #if 0 //def _DEBUG 18 | uniqKeyString += "_DEBUG"; 19 | #endif 20 | SingleApplication app(argc, argv, uniqKeyString); 21 | // 22 | QStringList files; 23 | #if 0 //def _DEBUG 24 | app.isFirstApp(); // listen 起動のためにコール 25 | #else 26 | bool opt_mi = false; // マルチインスタンスオプション 27 | if( !app.isFirstApp() /*&& argc > 1*/ ) { // ~~ファイル指定ありの場合~~ 28 | int nArgs = 0; 29 | wchar_t **argvw = CommandLineToArgvW(GetCommandLine(), &nArgs); 30 | for(int i = 1; i < nArgs; ++i) { 31 | QString a((QChar *)argvw[i]); 32 | if( argvw[i][0] != '-' ) { 33 | QDir path(a);; 34 | //if( !path.isAbsolute() ) 35 | // path.makeAbsolute(); 36 | files += path.absolutePath(); 37 | } else if( a == L"-mi" ) { 38 | opt_mi = true; 39 | } else { 40 | files += a; 41 | } 42 | } 43 | LocalFree(argvw); 44 | if( !opt_mi ) { 45 | QString a = files.join("\t"); 46 | if( a.isEmpty() ) a = ":"; // 引数無しの場合は ":" を送る → 新規メインウィンドウ表示 47 | app.sendMessage(a); 48 | return 0; 49 | } 50 | } 51 | #endif 52 | //app.installNativeEventFilter(new WinNativeEventFilter()); 53 | // 54 | app.setOrganizationName("VisualSoftwareLaboratory"); 55 | app.setApplicationName("ViVi64"); 56 | #if 0 57 | auto path = app.applicationDirPath(); 58 | QDir dir(path); 59 | dir.cdUp(); 60 | dir.cdUp(); 61 | path = dir.absolutePath(); 62 | #endif 63 | // 64 | MainWindow w; 65 | //QObject::connect(&app, SIGNAL(imeOpenStatusChanged()), &w, SLOT(imeOpenStatusChanged())); 66 | QObject::connect(&app, SIGNAL(onRecieved(const QString)), &w, SLOT(onRecieved(const QString))); 67 | w.show(); 68 | // 69 | w.onRecieved(files.join("\t")); 70 | // 71 | return app.exec(); 72 | } 73 | -------------------------------------------------------------------------------- /vivi/vivi64/GreppingDlg.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | GreppingDlg 4 | 5 | 6 | 7 | 0 8 | 0 9 | 397 10 | 111 11 | 12 | 13 | 14 | GreppingDlg 15 | 16 | 17 | 18 | 19 | 20 | 21 | 0 22 | 0 23 | 24 | 25 | 26 | grepping... 27 | 28 | 29 | Qt::AlignCenter 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 0 41 | 0 42 | 43 | 44 | 45 | Terminate 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | terminate 59 | clicked() 60 | GreppingDlg 61 | reject() 62 | 63 | 64 | 221 65 | 92 66 | 67 | 68 | 365 69 | 110 70 | 71 | 72 | 73 | 74 | 75 | terminate() 76 | 77 | 78 | -------------------------------------------------------------------------------- /vivi/vivi64/viewLineMgr.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "../Buffer/gap_buffer.h" 5 | 6 | #ifdef _WIN64 7 | typedef __int64 ssize_t; 8 | typedef __int64 pos_t; 9 | #else 10 | typedef __int32 ssize_t; 11 | typedef __int32 pos_t; 12 | #endif 13 | typedef __int32 line_t; // 行番号 14 | 15 | class Buffer; 16 | class EditView; 17 | 18 | // ViewLineMgr が管理するビュー行のための構造体 19 | // 論理行番号。論理行内オフセット情報を持つ 20 | struct ViewLine 21 | { 22 | public: 23 | enum { 24 | HEADING = 0x0001, 25 | }; 26 | public: 27 | ViewLine(int docLine = 0, int offset = 0 /*, int flags = 0*/) 28 | : m_docLine(docLine) 29 | , m_offset(offset) 30 | //, m_flags(flags) 31 | {} 32 | ViewLine(const ViewLine &x) 33 | : m_docLine(x.m_docLine) 34 | , m_offset(x.m_offset) 35 | //, m_flags(x.m_flags) 36 | {} 37 | public: 38 | int m_docLine; 39 | int m_offset; // 表示開始オフセット 40 | //int m_flags; 41 | }; 42 | 43 | class ViewLineMgr : public QObject 44 | { 45 | Q_OBJECT 46 | 47 | public: 48 | ViewLineMgr(EditView*); 49 | 50 | public: 51 | bool isEmpty() const; // テーブルが空か? 52 | int size() const; // テーブルサイズ 53 | int EOFLine() const; 54 | int viewLineToDocLineRaw(int vln) const { return m_lv[vln].m_docLine; } 55 | int viewLineToDocLine(int vln) const; 56 | int viewLineToDocLine(int vln, int &offset) const; 57 | int docLineToViewLine(int ln) const; 58 | int positionToViewLine(pos_t pos) const; 59 | int viewLineStartPosition(int vln) const; 60 | int viewLineSize(int vln) const; 61 | int logicalFirstLine(int vln) const; // 同じ論理行の最初の行の表示行番号を返す 62 | bool isLogicalFirstLine(int vln) const; 63 | bool isCollapsed(int vln) const; 64 | bool isLineBreakMode() const; 65 | 66 | void print() const; // for Debug 67 | void check() const; // for Debug 68 | 69 | public: 70 | //void collapseAll(); // 折り畳み可能行をすべて折り畳む 71 | void collapse(int ln1, int ln2); // (ln1, ln2) 行を削除 72 | void expand(int ln); 73 | void setLineBreak(bool); 74 | void doLineBreakAll(); 75 | void doLineBreak(int dln, int &vln); 76 | bool ensureLineBreak(int vln); // 折り返し処理を行ったら true を返す 77 | 78 | public slots: 79 | void clear(); 80 | void inserted(int dln, int d); 81 | void deleted(int dln, int d); // d should be > 0 82 | 83 | protected: 84 | 85 | private: 86 | bool m_lineBreak; // 折り返しモード 87 | Buffer *m_buffer; 88 | EditView *m_view; 89 | gap_buffer m_lv; // ビュー行→バッファ行変換テーブル 90 | }; 91 | -------------------------------------------------------------------------------- /vivi/vivi64/CTabBar.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include "CTabBar.h" 5 | 6 | 7 | CTabBar::CTabBar(QWidget *parent) 8 | : QTabBar(parent) 9 | { 10 | } 11 | CTabBar::~CTabBar() 12 | { 13 | } 14 | void makePoints(QPoint pnts[], const QRect& rct, int DX, bool bLast) 15 | { 16 | pnts[0] = rct.topLeft(); 17 | pnts[0].setX(pnts[0].x() + DX); 18 | pnts[1] = rct.topRight(); 19 | pnts[2] = rct.bottomRight(); 20 | pnts[3] = rct.bottomLeft(); 21 | pnts[3].setX(pnts[3].x() - DX); 22 | if( !bLast ) { 23 | pnts[1].setX(pnts[1].x() - DX); 24 | pnts[2].setX(pnts[2].x() + DX); 25 | } else { 26 | pnts[1].setX(pnts[1].x() - DX*2); 27 | pnts[2].setX(pnts[2].x()); 28 | } 29 | } 30 | void drawTrapezoid(QPainter& pt, const QRect& rct, QSize &isz, QIcon &icon, QString &txt, 31 | int idx, int idy, bool bLast, bool bCurrent) 32 | { 33 | const int NPNTS = 4; 34 | const int DX = 3; 35 | QPoint pnts[NPNTS]; 36 | QColor col = !bCurrent ? QColor("darkgray") : Qt::white; 37 | makePoints(pnts, rct, DX, bLast); 38 | pt.setBrush(col); 39 | pt.setPen(col); 40 | pt.drawPolygon(pnts, NPNTS); 41 | // 42 | pt.setPen(Qt::white); 43 | pt.drawLine(pnts[3], pnts[0]); 44 | pt.setPen(Qt::black); 45 | pt.drawLine(pnts[2], pnts[1]); 46 | pt.setPen(!bCurrent ? Qt::white : Qt::black); 47 | QRect r2(rct.x(), rct.y(), rct.width(), rct.height()); 48 | r2.setX(rct.x() + idx*3); 49 | pt.drawText(r2, Qt::AlignHCenter|Qt::AlignVCenter, txt); 50 | auto pxmap = icon.pixmap(isz); 51 | r2.setX(r2.x() - idx*2); 52 | r2.setY(r2.y() + idy); 53 | r2.setSize(isz); 54 | if( !bCurrent ) 55 | pt.setOpacity(0.333); 56 | pt.drawPixmap(r2, pxmap); 57 | pt.setOpacity(1.0); 58 | } 59 | void CTabBar::paintEvent(QPaintEvent *event) 60 | { 61 | auto brct = rect(); 62 | const auto idy = (brct.height() - iconSize().height()) / 2; 63 | const auto idx = (brct.height() - iconSize().height()) * 2 / 3; 64 | QPainter pt(this); 65 | pt.setRenderHint(QPainter::Antialiasing); 66 | pt.setPen(Qt::black); 67 | const int NPNTS = 4; 68 | const int DX = 3; 69 | QPoint pnts[NPNTS]; 70 | for (int i = 0; i < count(); ++i) { 71 | auto rct = tabRect(i); 72 | drawTrapezoid(pt, rct, iconSize(), tabIcon(i), tabText(i), idx, idy, i == count() - 1, false); 73 | } 74 | auto ix = currentIndex(); 75 | if( ix >= 0 ) { 76 | auto rct = tabRect(ix); 77 | drawTrapezoid(pt, rct, iconSize(), tabIcon(ix), tabText(ix), idx, idy, ix == count() - 1, true); 78 | } 79 | } 80 | 81 | -------------------------------------------------------------------------------- /vivi/vivi64/MainWindow.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | Resources/CPP.png 4 | Resources/CS.png 5 | Resources/CSS.png 6 | Resources/FS.png 7 | Resources/HLSL.png 8 | Resources/HTML.png 9 | Resources/JS.png 10 | Resources/LOG.png 11 | Resources/Markdown.png 12 | Resources/PASCAL.png 13 | Resources/PERL.png 14 | Resources/PHP.png 15 | Resources/PYTHON.png 16 | Resources/RUBY.png 17 | Resources/SQL.png 18 | Resources/TXT.png 19 | Resources/arrow_downward.png 20 | Resources/arrow_upward.png 21 | Resources/search.png 22 | Resources/add_circle_outline.png 23 | Resources/close_circle_outline.png 24 | Resources/search_backward.png 25 | Resources/search_forward.png 26 | Resources/folder_open.png 27 | Resources/save_black.png 28 | Resources/new_window.png 29 | Resources/exit_black.png 30 | Resources/build_black.png 31 | Resources/settings.png 32 | Resources/redo_black.png 33 | Resources/undo_black.png 34 | Resources/copy.png 35 | Resources/cut.png 36 | Resources/paste.png 37 | Resources/info_black.png 38 | Resources/power.png 39 | Resources/SPR.png 40 | Resources/redo_lightgray.png 41 | Resources/undo_lightgray.png 42 | Resources/pencil_orange.png 43 | Resources/opt_word.png 44 | Resources/keisen.png 45 | Resources/opt_ic.png 46 | Resources/opt_regexp.png 47 | Resources/boxselect.png 48 | Resources/crop_portrait.png 49 | Resources/folder_black.png 50 | Resources/crop_portrait_gray.png 51 | Resources/JAVA.png 52 | Resources/TS.png 53 | Resources/access_time.png 54 | Resources/star_border.png 55 | Resources/GDSCRIPT.png 56 | 57 | 58 | -------------------------------------------------------------------------------- /vivi/keywords/perl.txt: -------------------------------------------------------------------------------- 1 | abs 2 | accept 3 | alarm 4 | and 5 | atan2 6 | bind 7 | binmode 8 | bless 9 | caller 10 | chdir 11 | chmod 12 | chomp 13 | chop 14 | chown 15 | chr 16 | chroot 17 | close 18 | closedir 19 | cmp 20 | connect 21 | continue 22 | cos 23 | crypt 24 | dbmclose 25 | dbmopen 26 | defined 27 | delete 28 | die 29 | do 30 | dump 31 | each 32 | else 33 | elsif 34 | endgrent 35 | endhostent 36 | endnetent 37 | endprotoent 38 | endpwent 39 | endservent 40 | eof 41 | eq 42 | eval 43 | exec 44 | exists 45 | exit 46 | exp 47 | fcntl 48 | fileno 49 | flock 50 | for 51 | foreach 52 | fork 53 | formline 54 | ge 55 | getc 56 | getgrent 57 | getgrgid 58 | getgrnam 59 | gethostbyaddr 60 | gethostbyname 61 | gethostent 62 | getlogin 63 | getnetbyaddr 64 | getnetbyname 65 | getnetent 66 | getpeername 67 | getpgrp 68 | getppid 69 | getpriority 70 | getprotobyname 71 | getprotobynumber 72 | getprotoent 73 | getpwent 74 | getpwnam 75 | getpwuid 76 | getservbyname 77 | getservbyport 78 | getservent 79 | getsockname 80 | getsockopt 81 | glob 82 | gmtime 83 | goto 84 | grep 85 | gt 86 | hex 87 | if 88 | import 89 | index 90 | int 91 | ioctl 92 | join 93 | keys 94 | kill 95 | last 96 | lc 97 | lcfirst 98 | le 99 | length 100 | link 101 | listen 102 | local 103 | localtime 104 | log 105 | lstat 106 | lt 107 | map 108 | mkdir 109 | msgctl 110 | msgget 111 | msgrcv 112 | msgsnd 113 | my 114 | ne 115 | next 116 | no 117 | not 118 | oct 119 | open 120 | opendir 121 | or 122 | ord 123 | pack 124 | pipe 125 | pop 126 | pos 127 | print 128 | printf 129 | push 130 | quotemeta 131 | rand 132 | read 133 | readdir 134 | readlink 135 | recv 136 | redo 137 | ref 138 | rename 139 | require 140 | reset 141 | return 142 | reverse 143 | rewinddir 144 | rindex 145 | rmdir 146 | scalar 147 | seek 148 | seekdir 149 | select 150 | semctl 151 | semget 152 | semop 153 | send 154 | setgrent 155 | sethostent 156 | setnetent 157 | setpgrp 158 | setpriority 159 | setprotoent 160 | setpwent 161 | setservent 162 | setsockopt 163 | shift 164 | shmctl 165 | shmget 166 | shmread 167 | shmwrite 168 | shutdown 169 | sin 170 | sleep 171 | socket 172 | socketpair 173 | sort 174 | splice 175 | split 176 | sprintf 177 | sqrt 178 | srand 179 | stat 180 | study 181 | substr 182 | symlink 183 | syscall 184 | sysread 185 | system 186 | syswrite 187 | tell 188 | telldir 189 | tie 190 | time 191 | times 192 | truncate 193 | uc 194 | ucfirst 195 | umask 196 | undef 197 | unless 198 | unlink 199 | unpack 200 | unshift 201 | untie 202 | use 203 | utime 204 | values 205 | vec 206 | wait 207 | waitpid 208 | wantarray 209 | warn 210 | while 211 | write 212 | xor 213 | -------------------------------------------------------------------------------- /vivi/vivi64/tokenizer.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------- 2 | // 3 | // File: "tokenizer.h" 4 | // Created: 17-9-2013 5 | // Author: 津田伸秀 6 | // Description: 7 | // 8 | //---------------------------------------------------------------------- 9 | 10 | #pragma once 11 | 12 | #ifndef _HEADER_TOKENIZER_H 13 | #define _HEADER_TOKENIZER_H 14 | 15 | typedef unsigned char uchar; 16 | #ifdef _WIN64 17 | typedef __int64 ssize_t; 18 | typedef __int64 pos_t; 19 | #else 20 | typedef __int32 ssize_t; 21 | typedef __int32 pos_t; 22 | #endif 23 | typedef __int32 line_t; // 行番号 24 | 25 | #include 26 | 27 | class Buffer; 28 | class TypeSettings; 29 | 30 | class Tokenizer 31 | { 32 | public: 33 | enum { 34 | UNDEF = 0, // 初期値 35 | IDENT, // 英字で始まる英数字列 36 | NUMBER, // 数字で始まる英数字列 37 | STRING, // 文字列 38 | SYMBOL, // その他記号 39 | END_OF_FILE, 40 | }; 41 | 42 | public: 43 | Tokenizer(const Buffer &, pos_t pos, pos_t last, bool = true, const TypeSettings* = 0); 44 | Tokenizer(const Buffer *, pos_t pos, pos_t last, bool = true, const TypeSettings* = 0); 45 | Tokenizer(const Tokenizer &x); 46 | ~Tokenizer(void); 47 | 48 | public: 49 | int tokenType() const { return m_tokenType; } 50 | QString tokenText() const { return m_tokenText; } 51 | QString prevTokenText() const { return m_prevText; } 52 | int tokenLineNum() const { return m_tokenLineNum; } 53 | int tokenPosition() const { return m_tokenPosition; } 54 | int nextPosition() const { return m_pos; } 55 | wchar_t nextChar() const; 56 | wchar_t nextNextChar() const; 57 | bool isFirstToken() const { return m_firstToken; } 58 | int lineNumber() const { return m_lineNum; }; 59 | 60 | public: 61 | QChar skipSpace(); // 空白類をスキップし、その次の文字を返す 62 | QChar skipSpaceOrNewLine(); // 空白類をスキップし、その次の文字を返す 63 | int nextToken(); 64 | //QChar nextChar(); 65 | QString nextTokenText() { nextToken(); return tokenText(); } 66 | void skipLine(); // 次の行の最初のトークンまでスキップ 67 | int nextLineToken(); // 次の行の最初のトークンまで読み進める 68 | //uchar getNextChar(); 69 | void ungetToken() { m_pushed = true; }; 70 | void setPosition(pos_t pos) { m_pos = pos; } 71 | void setLast(pos_t last) { m_last = last; } 72 | 73 | protected: 74 | void init(); 75 | 76 | private: 77 | bool m_bString; // ".."、'...' 文字列有効 78 | bool m_pushed; 79 | bool m_firstToken; // 行内の最初のトークン 80 | int m_lineNum; // 現在行番号 (1..*) 81 | pos_t m_pos; 82 | pos_t m_last; 83 | const Buffer &m_buffer; 84 | uchar m_tokenType; // トークンタイプ 85 | QString m_tokenText; // 現在トークン文字列 86 | QString m_prevText; // ひとつ前のトークン文字列 87 | int m_tokenLineNum; 88 | int m_tokenPosition; // トークン開始オフセット 89 | const TypeSettings *m_typeSettings; 90 | QString m_lineComment; // 行コメント文字 91 | }; 92 | 93 | #endif //_HEADER_TOKENIZER_H 94 | -------------------------------------------------------------------------------- /vivi/vivi64/ClipboardHistDlg.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | ClipboardHistDlg 4 | 5 | 6 | 7 | 0 8 | 0 9 | 400 10 | 300 11 | 12 | 13 | 14 | 15 | 0 16 | 0 17 | 18 | 19 | 20 | ClipboardHistDlg 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 0 34 | 0 35 | 36 | 37 | 38 | Paste 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 0 47 | 0 48 | 49 | 50 | 51 | Close 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | pushButton_2 65 | clicked() 66 | ClipboardHistDlg 67 | reject() 68 | 69 | 70 | 280 71 | 269 72 | 73 | 74 | 396 75 | 269 76 | 77 | 78 | 79 | 80 | pushButton 81 | clicked() 82 | ClipboardHistDlg 83 | accept() 84 | 85 | 86 | 122 87 | 271 88 | 89 | 90 | 4 91 | 260 92 | 93 | 94 | 95 | 96 | 97 | -------------------------------------------------------------------------------- /vivi/testBufferQt/testBufferQt.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {D9D6E242-F8AF-46E4-B9FD-80ECBC20BA3E} 14 | qrc;* 15 | false 16 | 17 | 18 | {D9D6E242-F8AF-46E4-B9FD-80ECBC20BA3E} 19 | qrc;* 20 | false 21 | 22 | 23 | 24 | 25 | Source Files 26 | 27 | 28 | Source Files 29 | 30 | 31 | Source Files 32 | 33 | 34 | Source Files 35 | 36 | 37 | Source Files 38 | 39 | 40 | Source Files 41 | 42 | 43 | Source Files 44 | 45 | 46 | 47 | 48 | Header Files 49 | 50 | 51 | Header Files 52 | 53 | 54 | Header Files 55 | 56 | 57 | Header Files 58 | 59 | 60 | Header Files 61 | 62 | 63 | Header Files 64 | 65 | 66 | Header Files 67 | 68 | 69 | Header Files 70 | 71 | 72 | Header Files 73 | 74 | 75 | Header Files 76 | 77 | 78 | Header Files 79 | 80 | 81 | -------------------------------------------------------------------------------- /vivi/vivi64/OutlineBar.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "OutlineBar.h" 3 | 4 | OutlineBar::OutlineBar(QWidget *parent) 5 | : QTreeWidget(parent) 6 | { 7 | } 8 | void OutlineBar::mouseDoubleClickEvent(QMouseEvent *) 9 | { 10 | auto* item = currentItem(); 11 | //auto* view = (EditView*)item->data(1, 0).toULongLong(); 12 | emit doubleClicked(item); 13 | } 14 | void OutlineBar::keyPressEvent(QKeyEvent *event) 15 | { 16 | switch( event->key() ) { 17 | case Qt::Key_Return: 18 | case Qt::Key_Enter: 19 | case Qt::Key_Q: 20 | emit enterPressed(); 21 | return; 22 | case Qt::Key_Colon: 23 | emit colonPressed(); 24 | return; 25 | case Qt::Key_H: 26 | keyHPressed(); 27 | return; 28 | case Qt::Key_J: 29 | keyJPressed(); 30 | return; 31 | case Qt::Key_K: 32 | keyKPressed(); 33 | return; 34 | case Qt::Key_Space: 35 | case Qt::Key_L: 36 | keyLPressed(); 37 | return; 38 | } 39 | QTreeWidget::keyPressEvent(event); 40 | } 41 | void OutlineBar::keyHPressed() 42 | { 43 | auto* item = currentItem(); 44 | if( item == nullptr ) return; 45 | auto* pr = item->parent(); 46 | if( pr != nullptr ) { 47 | setCurrentItem(pr); 48 | } else { // トップレベルアイテムの場合 49 | item->setExpanded(false); // 折り畳み 50 | } 51 | } 52 | void OutlineBar::keyJPressed() 53 | { 54 | auto* item = currentItem(); 55 | if( item == nullptr ) return; 56 | int cnt = topLevelItemCount(); 57 | int ix = indexOfTopLevelItem(item); 58 | if( ix >= 0 ) { // トップレベルアイテムの場合 59 | if( item->isExpanded() && item->childCount() != 0 ) { 60 | setCurrentItem(item->child(0)); 61 | } else if( ix < cnt - 1) { 62 | item = topLevelItem(ix+1); 63 | setCurrentItem(item); 64 | } 65 | } else if( ix < 0 ) { // トップレベルアイテムでない場合 66 | auto* pr = item->parent(); 67 | int ix2 = pr->indexOfChild(item); 68 | int cnt2 = pr->childCount(); 69 | if( ix2 >= 0 && ix2 < cnt2 - 1) { 70 | setCurrentItem(pr->child(ix2+1)); 71 | } else { 72 | ix = indexOfTopLevelItem(pr); 73 | if( ix < cnt - 1 ) 74 | setCurrentItem(topLevelItem(ix+1)); 75 | } 76 | } 77 | } 78 | void OutlineBar::keyKPressed() 79 | { 80 | auto* item = currentItem(); 81 | if( item == nullptr ) return; 82 | int ix = indexOfTopLevelItem(item); 83 | if( ix > 0 ) { // トップレベルアイテムの場合 84 | item = topLevelItem(ix-1); 85 | if( item->isExpanded() ) { // 直上アイテムが折り畳まれている場合 86 | int cnt = item->childCount(); 87 | if( cnt == 0 ) { 88 | setCurrentItem(item); 89 | } else { 90 | setCurrentItem(item->child(cnt-1)); 91 | } 92 | } else { // 直上アイテムが展開されている場合 93 | setCurrentItem(item); 94 | } 95 | } else if( ix < 0 ) { // トップレベルアイテムでない場合 96 | auto* pr = item->parent(); 97 | ix = pr->indexOfChild(item); 98 | if( ix > 0 ) { 99 | setCurrentItem(pr->child(ix-1)); 100 | } else 101 | keyHPressed(); 102 | } 103 | } 104 | void OutlineBar::keyLPressed() 105 | { 106 | auto* item = currentItem(); 107 | if( item == nullptr ) return; 108 | int cnt = topLevelItemCount(); 109 | int ix = indexOfTopLevelItem(item); 110 | if( ix >= 0 ) { // トップレベルアイテムの場合 111 | if( item->childCount() != 0 ) { 112 | if( item->isExpanded() ) 113 | setCurrentItem(item->child(0)); 114 | else 115 | item->setExpanded(true); 116 | } 117 | } 118 | } 119 | -------------------------------------------------------------------------------- /vivi/TestBuffer/TestBuffer.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {D9D6E242-F8AF-46E4-B9FD-80ECBC20BA3E} 14 | qrc;* 15 | false 16 | 17 | 18 | {D9D6E242-F8AF-46E4-B9FD-80ECBC20BA3E} 19 | qrc;* 20 | false 21 | 22 | 23 | 24 | 25 | Source Files 26 | 27 | 28 | Source Files 29 | 30 | 31 | Source Files 32 | 33 | 34 | Source Files 35 | 36 | 37 | Source Files 38 | 39 | 40 | Source Files 41 | 42 | 43 | Source Files 44 | 45 | 46 | Source Files 47 | 48 | 49 | 50 | 51 | Header Files 52 | 53 | 54 | 55 | 56 | Header Files 57 | 58 | 59 | Header Files 60 | 61 | 62 | Header Files 63 | 64 | 65 | Header Files 66 | 67 | 68 | Header Files 69 | 70 | 71 | Header Files 72 | 73 | 74 | Header Files 75 | 76 | 77 | Header Files 78 | 79 | 80 | Header Files 81 | 82 | 83 | Header Files 84 | 85 | 86 | -------------------------------------------------------------------------------- /vivi/vivi64/viEngine.txt: -------------------------------------------------------------------------------- 1 | viEngine.txt 2 | 3 | ■ vi コマンド処理概要: 4 | 5 | EditView::keyPressEvent(): 6 | EditView::insertedTextSub(): 7 | ViEngine::processCommand(const QString &text, ...): // コマンド文字列処理 8 | ViEngine::processCommand(wchar_t ch, ...): // コマンド1文字処理 9 | switch (mode()) 10 | case Mode::INSERT: // 挿入モード 11 | if( ch == Esc ): 12 | ..... 13 | setMode(Mode::COMMAND); 14 | else: 15 | emit insertText(ch); // 文字挿入処理 16 | case Mode::REPLACE: // 上書きモード 17 | if( ch == Esc ): 18 | ..... 19 | setMode(Mode::COMMAND); 20 | else: 21 | emit replaceText(ch); // 文字上書き処理 22 | case Mode::COMMAND: // 通常 vi コマンドモード 23 | ViEngine::viCommand(): 24 | if( 通常モードの場合 ): 25 | ViEngine::doCmd(): 26 | if( 挿入モード遷移の場合 ): // iIaACsS等 27 | ..... 28 | setMode(Mode::INSERT); 29 | else: 30 | MainWindow::viCmdFixed(): 31 | EditView::doViCommand(): 32 | // 確定した vi コマンド:viEngine->cmd() 33 | if( カーソル移動コマンドの場合 ): 34 | m_textCursor->movePosition() // 35 | if( スクロールコマンドの場合 ): 36 | スクロール処理 37 | if( 検索コマンドの場合 ): 38 | 検索処理 39 | .... 40 | case Mode::CMDLINE: // ex モード 41 | 42 | ■ モード・サブモード処理: 43 | 44 | ViEngine::viCommand(wchar_t ch): 45 | if( m_subMode != 0 の場合 ): 46 | 各サブモードの処理 47 | return; 48 | switch(ch): 49 | case 'c': 50 | m_subMode = m_cdy = ch; 51 | case 'd': 52 | m_subMode = m_cdy = ch; 53 | case 'y': 54 | m_subMode = m_cdy = ch; 55 | case 'f', 'F', 't', 'T', 'g', 'm', 'z', ...: 56 | m_subMode = ch; 57 | case 'i'; 58 | m_toInsertMode = true; // 実際のモード遷移は ViEngine::doCmd() で行われる 59 | .... 60 | case 'x': 61 | m_cmd = ViCmd::DELETE_CHAR; 62 | ..... 63 | doCmd(): 64 | 65 | ■ {c|d|y}mv 処理: 66 | 67 | ・{c|d|y} 押下時点:m_subMode を設定するのみ at ViEngine::viCommand() 68 | ・mv 実行時 69 | ViEngine::doCmd(): 70 | emit cmdFixed(); 71 | if( m_moved && (m_cdy == 'c' || m_cdy == 'd') ): 72 | m_cmd = ViCmd::DELETE_CHAR; 73 | emit cmdFixed(); // mv 範囲を削除 74 | if( m_cdy == 'c' ): 75 | m_toInsertMode = true; // 挿入モード遷移 76 | 77 | ■ コマンドラインモード 78 | 79 | ◎ コマンドラインエディット表示 80 | MainWindow::viModeChanged() // モード遷移時にコールされる 81 | MainWindow::commandLineMode(QChar qch) 82 | if( m_cmdLineEdit == 0 ) { // コマンドラインエディットが生成されていない場合 83 | コマンドラインエディットが生成; 84 | シグナル・ソケット結合(Enter, ↑ 等) 85 | } 86 | コマンドラインエディットジオメトリ設定・表示 87 | 88 | ◎ Enter 押下時処理 at コマンドラインエディット 89 | MainWindow::onEnterCmdLineEdit() // m_cmdLineEdit の Enter 押下シグナルにコネクトされている 90 | if( text[0] == ':' ) { 91 | doExCommand(text.mid(1)); // 先頭の:を削除したものを引数にして doExCommand() をコール 92 | } else if( view != 0 && (text[0] == '/' || text[0] == '?') ) { 93 | doSearchCommand(view, text); 94 | } 95 | m_viEngine->popMode(); // モードを元に戻す 96 | 97 | ■ /?検索処理 98 | 99 | 100 | ■ 検索処理 101 | MainWindow::findStringChanged(const QString &pat) // 検索ボックスラインエディットの編集シグナルにコネクトされている 102 | if( pat が空でない && ビューがアクティブ ) 103 | // インクリメンタルサーチ 104 | EditView::findForward() 105 | 106 | MainWindow::onEnterFindCB() // 検索ボックスラインエディットの Enter 押下シグナルにコネクトされている 107 | 108 | MainWindow::onEscFindLineEdit() // 検索ボックスラインエディットの Esc 押下シグナルにコネクトされている 109 | -------------------------------------------------------------------------------- /vivi/vivi64/globalSettings.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------- 2 | // 3 | // File: "globalSettings.h" 4 | // Created: 15-9-2013 5 | // Author: 津田伸秀 6 | // Description: 7 | // 8 | //---------------------------------------------------------------------- 9 | 10 | #pragma once 11 | 12 | #ifndef _HEADER_GLOBALSETTINGS_H 13 | #define _HEADER_GLOBALSETTINGS_H 14 | 15 | #include 16 | #include 17 | 18 | typedef unsigned char uchar; 19 | typedef const char cchar; 20 | typedef const wchar_t cwchar; 21 | 22 | class GlobalSettings 23 | { 24 | public: 25 | enum { 26 | // bool タイプ 27 | IGNORE_CASE = 0, 28 | WHOLE_WORD_ONLY, 29 | REGEXP, 30 | LOOP_SEARCH, 31 | INC_SEARCH, 32 | GREP_SUB_DIR, 33 | VIEW_RT_BTM_PICTURE, 34 | SYNC_VERT_SCROLL, // 画面分割時:垂直スクロール同期 35 | SYNC_HORZ_SCROLL, // 画面分割時:水平スクロール同期 36 | IGNORE_MOC_FILE, // 定義位置へジャンプ:moc_*.cpp を無視 37 | //STATEMENT_COMPLETION, // 構文自動補完 38 | //WORD_COMPLETION, // 単語自動補完 39 | //KEYWORD_COMPLETION, // キーワード自動補完 40 | WITH_BOM, // BOM付き 41 | MINI_MAP, // ミニマップ表示 42 | VI_COMMAND, // vi コマンド有効 43 | OPEN_OPENED_DOCS, // 起動時:終了時ファイル復帰 44 | OUTPUT_VIEW, // OutputBar/OutputView 45 | GREP_VIEW, // OutputBar/GrepView 46 | N_BOOL, 47 | 48 | // int タイプ 49 | OUTPUT_FONT_SIZE = 0, 50 | PICTURE_OPACITY, 51 | PICTURE_SCALE, 52 | N_INT, 53 | 54 | //PICTURE1_PATH = 0, 55 | //PICTURE2_PATH, 56 | OUTPUT_FONT_NAME = 0, 57 | //MAIL_ADDRESS, 58 | //USER_NAME, 59 | //CERT_CODE, 60 | //PASS_CODE, 61 | ZEN_CODING_PATH, 62 | HTDOCS_ROOT, 63 | N_TEXT, 64 | 65 | CHAR_ENCODING = 0, 66 | DOC_TYPE, 67 | N_ENUM, 68 | }; 69 | enum { 70 | #if 0 71 | CHAR_ENC_UTF_8 = 0, 72 | CHAR_ENC_UTF_16LE, 73 | CHAR_ENC_UTF_16BE, 74 | CHAR_ENC_SJIS, 75 | CHAR_ENC_EUC, 76 | N_CHAR_ENC, 77 | #endif 78 | 79 | DOC_TYPE_DEFAULT = 0, 80 | DOC_TYPE_CPP, 81 | DOC_TYPE_CS, 82 | DOC_TYPE_CSS, 83 | DOC_TYPE_FS, 84 | DOC_TYPE_HLSL, 85 | DOC_TYPE_HTML, 86 | DOC_TYPE_JAVA, 87 | DOC_TYPE_JS, 88 | DOC_TYPE_TS, 89 | DOC_TYPE_LOG, 90 | DOC_TYPE_MARKDOWN, 91 | DOC_TYPE_PASCAL, 92 | DOC_TYPE_PERL, 93 | DOC_TYPE_PHP, 94 | DOC_TYPE_PYTHON, 95 | DOC_TYPE_GDSCRIPT, 96 | DOC_TYPE_RUBY, 97 | DOC_TYPE_SQL, 98 | DOC_TYPE_TXT, 99 | N_DOC_TYPE, 100 | }; 101 | 102 | public: 103 | GlobalSettings(); 104 | ~GlobalSettings() {}; 105 | 106 | public: 107 | void writeSettings() const; 108 | bool boolValue(int ix) const { return m_boolValues[ix]; } 109 | int intValue(int ix) const { return m_intValues[ix]; } 110 | QString textValue(int ix) const { return m_textValues[ix]; } 111 | int enumValue(int ix) const { return m_enumValues[ix]; } 112 | QByteArray defaultCodecName() const; 113 | QByteArray codecName(int enc) const; 114 | //bool certified() const; 115 | 116 | protected: 117 | void init(); 118 | 119 | public: 120 | void readSettings(); 121 | void setBoolValue(int ix, bool v) { m_boolValues[ix] = v; } 122 | void setIntValue(int ix, int v) { m_intValues[ix] = v; } 123 | void setTextValue(int ix, const QString &t) { m_textValues[ix] = t; } 124 | void setEnumValue(int ix, int v) { m_enumValues[ix] = v; } 125 | 126 | private: 127 | bool m_boolValues[N_BOOL]; 128 | int m_intValues[N_INT]; 129 | QString m_textValues[N_TEXT]; 130 | int m_enumValues[N_ENUM]; 131 | }; 132 | 133 | 134 | #endif //_HEADER_GLOBALSETTINGS_H 135 | -------------------------------------------------------------------------------- /vivi/keywords/css.txt: -------------------------------------------------------------------------------- 1 | azimuth 2 | background 3 | background-attachment 4 | background-color 5 | background-image 6 | background-position 7 | background-position-x 8 | background-position-y 9 | background-repeat 10 | behavior 11 | border 12 | border-bottom 13 | border-bottom-color 14 | border-bottom-style 15 | border-bottom-width 16 | border-collapse 17 | border-color 18 | border-left 19 | border-left-color 20 | border-left-style 21 | border-left-width 22 | border-right 23 | border-right-color 24 | border-right-style 25 | border-right-width 26 | border-spacing 27 | border-style 28 | border-top 29 | border-top-color 30 | border-top-style 31 | border-top-width 32 | border-width 33 | bottom 34 | caption-side 35 | clear 36 | clip 37 | color 38 | content 39 | counter-increment 40 | counter-reset 41 | cue 42 | cue-after 43 | cue-before 44 | cursor 45 | direction 46 | display 47 | elevation 48 | empty-cells 49 | filter 50 | float 51 | font 52 | font-family 53 | font-size 54 | font-size-adjust 55 | font-stretch 56 | font-style 57 | font-variant 58 | font-weight 59 | height 60 | ime-mode 61 | include-source 62 | layer-background-color 63 | layer-background-image 64 | layout-flow 65 | layout-grid 66 | layout-grid-char 67 | layout-grid-char-spacing 68 | layout-grid-line 69 | layout-grid-mode 70 | layout-grid-type 71 | left 72 | letter-spacing 73 | line-break 74 | line-height 75 | list-style 76 | list-style-image 77 | list-style-position 78 | list-style-type 79 | margin 80 | margin-bottom 81 | margin-left 82 | margin-right 83 | margin-top 84 | marker-offset 85 | marks 86 | max-height 87 | max-width 88 | min-height 89 | min-width 90 | -moz-binding 91 | -moz-border-radius 92 | -moz-border-radius-topleft 93 | -moz-border-radius-topright 94 | -moz-border-radius-bottomright 95 | -moz-border-radius-bottomleft 96 | -moz-border-top-colors 97 | -moz-border-right-colors 98 | -moz-border-bottom-colors 99 | -moz-border-left-colors 100 | -moz-opacity 101 | -moz-outline 102 | -moz-outline-color 103 | -moz-outline-style 104 | -moz-outline-width 105 | -moz-user-focus 106 | -moz-user-input 107 | -moz-user-modify 108 | -moz-user-select 109 | orphans 110 | outline 111 | outline-color 112 | outline-style 113 | outline-width 114 | overflow 115 | overflow-X 116 | overflow-Y 117 | padding 118 | padding-bottom 119 | padding-left 120 | padding-right 121 | padding-top 122 | page 123 | page-break-after 124 | page-break-before 125 | page-break-inside 126 | pause 127 | pause-after 128 | pause-before 129 | pitch 130 | pitch-range 131 | play-during 132 | position 133 | quotes 134 | -replace 135 | richness 136 | right 137 | ruby-align 138 | ruby-overhang 139 | ruby-position 140 | -set-link-source 141 | size 142 | speak 143 | speak-header 144 | speak-numeral 145 | speak-punctuation 146 | speech-rate 147 | stress 148 | scrollbar-arrow-color 149 | scrollbar-base-color 150 | scrollbar-dark-shadow-color 151 | scrollbar-face-color 152 | scrollbar-highlight-color 153 | scrollbar-shadow-color 154 | scrollbar-3d-light-color 155 | scrollbar-track-color 156 | table-layout 157 | text-align 158 | text-align-last 159 | text-decoration 160 | text-indent 161 | text-justify 162 | text-overflow 163 | text-shadow 164 | text-transform 165 | text-autospace 166 | text-kashida-space 167 | text-underline-position 168 | top 169 | unicode-bidi 170 | -use-link-source 171 | vertical-align 172 | visibility 173 | voice-family 174 | volume 175 | white-space 176 | widows 177 | width 178 | word-break 179 | word-spacing 180 | word-wrap 181 | writing-mode 182 | z-index 183 | zoom 184 | -------------------------------------------------------------------------------- /vivi/buffer-000/viewLineMgr.cpp: -------------------------------------------------------------------------------- 1 | #include "viewLineMgr.h" 2 | #include "Buffer.h" 3 | #include 4 | 5 | ViewLineMgr::ViewLineMgr(Buffer *buffer) 6 | : m_buffer(buffer) 7 | { 8 | } 9 | bool ViewLineMgr::isEmpty() const // テーブルが空か? 10 | { 11 | return m_lv.isEmpty(); 12 | } 13 | int ViewLineMgr::size() const // テーブルサイズ 14 | { 15 | return m_lv.size(); 16 | } 17 | void ViewLineMgr::clear() 18 | { 19 | m_lv.clear(); 20 | } 21 | int ViewLineMgr::EOFLine() const 22 | { 23 | if (m_lv.isEmpty()) { 24 | return m_buffer->EOFLine(); 25 | } else { 26 | int vln = m_lv.size() - 1; 27 | if( !m_buffer->isBlankEOFLine() ) --vln; 28 | return vln; 29 | } 30 | } 31 | int ViewLineMgr::viewLineToDocLine(int vln) const 32 | { 33 | if( m_lv.isEmpty() ) 34 | return vln; 35 | if( vln >= m_lv.size() ) 36 | return m_buffer->lineCount(); 37 | if( vln < 0 ) vln = 0; 38 | return m_lv.at(vln).m_docLine; 39 | } 40 | int ViewLineMgr::docLineToViewLine(int ln) const 41 | { 42 | if( m_lv.isEmpty() ) 43 | return ln; 44 | //for (int i = 0; i < m_lv.size(); ++i) { 45 | // qDebug() << i << ": " << m_lv[i]; 46 | //} 47 | int first = 0; 48 | int last = m_lv.size(); 49 | while( first < last - 1 ) { 50 | int ix = (first + last) / 2; 51 | if( ln < m_lv[ix].m_docLine ) { 52 | last = ix; 53 | } else if( ln > m_lv[ix].m_docLine ) { 54 | first = ix; 55 | } else 56 | return ix; 57 | } 58 | return first; 59 | } 60 | bool ViewLineMgr::isCollapsed(int vln) const 61 | { 62 | if (m_lv.isEmpty()) { 63 | return false; 64 | } else { 65 | return vln <= m_lv.size() - 1 66 | && m_lv[vln].m_docLine + 1 != m_lv[vln + 1].m_docLine; 67 | } 68 | } 69 | void ViewLineMgr::collapse(int ln1, int ln2) // (ln1, ln2] 行を削除 70 | { 71 | if( ln1 >= ln2 ) return; 72 | #if 1 73 | if( m_lv.isEmpty() ) { 74 | m_lv.resize(m_buffer->lineCount() - (ln2 - ln1) + 1); 75 | int i = 0; 76 | for (; i <= ln1; ++i) { 77 | m_lv[i].m_docLine = i; 78 | } 79 | for (int k = ln2 + 1; k <= m_buffer->lineCount(); ++k, ++i) { 80 | m_lv[i].m_docLine = k; 81 | } 82 | } else { 83 | m_lv.eraseFL(ln1+1, ln2+1); 84 | } 85 | #endif 86 | } 87 | // vln の折り畳み解除 88 | void ViewLineMgr::expand(int vln) 89 | { 90 | if (m_lv.isEmpty()) return; 91 | int ln = m_lv[vln++].m_docLine + 1; // 次の行のドキュメント行番号 92 | while( vln < m_lv.size() && m_lv[vln].m_docLine != ln ) { 93 | m_lv.insert(vln++, ViewLine(ln++)); 94 | } 95 | } 96 | // (ドキュメント)dln 行に d 行挿入された場合の処理 97 | void ViewLineMgr::inserted(int dln, int d) 98 | { 99 | if( m_lv.isEmpty() ) return; 100 | //for (int i = 0; i < m_lv.size(); ++i) { 101 | // qDebug() << i << ": " << m_lv[i]; 102 | //} 103 | int vln = docLineToViewLine(dln); 104 | for(int i = 0; i < d; ++i) 105 | m_lv.insert(vln++, ViewLine(dln++)); 106 | //for (int i = 0; i < m_lv.size(); ++i) { 107 | // qDebug() << i << ": " << m_lv[i]; 108 | //} 109 | //undone: ステップベクター対応 110 | while( vln < m_lv.size() ) 111 | m_lv[vln++].m_docLine += d; 112 | //for (int i = 0; i < m_lv.size(); ++i) { 113 | // qDebug() << i << ": " << m_lv[i]; 114 | //} 115 | //qDebug() << "\n"; 116 | } 117 | // d should be > 0 118 | void ViewLineMgr::deleted(int dln, int d) 119 | { 120 | if( m_lv.isEmpty() ) return; 121 | //for (int i = 0; i < m_lv.size(); ++i) { 122 | // qDebug() << i << ": " << m_lv[i]; 123 | //} 124 | int vln = docLineToViewLine(dln); 125 | m_lv.erase(vln, d); 126 | while( vln < m_lv.size() ) 127 | m_lv[vln++].m_docLine -= d; 128 | //for (int i = 0; i < m_lv.size(); ++i) { 129 | // qDebug() << i << ": " << m_lv[i]; 130 | //} 131 | } 132 | -------------------------------------------------------------------------------- /vivi/vivi64/Document.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | typedef unsigned char uchar; 9 | typedef const char cchar; 10 | typedef unsigned char byte; 11 | typedef unsigned __int8 byte_t; 12 | typedef unsigned int uint; 13 | #ifdef _WIN64 14 | typedef __int64 ssize_t; 15 | typedef __int64 pos_t; 16 | #else 17 | typedef __int32 ssize_t; 18 | typedef __int32 pos_t; 19 | #endif 20 | typedef __int32 line_t; // 行番号 21 | 22 | class Buffer; 23 | struct MarkItem; 24 | class EditView; 25 | class TypeSettings; 26 | class SSSearch; 27 | 28 | class Document : public QObject 29 | { 30 | Q_OBJECT 31 | 32 | public: 33 | Document(QString typeName = QString(), QObject *parent = 0); 34 | ~Document(); 35 | public: 36 | int size() const; 37 | wchar_t charAt(pos_t pos) const; 38 | bool bom() const { return m_bBom; } 39 | uchar charEncoding() const { return m_charEncoding; } 40 | byte_t newLineCode() const { return m_newLineCode; } 41 | QByteArray codecName() const; 42 | bool isEmpty() const; 43 | bool isModified() const; // { return m_modified; } 44 | bool canUndo() const; 45 | bool canRedo() const; 46 | bool saveFile() const; 47 | int lineCount() const; 48 | int EOFLine() const; 49 | uint lineFlags(int ln) const; 50 | int mmSeqNumber() const { return m_mmSeqNumber; } 51 | QString fullPathName() const { return m_fullPathName; } 52 | QString title() const { return m_title; } 53 | QString typeName() const; 54 | QString text(pos_t pos, ssize_t sz) const; 55 | QString lineText(int) const; 56 | QDateTime lastModified() const { return m_lastModified; } 57 | public: 58 | void setTypeSettings(TypeSettings *typeSettings); 59 | void setPathName(const QString &pathName); 60 | void setTitle(const QString &); 61 | void setCodecName(const QByteArray &); 62 | void setBOM(bool bBom); 63 | void setCharEncoding(uchar charEncoding); 64 | void setModified(bool = true); 65 | void setLastModified(const QDateTime&); 66 | void setPlainText(const QString&); 67 | void buildMinMap(); 68 | QPixmap& minMap() { return m_minMap; } 69 | int lineStartPosition(pos_t pos) const; 70 | void setLineFlag(line_t, uint); 71 | void resetLineFlag(line_t, uint); 72 | 73 | //QString fullPathName() const; 74 | //QString typeName() const; 75 | TypeSettings *typeSettings() { return m_typeSettings; } 76 | const TypeSettings *typeSettings() const { return m_typeSettings; } 77 | Buffer *buffer() { return m_buffer; } 78 | const Buffer *buffer() const { return m_buffer; } 79 | int positionToLine(pos_t pos) const; // 0 org. 80 | void deleteText(pos_t pos, ssize_t sz = 1, bool BS = false); 81 | void insertText(pos_t pos, const QString &); 82 | void updateView(EditView *); 83 | void clearUndoMgr(); 84 | int undo(); 85 | int redo(); 86 | void cut(pos_t pos, ssize_t sz); 87 | void copy(pos_t pos, ssize_t sz, bool append = false); 88 | int paste(pos_t pos); // ペースト後のカーソル位置を返す 89 | private: 90 | QString m_fullPathName; 91 | QString m_title; 92 | Buffer *m_buffer; 93 | bool m_bBom; 94 | byte_t m_newLineCode; 95 | uchar m_charEncoding; 96 | //int m_bomLength; 97 | TypeSettings *m_typeSettings; 98 | mutable QTextCodec *m_codec; 99 | //QString m_fullPathName; 100 | //QString m_title; 101 | mutable QDateTime m_lastModified; 102 | std::vector m_views; 103 | int m_mmSeqNumber; // ミニマップ作成時シリアル番号 104 | double m_mmScale; // 1.0 未満であれば縮小されている 105 | QPixmap m_minMap; 106 | //double m_wmScale; // 1.0 未満であれば縮小されている 107 | //QPixmap m_wholeMap; 108 | }; 109 | -------------------------------------------------------------------------------- /vivi/vivi64/ViewTokenizer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | typedef unsigned char byte; 6 | 7 | class Buffer; 8 | class TypeSettings; 9 | 10 | class ViewTokenizer 11 | { 12 | public: 13 | enum { 14 | UNKNOWN = 0, 15 | STRING, 16 | ALNUM, // 英字で始まる英数字列 17 | DIGITS, // 10進数 18 | QUOTED, // シングル、ダブルクォートされた文字列 19 | SYMBOL, // !"# などの記号類(半角空白も含む) 20 | ANSI_SPACE, // 半角空白 21 | ZEN_SPACE, // 全角空白 22 | HTMLTAG, // <...> 内テキスト 23 | COMMENT, // コメント 24 | CTRL, // 0x20 未満 25 | NEWLINE, // CR/LF/CRLF 26 | URL, 27 | HTML_SPECIAL_CHARS, // < 等のHTML特殊文字 28 | OTHER, // その他(マルチバイト文字など) 29 | }; 30 | public: 31 | ViewTokenizer(const TypeSettings *typeSettings, const Buffer *buffer, int first, int sz, int last /*, int curpos = 0*/); 32 | ~ViewTokenizer() {} 33 | 34 | public: 35 | int ix() const { return m_ix; } 36 | int tokenix() const { return m_tokenix; } 37 | byte tokenType() const { return m_tokenType; } 38 | bool isInLineComment() const { return m_inLineComment; } 39 | bool isInBlockComment() const { return m_inBlockComment; } 40 | //bool isInScript() const { return m_inScript; } 41 | bool isInTag() const { return m_inHTMLTag; } 42 | bool isInPHP() const { return m_inPHP; } 43 | bool isTokenInComment() const { return m_isTokenInComment; } 44 | //bool isTokenInString() const { return m_inString; } 45 | bool isInHTMLTag() const { return m_inHTMLTag; } 46 | bool isTokenInHTMLTag() const { return m_isTokenInHTMLTag; } 47 | bool isTokenNewLine() const { return m_isTokenNewLine; } 48 | bool isInScriptStartEnd() const { return m_inScriptStartEnd; } 49 | QString tagText() const { return m_tagText; } 50 | QString quotedText() const { return m_quotedText; } 51 | QString fullText() const { return m_fullText; } 52 | QString orgText() const { return m_orgText; } 53 | 54 | public: 55 | void setQuoteChar(char q) { m_quoteChar = q; } 56 | void setInLineComment(bool b) { m_inLineComment = b; } 57 | void setInBlockComment(bool b) { m_inBlockComment = b; } 58 | //void setInString(bool b) { m_inString = b; } 59 | //void setInScrpt(bool b) { m_inScript = b; } 60 | void setInTag(bool b) { m_inHTMLTag= b; } 61 | void setInPHP(bool b) { m_inPHP = b; } 62 | void setInScriptStartEnd(bool b) { m_inScriptStartEnd = b; } 63 | void setBlockCommentText(const QString &, const QString &); 64 | void setLineCommentText(const QString &); 65 | void setQuotedText(const QString &); 66 | QString nextToken(/*int &type*/); 67 | void setCursorLine() { m_cursorLine = true; } 68 | 69 | //private: 70 | public: 71 | QString m_tokenText; 72 | QString m_fullText; // カーソル位置以降も含めたテキスト 73 | //int m_curpos; // カーソル位置 74 | int m_ix; // 次の文字 75 | int m_tokenix; // トークン最初の文字のバッファ内文字位置 76 | int m_quotedTextix; 77 | int m_lastBuffer; 78 | int m_lastBuffer2; // ホントのバッファ末尾 79 | byte m_tokenType; // トークン種別 80 | bool m_inLineComment; 81 | bool m_inBlockComment; 82 | //bool m_inScript; 83 | bool m_inPHP; 84 | bool m_isTokenInComment; 85 | //bool m_inString; 86 | bool m_inHTMLTag; // "<" ... ">" の中 87 | int m_htmlTagLvl; // "<" のネスト数 88 | bool m_inScriptStartEnd; // " の中 89 | bool m_isTokenInHTMLTag; 90 | bool m_isTokenNewLine; 91 | bool m_startTag; // true for "<", false for " 4 | 5 | ViewLineMgr::ViewLineMgr(Buffer *buffer) 6 | : m_buffer(buffer) 7 | { 8 | } 9 | bool ViewLineMgr::isEmpty() const // テーブルが空か? 10 | { 11 | return m_lv.isEmpty(); 12 | } 13 | int ViewLineMgr::size() const // テーブルサイズ 14 | { 15 | return m_lv.size(); 16 | } 17 | int ViewLineMgr::viewLineCount() const 18 | { 19 | if (m_lv.isEmpty()) { 20 | return m_buffer->lineCount(); 21 | } else 22 | return size(); 23 | 24 | } 25 | void ViewLineMgr::clear() 26 | { 27 | m_lv.clear(); 28 | } 29 | int ViewLineMgr::EOFLine() const 30 | { 31 | if (m_lv.isEmpty()) { 32 | return m_buffer->EOFLine(); 33 | } else { 34 | int vln = m_lv.size() - 1; 35 | if( !m_buffer->isBlankEOFLine() ) --vln; 36 | return vln; 37 | } 38 | } 39 | int ViewLineMgr::viewLineToDocLine(int vln) const 40 | { 41 | if( m_lv.isEmpty() ) 42 | return vln; 43 | if( vln >= m_lv.size() ) 44 | return m_buffer->lineCount(); 45 | if( vln < 0 ) vln = 0; 46 | return m_lv.at(vln).m_docLine; 47 | } 48 | int ViewLineMgr::docLineToViewLine(int ln) const 49 | { 50 | if( m_lv.isEmpty() ) 51 | return ln; 52 | //for (int i = 0; i < m_lv.size(); ++i) { 53 | // qDebug() << i << ": " << m_lv[i]; 54 | //} 55 | int first = 0; 56 | int last = m_lv.size(); 57 | while( first < last - 1 ) { 58 | int ix = (first + last) / 2; 59 | if( ln < m_lv[ix].m_docLine ) { 60 | last = ix; 61 | } else if( ln > m_lv[ix].m_docLine ) { 62 | first = ix; 63 | } else 64 | return ix; 65 | } 66 | return first; 67 | } 68 | bool ViewLineMgr::isCollapsed(int vln) const 69 | { 70 | if (m_lv.isEmpty()) { 71 | return false; 72 | } else { 73 | return vln <= m_lv.size() - 1 74 | && m_lv[vln].m_docLine + 1 != m_lv[vln + 1].m_docLine; 75 | } 76 | } 77 | void ViewLineMgr::collapse(int ln1, int ln2) // (ln1, ln2] 行を削除 78 | { 79 | if( ln1 >= ln2 ) return; 80 | #if 1 81 | if( m_lv.isEmpty() ) { 82 | m_lv.resize(m_buffer->lineCount() - (ln2 - ln1) + 1); 83 | int i = 0; 84 | for (; i <= ln1; ++i) { 85 | m_lv[i].m_docLine = i; 86 | } 87 | for (int k = ln2 + 1; k <= m_buffer->lineCount(); ++k, ++i) { 88 | m_lv[i].m_docLine = k; 89 | } 90 | } else { 91 | m_lv.eraseFL(ln1+1, ln2+1); 92 | } 93 | #endif 94 | } 95 | // vln の折り畳み解除 96 | void ViewLineMgr::expand(int vln) 97 | { 98 | if (m_lv.isEmpty()) return; 99 | int ln = m_lv[vln++].m_docLine + 1; // 次の行のドキュメント行番号 100 | while( vln < m_lv.size() && m_lv[vln].m_docLine != ln ) { 101 | m_lv.insert(vln++, ViewLine(ln++)); 102 | } 103 | } 104 | // (ドキュメント)dln 行に d 行挿入された場合の処理 105 | void ViewLineMgr::inserted(int dln, int d) 106 | { 107 | if( m_lv.isEmpty() ) return; 108 | //for (int i = 0; i < m_lv.size(); ++i) { 109 | // qDebug() << i << ": " << m_lv[i]; 110 | //} 111 | int vln = docLineToViewLine(dln); 112 | for(int i = 0; i < d; ++i) 113 | m_lv.insert(vln++, ViewLine(dln++)); 114 | //for (int i = 0; i < m_lv.size(); ++i) { 115 | // qDebug() << i << ": " << m_lv[i]; 116 | //} 117 | //undone: ステップベクター対応 118 | while( vln < m_lv.size() ) 119 | m_lv[vln++].m_docLine += d; 120 | //for (int i = 0; i < m_lv.size(); ++i) { 121 | // qDebug() << i << ": " << m_lv[i]; 122 | //} 123 | //qDebug() << "\n"; 124 | } 125 | // d should be > 0 126 | void ViewLineMgr::deleted(int dln, int d) 127 | { 128 | if( m_lv.isEmpty() ) return; 129 | //for (int i = 0; i < m_lv.size(); ++i) { 130 | // qDebug() << i << ": " << m_lv[i]; 131 | //} 132 | int vln = docLineToViewLine(dln); 133 | m_lv.erase(vln, d); 134 | while( vln < m_lv.size() ) 135 | m_lv[vln++].m_docLine -= d; 136 | //for (int i = 0; i < m_lv.size(); ++i) { 137 | // qDebug() << i << ": " << m_lv[i]; 138 | //} 139 | } 140 | -------------------------------------------------------------------------------- /vivi/vivi64/TextCursor.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | typedef unsigned char byte; 6 | typedef unsigned __int8 byte_t; 7 | #ifdef _WIN64 8 | typedef __int64 ssize_t; 9 | typedef __int64 pos_t; 10 | #else 11 | typedef __int32 ssize_t; 12 | typedef __int32 pos_t; 13 | #endif 14 | typedef __int32 line_t; // 行番号 15 | 16 | class EditView; 17 | 18 | bool isSrgtPirFirstChar(QChar); 19 | bool isSrgtPirSecondChar(QChar); 20 | bool isSrgtPirFirstChar(wchar_t); 21 | bool isSrgtPirSecondChar(wchar_t); 22 | 23 | class TextCursor { 24 | public: 25 | enum { 26 | LEFT = 0, 27 | RIGHT, 28 | UP, 29 | DOWN, 30 | PREV_WORD, // 前の単語先頭へ 31 | BEG_WORD, // 単語先頭 32 | END_WORD, // 単語末尾 33 | NEXT_WORD, // 次の単語先頭へ 34 | NEXT_WORD_NOSKIPSPC, // 次の単語先頭へ(継続空白類をスキップしない) 35 | NEXT_CAP_WORD, // 次の単語先頭(キャピタルワード、アンダーバー区切り)へ 36 | PREV_SS_WORD, // 前の空白区切り単語先頭へ 37 | END_SS_WORD, // 空白区切り単語末尾 38 | NEXT_SS_WORD, // 次の空白区切り単語先頭へ 39 | NEXT_SS_WORD_NOSKIPSPC, // 次の空白区切り単語先頭へ(継続空白類をスキップしない) 40 | HOME_LINE, // 最初の非空白文字位置 or 行先頭 41 | BEG_LINE, 42 | FIRST_NOSPACE, // 最初の非空白文字 43 | LAST_CHAR_LINE, // 行の最後の文字 44 | END_LINE, 45 | PREV_HEADING_LINE, 46 | NEXT_HEADING_LINE, 47 | PREV_BLANK_LINE, 48 | NEXT_BLANK_LINE, 49 | BEG_OF_CUR_SECTION, // [[ 50 | BEG_OF_NEXT_SECTION, // ]] 51 | BEG_DOC, 52 | END_DOC, 53 | ASSOC_PAREN, // 対応する括弧へ移動 54 | 55 | MOVE_ANCHOR = 0, 56 | KEEP_ANCHOR, 57 | 58 | NOMAL_MODE = 0, // 通常選択モード 59 | VI_CHAR_SEL_MODE, // vi の v モード 60 | VI_LINE_SEL_MODE, // vi の v モード 61 | BOX_MODE, // 矩形選択モード 62 | }; 63 | 64 | public: 65 | TextCursor(EditView *view, pos_t pos = 0, pos_t anchor= 0); 66 | TextCursor(const TextCursor &x); 67 | public: 68 | byte_t mode() const { return m_mode; } 69 | pos_t position() const { return m_pos; } 70 | pos_t positionInLine() const; // 行内オフセットを返す 71 | pos_t anchor() const { return m_anchor; } 72 | int viewLine() const { return m_viewLine; } 73 | void movePosition(int op, int mode = MOVE_ANCHOR, int n = 1, bool vi = false); 74 | wchar_t charAt() const; 75 | wchar_t charAt(pos_t pos) const; 76 | bool isAtNewLine() const; 77 | pos_t selectionSize() const; 78 | pos_t selectionFirst() const; 79 | pos_t selectionLast() const; 80 | int selectionFirstLine() const; 81 | int selectionLastLine() const; 82 | bool hasSelection() const { return m_mode != NOMAL_MODE || m_anchor != m_pos; } 83 | QString selectedText() const; 84 | bool getSelectedLineRange(int &dln1, int &dln2) const; 85 | public: 86 | void setMode(byte_t mode); 87 | void clearSelection(); 88 | void setPosition(pos_t pos, int mode = MOVE_ANCHOR); 89 | void setLineAndPosition(int vln, pos_t pos, int mode = MOVE_ANCHOR); 90 | void setWordBegPos() { m_wordBegPos = m_pos; } 91 | void setWordEndPos() { m_wordEndPos = m_pos; } 92 | void setAnchor(pos_t pos) { m_anchor = pos; } 93 | void setAnchorWordBeg() { m_anchor = m_wordBegPos; } 94 | void setAnchorWordEnd() { m_anchor = m_wordEndPos; } 95 | void setPX(int px) { m_px = px; } 96 | void deleteChar(bool BS = false, bool vi = false, bool fall=false); 97 | void deletePrevChar(bool vi = false); 98 | void insertText(const QString &); 99 | protected: 100 | uchar getCharType(wchar_t &); 101 | int nextWord(int n, bool cw = false); 102 | int nextCapWord(int n); 103 | int prevWord(int n); 104 | int begWord(); 105 | int endWord(int n); 106 | int nextSSWord(int n, bool cw = false); 107 | int prevSSWord(int n); 108 | int endSSWord(int n); 109 | int viewLineStartPosition(int vln) const; 110 | 111 | private: 112 | EditView *m_view; 113 | byte_t m_mode; 114 | pos_t m_pos; 115 | pos_t m_anchor; 116 | pos_t m_wordBegPos; // 単語先頭位置 for マウスダブルクリック単語単位選択 117 | pos_t m_wordEndPos; // 単語末尾位置 for マウスダブルクリック単語単位選択 118 | int m_viewLine; // 表示行番号 [0, viewLineCount()) 119 | int m_anchorViewLine; // 表示行番号 [0, viewLineCount()) 120 | int m_px; // 保存位置 121 | int m_boxCurPx1; 122 | int m_boxCurPx2; 123 | int m_boxCurLine; // 表示行 [0, viewLineCount()) 124 | int m_boxAnchorPx1; 125 | int m_boxAnchorPx2; 126 | int m_boxAnchorLine; // 表示行 [0, viewLineCount()) 127 | }; 128 | -------------------------------------------------------------------------------- /test/iland.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | 1000 1000 4 | 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 5 | 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0... 6 | */ 7 | #include 8 | #include 9 | using namespace std; 10 | int AW, AH, seq = 0, cnt = 0; 11 | vector map, map2; 12 | int xyToIX(int x, int y) { return y * AW + x; } 13 | void set(int ix, int v) { 14 | map2[ix] = v; 15 | if( map[ix-AW] > 0 && map2[ix-AW] == 0 ) set(ix-AW, v); 16 | if( map[ix-1] > 0 && map2[ix-1] == 0 ) set(ix-1, v); 17 | if( map[ix+1] > 0 && map2[ix+1] == 0 ) set(ix+1, v); 18 | if( map[ix+AW] > 0 && map2[ix+AW] == 0 ) set(ix+AW, v); 19 | } 20 | int main(void){ 21 | int W, H, v; 22 | cin >> W >> H; 23 | AW = W + 1; 24 | AH = H + 1; 25 | map.resize(AW*AH, -1); 26 | for(int y = 0; y < H; ++y) { 27 | for(int x = 0; x < W; ++x) { 28 | cin >> v; 29 | map[xyToIX(x,y)] = v; 30 | } 31 | } 32 | map2.resize(map.size(), 0); 33 | /* 34 | for(int y = 0; y < H; ++y) { 35 | for(int x = 0; x < W; ++x) { 36 | cout << map[xyToIX(x,y)]; 37 | } 38 | cout << "\n"; 39 | } 40 | cout << "\n\n"; 41 | */ 42 | for(int ix = xyToIX(0,0); ix <= xyToIX(W-1, H-1); ++ix) { 43 | if( map[ix] > 0 && map2[ix] == 0 ) 44 | set(ix, ++seq); 45 | } 46 | /* 47 | for(int y = 0; y < H; ++y) { 48 | for(int x = 0; x < W; ++x) { 49 | cout << map2[xyToIX(x,y)]; 50 | } 51 | cout << "\n"; 52 | } 53 | cout << "\n\n"; 54 | */ 55 | cout << seq << "\n"; 56 | return 0; 57 | } 58 | -------------------------------------------------------------------------------- /vivi/vivi64/GrepEngine.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "GrepEngine.h" 3 | #include "globalSettings.h" 4 | #include "charEncoding.h" 5 | #include "../buffer/Buffer.h" 6 | #include "../buffer/SSSearch.h" 7 | 8 | GrepEngine::GrepEngine(GlobalSettings *globalSettings, /*SSSearch *sssrc,*/ QObject *parent) 9 | : QObject(parent) 10 | , m_globSettings(globalSettings) 11 | //, m_sssrc(sssrc) 12 | , m_toTerminate(false) 13 | , m_terminated(false) 14 | { 15 | m_sssrc = new SSSearch(); 16 | } 17 | 18 | GrepEngine::~GrepEngine() 19 | { 20 | delete m_sssrc; 21 | } 22 | // dirStr 以下を grep 処理 23 | void GrepEngine::doGrep(QString pat, QString extentions, QString dirStr, QString exclude) 24 | { 25 | qDebug() << "GrepEngine::doGrep()"; 26 | if( dirStr.endsWith('/') ) dirStr = dirStr.left(dirStr.size() - 1); 27 | uint opt = 0; 28 | if( m_globSettings->boolValue(GlobalSettings::IGNORE_CASE) ) 29 | opt |= SSSearch::IGNORE_CASE; 30 | if( m_globSettings->boolValue(GlobalSettings::WHOLE_WORD_ONLY) ) 31 | opt |= SSSearch::WHOLE_WORD_ONLY; 32 | byte algorithm = SSSearch::SAKUSAKU; 33 | if( m_globSettings->boolValue(GlobalSettings::REGEXP) ) 34 | algorithm = SSSearch::STD_REGEX; 35 | int sum = 0; 36 | if( m_sssrc->setup((const wchar_t *)pat.data(), pat.size(), opt, algorithm) ) { 37 | sum = doGrepDir(pat, extentions, dirStr, QRegExp(exclude)); 38 | } 39 | emit finished(sum); 40 | } 41 | int GrepEngine::doGrepDir(QString pat, QString extentions, QString dirStr, const QRegExp ®exp) 42 | { 43 | if( m_toTerminate ) { 44 | if( !m_terminated ) 45 | emit doOutput(tr("\n* grep terminated.\n")); 46 | m_terminated = true; 47 | return 0; 48 | } 49 | emit greppingDir(dirStr); 50 | QStringList extList = extentions.split(';'); 51 | QDir dir(dirStr); 52 | QStringList files = dir.entryList(extList, QDir::Files, QDir::Name); 53 | qSort(files.begin(), files.end(), 54 | [](const QString &lhs, const QString &rhs) { return lhs.compare(rhs, Qt::CaseInsensitive) < 0; }); 55 | int sum = 0; 56 | foreach(const QString fileName, files) { 57 | //qDebug() << fileName; 58 | //doOutput(dirStr + "/" + fileName + ":\n"); 59 | if( !regexp.isEmpty() && regexp.indexIn(fileName) >= 0 ) 60 | continue; 61 | QString fullPath = dirStr + "/" + fileName; 62 | sum += doGrepFile(fullPath, pat, regexp); 63 | if( m_terminated ) break; 64 | } 65 | if( m_globSettings->boolValue(GlobalSettings::GREP_SUB_DIR) ) { 66 | QStringList dirs = dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name); 67 | qSort(dirs.begin(), dirs.end(), 68 | [](const QString &lhs, const QString &rhs) { return lhs.compare(rhs, Qt::CaseInsensitive) < 0; }); 69 | foreach(const QString dirName, dirs) { 70 | QString fullPath = dirStr + "/" + dirName; 71 | sum += doGrepDir(pat, extentions, fullPath, regexp); 72 | if( m_terminated ) break; 73 | } 74 | } 75 | return sum; 76 | } 77 | // ファイル:fullPath から pat を検索 78 | int GrepEngine::doGrepFile(const QString &fullPath, const QString &pat, const QRegExp ®exp) 79 | { 80 | if( m_toTerminate ) { 81 | if( !m_terminated ) 82 | emit doOutput(tr("\n* grep terminated.\n")); 83 | m_terminated = true; 84 | return 0; 85 | } 86 | QString errorString; 87 | QTextCodec *codec; 88 | int bomLength; 89 | byte newLineCode; 90 | if( !::getTextCodec(fullPath, errorString, codec, bomLength, newLineCode) ) 91 | return 0; 92 | QFile file(fullPath); 93 | if( !file.open(QFile::ReadOnly /*| QFile::Text*/) ) 94 | return 0; 95 | if( bomLength != 0 ) 96 | file.seek(bomLength); 97 | Buffer buffer; 98 | QByteArray ba; 99 | while( !file.atEnd() ) { 100 | ba = file.read(1024*1024); // undone 1M境界処理 101 | QString buf = codec->toUnicode(ba); 102 | if( !buffer.basicInsertText(buffer.size(), (wchar_t *)buf.data(), buf.size()) ) { 103 | return 0; 104 | } 105 | } 106 | file.close(); 107 | 108 | bool init = true; 109 | pos_t pos = 0; 110 | int cnt = 0; 111 | while( (pos = m_sssrc->strstr(buffer, pos)) >= 0 ) { 112 | ++cnt; 113 | if( init ) { 114 | init = false; 115 | emit doOutput("\n\"" + fullPath + "\":\n"); 116 | } 117 | int ln = buffer.positionToLine(pos); 118 | pos_t ls = buffer.lineStartPosition(ln); 119 | pos_t nxls = buffer.lineStartPosition(ln+1); 120 | QString text = QString("%1:").arg(ln+1, 6); 121 | while( ls < nxls ) { 122 | text += QChar(buffer[ls++]); 123 | } 124 | emit doOutput(text); 125 | pos = nxls; 126 | } 127 | return cnt; 128 | } 129 | void GrepEngine::terminate() 130 | { 131 | m_toTerminate = true; 132 | } 133 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # openViVi 2 | open source version of ViVi text editor, which supports standard text editor features and vi commands. 3 | 4 | オープンソース版ViViテキストエディタ、 5 | 標準的なテキストエディタの機能とviコマンドをサポートします。 6 | 7 | 8 | 9 | # ■ バイナリダウンロード 10 | 11 | ## 開発版 for Windows: 12 | 13 | 以下から zip をダウンロードし、解凍・実行してください。 14 | 15 | https://github.com/vivisuke/openViVi/releases 16 | 17 | ## 定義 18 | 19 | |版種別|定義| 20 | |------|----| 21 | |開発版(dev)|予定された機能実装を行っている状態、仕様は流動的、実験的に機能を実装し削除することもあり。pre-alpha とも呼ばれる| 22 | |アルファ版|予定された機能がとりあえず実装された版、問題(仕様の不備、バグ)多め、原則的に新機能実装は行わない、ただし使い勝手が非常に悪い場合などは実装する場合有り、必要によってリファクタリング| 23 | |ベータ版|中品質(問題少なめ)、新機能実装は行わなわず、問題対処のみ行う、大規模なリファクタリングは行わない| 24 | |RC版(Release Candidate)|高品質、新機能実装は絶対に行わない、工数大・副作用が心配される中小問題は対処しない、リファクタリングは行わない| 25 | |安定版(stable)|高品質、新機能実装は絶対に行わない、工数大・副作用が心配される中小問題は対処しない、リファクタリングは行わない| 26 | 27 | # ■ 問題報告 28 | 29 | 問題報告は以下のページにお願いします。 30 |
※ 問題報告はどなたでも可能です。ただし要望的なものはご遠慮ください。 31 |
※ 現在(6月)は作者がopenViViソースコードをストレスなく編集できるようにすることが最優先なので、 32 | クラッシュバグ以外で作者が特に困らない&時間を要する問題対処は当面行いません。 33 | 34 | https://github.com/vivisuke/openViVi/issues 35 | 36 | # ■ スケジュール・進捗 37 | - 2020年4月より本格的に開発開始 ~~予定~~ 38 | - 現在は、作者がopenViViのソースコード・ドキュメント編集をopenViVi自身で行うために必要な機能実装、重要問題対処中 39 | - 当面は機能実装期間で、(作者の主観で)ささいな問題・環境依存問題の対処は行わない 40 | - スポンサーが多いほど開発に時間をかけます(目標:寄付千円あたりSPR3件対処) 41 | - ViVi 1.x 相当をまず実装予定(期間:1~2年?)→ ViVi 7.0.xxx 安定版(stable)としてリリース 42 | - 作者がドキュメント・ソース編集を行うために必要な機能から順に実装 43 | - 実装優先順位(優先順位は適時変更されます): 44 | 1. ~~エディットバッファ(非GUI)~~ done 45 | 1. ~~テキストエディタ基本機能(GUI、[1] ビューワ機能(ファイルオープン、テキスト表示、ミニマップ表示、スクロール), [2] 基本編集機能(キー・マウスによるテキスト選択、文字入力・削除、undo/redo、検索))~~ done 46 | 1. 基本 vi コマンド( ~~hjkl-+%wWbBGeE0^$GggfFtT;,jiaIArRoOsSpPxXdduUz>><<{c|d|y}mv./?nN*~~ )done 47 | 1. 基本 ex コマンド( ~~行番号pdewsgv~~ )done 48 | 1. 作者がソースコード・ドキュメント編集を行うための必須機能(~~インデント・逆インデント、オートインデント、単語補完、禅コーディング、終了時ファイル復帰、grep、検索オプション、タグジャンプ、対応括弧強調・移動、~~ 起動時引数・オプション、クリップボード履歴、文字列変換、罫線モード、罫線保護編集、テキストアライン、MDIタブ切り替え、日付等入力、リナンバ、アウトライン) 49 | 1. 基本以外の機能(多段MDIタブ、置換ダイアログ、BOX選択、D&D編集、画面分割、折返し表示、折り畳み、上書きモード、水平スクロールバー、ルーラー表示、マークダウン、印刷・印刷プレビュー、メニュー・ダイアログ等日本語化、キーボードマクロ、Des暗号化・復号化) 50 | 1. 基本以外の vi コマンド 51 | 1. 文書比較 52 | 1. スクリプト(QScriptEngine 使用?) 53 | 1. マルチカーソル? 54 | 1. マークダウンプレビュー・WYSIWYG編集 55 | 1. HTMLビュー? 56 | 1. ファイルシステム(ドッキングペイン?)? 57 | - ViVi 7.1.xxx 58 | - バイナリモード 59 | - CSVモード 60 | - キーボードカスタマイズ 61 | - メニューカスタマイズ 62 | - 巨大ファイル(1GB超)対応? 63 | 64 | # ■ 開発環境 65 | - Windows 10, Visual Studio 2019, C++17, ~~当面は32~~ 64bitモード only 66 | - GUI は Qt5(VS2019 VS tools) を使用 ~~?または今更 MFC ?~~ 67 | - Qt であれば Mac, Linux でもビルド可能なはず 68 | 69 | # ■ ビルド方法 70 | - Visual Studio 2019, Qt5.14(64ビットモード必須) をインストール 71 | - 「開発ツールのセットアップ」 https://www.youtube.com/watch?v=4gBAuga80bc 72 | - Qt download: https://www.qt.io/download-qt-installer 73 | - VS2019:拡張機能 > 拡張機能の管理 から Qt VS Tools をインストール 74 | - リポジトリの vivi/vivi.sln を VS2019 で開き、ビルド 75 | 76 | # ■ 開発管理方針 77 | ### プロジェクトへのご意見・ご要望・ご提案 78 | 本プロジェクトへのご意見・ご要望・ご提案は、スポンサー様からのみ受け付けます。 79 | ただし、寄付金額に比例した回数制限を設けます(寄付千円あたり1件とします)。 80 |
また、必ずしもそれらに従うというわけではありません。 81 | それらを参考にし、作者の独断と偏見・その時点での諸々の都合で、作者がプロジェクト管理上の全ての決定を行います(異論は認めない)。 82 | 83 | ### 問題報告 84 | 問題報告はどなたでも行うことができます。 85 | ただし、問題対処優先順位は作者が独断と偏見で決定します。場合によってはNPTF(No Plan To Fix)とします(異論は認めない)。 86 | 87 | ### 仕様かどうかの質問 88 | 明らかに不適切な動作が仕様なのかどうかの質問は、作者が極めて不快になるのでご遠慮ください。 89 | 90 | # ■ スポンサー様 91 | 本プロジェクトは下記スポンサー様のご支援を受けています。ありがとうございます(圧倒的でっかい感謝)。 92 | - S.Y様 (2025年1月 ¥1,000) 93 | - K.A様 (2024年12月 ¥1,000) 94 | - Y.T様 (2024年8月 ¥5,000) 95 | - KS様 (2023年8月 ¥7,000) 96 | - T.U様 (2023年5月 ¥2,000) 97 | - T.F様 (2023年2月 ¥1,000) 98 | - Y.K様 (2023年2月 ¥5,000) 99 | - D.Y様 (2023年1月 ¥5,000) 100 | - T.T様 (2022年11月 ¥30,000) 101 | - M.T様 (2022年10月 ¥5,000) 102 | - tono様 (2022年9月 ¥10,000) 103 | - H.S様 (2022年8月 ¥1,000) 104 | - M.S様 (2022年7月 ¥1,000) 105 | - T.K様 (2022年7月 ¥1,000) 106 | - M.T様 (2022年2月 ¥5,000) 107 | - H.S様 (2022年1月 ¥10,000) 108 | - Y.A様 (2021年4月 ¥1,000) 109 | - S.たなか様 (2021年2月 ¥1,000) 110 | - ワガツマ様 (2021年2月 ¥3,000) 111 | - K.I様 (2021年2月 ¥1,000) 112 | - Y.E様 (2021年1月 ¥1,000) 113 | - kaz様 (2020年12月 ¥3,000) 114 | - りくどう様 (2020年10月 ¥10,000) 115 | - ひらの様 (2020年7月 ¥7,000) 116 | - T.U様 (2020年7月 ¥2,000) 117 | - N.W様 (2020年6月 ¥5,000) 118 | - ペイヴメント様 (2020年6月 ¥3,000) 119 | - sempreff様 (2020年5月 ¥3,000) 120 | - NAO様 (2020年5月 ¥1,000) 121 | - kiyotosi様 (2020年5月 ¥1,000) 122 | - umibose様 (2020年5月 ¥20,000) 123 | - daruyanagi様 (2020年5月 ¥1,000) 124 | - J.N様 (2020年4月 ¥5,000) 125 | - YS INC様 (2020年4月 ¥1,000) 126 | - amnesia828様 (2020年4月 ¥10,000) 127 | - N.W様 (2020年4月 ¥5,000) 128 | - mkogax様 (2020年4月 ¥3,000) 129 | - K.Y様 (2020年3月 ¥5,000) 130 | - つぼい様 (2020年3月 ¥2,000) 131 | - Y.K様 (2020年2月 ¥1,000) 132 | 133 | スポンサーになって支援してあげようという方は、以下のページから寄付を行ってください。 134 | 135 | http://vivi.dyndns.org/vivi/donate.html 136 | 137 | ~~本プロジェクト管理者(ntsuda@master.email.ne.jp または https://twitter.com/vivisuke )までご連絡ください。~~ 138 | 139 | よろしくおながいしますー 140 | -------------------------------------------------------------------------------- /vivi/TestBuffer/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include "../buffer/Buffer.h" 6 | 7 | using namespace std; 8 | 9 | void test_Buffer(); 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | //QCoreApplication a(argc, argv); 14 | //return a.exec(); 15 | 16 | test_Buffer(); 17 | 18 | cout << "\nOK\n"; 19 | return 0; 20 | } 21 | void test_Buffer() 22 | { 23 | Buffer buf; 24 | { 25 | //auto b = buf.isEmpty(); 26 | //auto sz = buf.size(); 27 | //auto ln = buf.lineCount(); 28 | Q_ASSERT( buf.isEmpty() ); 29 | Q_ASSERT( buf.size() == 0 ); 30 | Q_ASSERT( buf.lineCount() == 0 ); 31 | Q_ASSERT( !buf.isModified() ); 32 | } 33 | // 34 | QString txt = "abc\nXYZZZ\n"; 35 | buf.insertText(0, (const wchar_t*)txt.data(), txt.size()); 36 | { 37 | auto b = buf.isEmpty(); 38 | auto sz = buf.size(); 39 | auto ln = buf.lineCount(); 40 | Q_ASSERT( !buf.isEmpty() ); 41 | Q_ASSERT( buf.size() == 10 ); 42 | Q_ASSERT( buf.lineCount() == 2 ); 43 | QString txt2; 44 | for (int i = 0; i < buf.size(); ++i) { 45 | txt2 += buf[i]; 46 | } 47 | Q_ASSERT( txt2 == txt ); 48 | Q_ASSERT( buf.isMatched(L"abc", 0) ); 49 | Q_ASSERT( !buf.isMatched(L"abc", 1) ); 50 | Q_ASSERT( !buf.isMatched(L"ABC", 0) ); 51 | Q_ASSERT( buf.isMatched(L"ZZZ", 6) ); 52 | Q_ASSERT( !buf.isMatched(L"ZZZ", 5) ); 53 | Q_ASSERT( !buf.isMatched(L"zzz", 6) ); 54 | Q_ASSERT( buf.isModified() ); 55 | Q_ASSERT( buf.isEqual(0, L"abc\nXYZZZ\n") ); 56 | Q_ASSERT( buf.lineStartPosition(0) == 0 ); 57 | Q_ASSERT( buf.lineStartPosition(1) == 4 ); 58 | Q_ASSERT( buf.positionToLine(0) == 0 ); 59 | Q_ASSERT( buf.positionToLine(3) == 0 ); 60 | Q_ASSERT( buf.positionToLine(4) == 1 ); 61 | Q_ASSERT( buf.positionToLine(9) == 1 ); 62 | } 63 | txt = "12345"; 64 | buf.insertText(6, (const wchar_t*)txt.data(), txt.size()); 65 | { 66 | auto b = buf.isEmpty(); 67 | auto sz = buf.size(); 68 | auto ln = buf.lineCount(); 69 | Q_ASSERT( !buf.isEmpty() ); 70 | Q_ASSERT( buf.size() == 15 ); 71 | Q_ASSERT( buf.lineCount() == 2 ); 72 | QString txt2; 73 | for (int i = 0; i < buf.size(); ++i) { 74 | txt2 += buf[i]; 75 | } 76 | Q_ASSERT( txt2 == "abc\nXY12345ZZZ\n" ); 77 | } 78 | //---------------------------------------------------------------------- 79 | buf.clear(); 80 | { 81 | //auto b = buf.isEmpty(); 82 | //auto sz = buf.size(); 83 | //auto ln = buf.lineCount(); 84 | Q_ASSERT( buf.isEmpty() ); 85 | Q_ASSERT( buf.size() == 0 ); 86 | Q_ASSERT( buf.lineCount() == 0 ); 87 | } 88 | txt = "abc\nXYZZZ"; // EOF行が空でない場合 89 | buf.insertText(0, (const wchar_t*)txt.data(), txt.size()); 90 | { 91 | auto b = buf.isEmpty(); 92 | auto sz = buf.size(); 93 | auto ln = buf.lineCount(); 94 | Q_ASSERT( !buf.isEmpty() ); 95 | Q_ASSERT( buf.size() == 9 ); 96 | Q_ASSERT( buf.lineCount() == 2 ); 97 | QString txt2; 98 | for (int i = 0; i < buf.size(); ++i) { 99 | txt2 += buf[i]; 100 | } 101 | Q_ASSERT( txt2 == txt ); 102 | Q_ASSERT( buf.isModified() ); 103 | Q_ASSERT(buf.isEqual(0, L"abc\nXYZZZ")); 104 | } 105 | buf.undo(); 106 | { 107 | Q_ASSERT( buf.isEmpty() ); 108 | Q_ASSERT( buf.size() == 0 ); 109 | Q_ASSERT( buf.lineCount() == 0 ); 110 | Q_ASSERT( !buf.isModified() ); 111 | } 112 | buf.redo(); 113 | { 114 | Q_ASSERT( !buf.isEmpty() ); 115 | Q_ASSERT( buf.size() == 9 ); 116 | Q_ASSERT( buf.lineCount() == 2 ); 117 | QString txt2; 118 | for (int i = 0; i < buf.size(); ++i) { 119 | txt2 += buf[i]; 120 | } 121 | Q_ASSERT( txt2 == txt ); 122 | Q_ASSERT( buf.isModified() ); 123 | Q_ASSERT(buf.isEqual(0, L"abc\nXYZZZ")); 124 | } 125 | buf.deleteText(2, 1); 126 | { 127 | Q_ASSERT( !buf.isEmpty() ); 128 | Q_ASSERT( buf.size() == 8 ); 129 | Q_ASSERT( buf.lineCount() == 2 ); 130 | Q_ASSERT( buf.isEqual(0, L"ab\nXYZZZ") ); 131 | } 132 | buf.deleteText(2, 1); // 改行削除 133 | { 134 | Q_ASSERT( !buf.isEmpty() ); 135 | Q_ASSERT( buf.size() == 7 ); 136 | Q_ASSERT( buf.lineCount() == 1 ); 137 | Q_ASSERT( buf.isEqual(0, L"abXYZZZ") ); 138 | } 139 | //---------------------------------------------------------------------- 140 | buf.clear(); 141 | txt = "1\n22\n333\n4444\n55555\n"; 142 | buf.insertText(0, (const wchar_t*)txt.data(), txt.size()); 143 | { 144 | Q_ASSERT( buf.lineStartPosition(0) == 0 ); 145 | Q_ASSERT( buf.lineStartPosition(1) == 2 ); 146 | Q_ASSERT( buf.lineStartPosition(2) == 5 ); 147 | Q_ASSERT( buf.lineStartPosition(3) == 9 ); 148 | Q_ASSERT( buf.lineStartPosition(4) == 14 ); 149 | Q_ASSERT( buf.positionToLine(4) == 1 ); 150 | Q_ASSERT( buf.positionToLine(5) == 2 ); 151 | Q_ASSERT( buf.positionToLine(8) == 2 ); 152 | Q_ASSERT( buf.positionToLine(9) == 3 ); 153 | } 154 | buf.deleteText(1, 1); // 1行目最後の改行削除 → "122\n333\n4444\n55555\n"; 155 | { 156 | Q_ASSERT(buf.isEqual(0, L"122\n333\n4444\n55555\n")); 157 | Q_ASSERT( buf.lineStartPosition(0) == 0 ); 158 | Q_ASSERT( buf.lineStartPosition(1) == 4 ); 159 | Q_ASSERT( buf.lineStartPosition(2) == 8 ); 160 | Q_ASSERT( buf.lineStartPosition(3) == 13 ); 161 | Q_ASSERT( buf.positionToLine(4) == 1 ); 162 | Q_ASSERT( buf.positionToLine(5) == 1 ); 163 | Q_ASSERT( buf.positionToLine(8) == 2 ); 164 | Q_ASSERT( buf.positionToLine(9) == 2 ); 165 | } 166 | } 167 | -------------------------------------------------------------------------------- /docs/buffer.txt: -------------------------------------------------------------------------------- 1 | ■ Buffer 2 | ・GUIから直接利用されるバッファクラス 3 | ・文字サイズは16ビット固定 4 | ・行管理有り、行フラグ、マーク機能、undo/redo機能あり 5 | ・Buffer public メンバ関数: 6 | ・状態参照 7 | bool isEmpty() const 8 | bool isModified() const 9 | size_type size() const 10 | size_type capacity() const 11 | line_t lineCount() const // 行数 12 | line_t EOFLine() const // EOF行番号を返す 13 | pos_t lineStartPosition(line_t line) const // 指定行の先頭位置を返す 14 | ssize_t lineSize(line_t line) const // 指定行サイズを返す 15 | line_t positionToLine(pos_t pos) const // 指定位置を含む行の行番号を返す 16 | ・状態変更 17 | ・参照 18 | char_t operator[](pos_t pos) const 19 | char_t charAt(pos_t) const; 20 | char_t *getText(pos_t &) const; 21 | const char_t *raw_data(pos_t pos) const; 22 | bool getText(pos_t, char_t *buf, int length) const; 23 | bool getText(pos_t pos, ssize_t sz, std::vector &) const; 24 | ・挿入 25 | bool insertText(pos_t, cchar_t *, ssize_t, int = -1) // 挿入、undo 対応 26 | bool basicInsertText(pos_t, cchar_t) // undo 非対応 27 | bool basicInsertText(pos_t, cchar_t *, cchar_t *, line_t ln = -1) // undo 非対応 28 | bool basicInsertText(pos_t, cchar_t *, ssize_t, line_t ln = -1) // undo 非対応 29 | ・削除 30 | bool deleteText(pos_t, ssize_t, bool BS=false, int = -1) // 削除、undo 対応 31 | void basicDeleteText(pos_t) 32 | void basicDeleteText(pos_t, ssize_t sz, line_t ln = -1) 33 | ・置換 34 | bool replaceText(pos_t pos, ssize_t dsz, cchar_t *, int isz, int = -1, 35 | bool = false) // 編集箇所更新 36 | int replaceAll(cchar_t *before, ssize_t, cchar_t *after, ssize_t, uint opt = 0, byte = 0) 37 | int replaceAll(cchar_t *before, ssize_t, cchar_t *after, ssize_t, uint opt, byte, pos_t, pos_t &, pos_t &, bool = true) 38 | void basicReplaceText(pos_t, ssize_t dsz, cchar_t *, ssize_t isz, line_t ln = -1) 39 | ・undo/redo 40 | int undo() 41 | int redo() 42 | void openUndoBlock() 43 | void closeUndoBlock() 44 | void closeAllUndoBlock() 45 | void clearUndoMgr() 46 | ・検索 47 | pos_t strstr(cchar_t *pat, ssize_t sz, pos_t from = 0, pos_t last = -1, bool ic = false) const; 48 | pos_t strrstr(cchar_t *pat, ssize_t sz, pos_t from = -1, pos_t last = 0, bool ic = false) const; 49 | pos_t indexOf(SSSearch &, cchar_t *pat, ssize_t sz, pos_t from = 0, uint opt = 0, pos_t last = -1, byte = 0) const; 50 | pos_t rIndexOf(SSSearch &, cchar_t *pat, ssize_t sz, pos_t from = 0, uint opt = 0, pos_t last = -1, byte = 0) const; 51 | bool isMatched(cchar_t *pat, ssize_t sz, pos_t pos) const; 52 | bool isMatched(cchar_t *pat, pos_t pos) const; 53 | bool isMatchedIC(cchar_t *pat, ssize_t sz, pos_t pos) const; 54 | bool isMatchedIC(cchar_t *pat, pos_t pos) const; 55 | ・行フラグ 56 | void setLineFlag(line_t, uint); 57 | void resetLineFlag(line_t, uint); 58 | ・マーク 59 | void setMark(pos_t pos, char ch = '\0'); // ch = ['a', 'z'], pos < 0 for clear Mark 60 | void clearMark(char ch); 61 | void clearMark(pos_t pos); 62 | ・その他 63 | 64 | 65 | ■ gap_buffer 66 | ・テキストデータを管理するための最下層クラス 67 | ・テキストデータの参照・挿入・削除機能等を持つ 68 | ・途中にギャップを持つデータ構造 69 | ・編集箇所が局所的であれば挿入・削除処理時間が O(1) で高速 70 | ・データが多く(1G程度以上)、編集箇所が局所化されていない場合は処理時間が O(N) で低速 71 | ・基本は標準ライブラリのコンテナクラス(vector等)と同じインタフェースを持つが、 72 |  高速化(単純化?)のために、挿入削除等の位置指定にイテレータではなくインデックスを用いる 73 | ・gap_buffer public メンバ関数: 74 | ・状態参照 75 | bool isEmpty() const 76 | bool empty() const 77 | size_type size() const 78 | size_type capacity() const 79 | ・状態変更 80 | void resize(size_type sz, Type t = Type()) 81 | bool reserve(size_type sz) 82 | ・参照 83 | value_type& front() 84 | value_type& back() 85 | value_type operator[](pos_t ix) const // ix の範囲チェックなし 86 | value_type &operator[](pos_t ix) 87 | value_type at(pos_t ix) const // ix の範囲チェックあり 88 | value_type& at(pos_t ix) 89 | value_type &ref(pos_t ix) const 90 | size_type get_data(pos_t ix, pointer buf, int bufSize) const // [ix, ix+bufSize) を buf にコピー 91 | value_type &ref(pos_t ix) 92 | value_type *data() 93 | ・挿入 94 | void push_back(value_type v) 95 | void push_front(value_type v) 96 | bool insert(pos_t ix, value_type v) 97 | bool insert(pos_t ix, const_pointer first, const_pointer last) 98 | bool insert(pos_t ix, const_pointer first, ssize_t sz) 99 | ・削除 100 | void clear() 101 | void pop_back() 102 | void pop_front() 103 | void erase(pos_t ix) 104 | void erase(size_t first, size_t sz) // erase [first, first + sz) 105 | void eraseFL(size_t first, size_t last) // erase [first, last) 106 | ・置換 107 | void setAt(pos_t ix, value_type v) 108 | ・検索 109 | bool isMatch(pos_t ix, const value_type *pat, ssize_t sz) const 110 | bool isMatchLC(pos_t ix, const value_type *pat, size_t sz) const 111 | pos_t indexOf(const value_type *pat, size_t sz, pos_t ix = 0, bool ic = false) const // native text search 112 | ・その他 113 | void swap(gap_buffer &x) 114 | bool operator==(const gap_buffer &x) const 115 | bool operator!=(const gap_buffer &x) const 116 | 117 | 118 | -------------------------------------------------------------------------------- /vivi/vivi64/grep.cpp: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------- 2 | // 3 | // File: "grep.cpp" 4 | // Created: 02-10-2013 5 | // Author: 津田伸秀 6 | // Description: 7 | // 8 | //---------------------------------------------------------------------- 9 | 10 | #include 11 | #include 12 | #include "mainwindow.h" 13 | #include "EditView.h" 14 | #include "TextCursor.h" 15 | #include "globalSettings.h" 16 | #include "GrepDlg.h" 17 | #include "GreppingDlg.h" 18 | //###include "OutputView.h" 19 | #include "charEncoding.h" 20 | #include "typeSettings.h" 21 | #include "../buffer/Buffer.h" 22 | #include "../buffer/sssearch.h" 23 | #include "GrepEngine.h" 24 | #include "OutputView.h" 25 | 26 | bool isEditViewFocused(QWidget* w); 27 | bool isEditView(const QWidget* w); 28 | 29 | void MainWindow::on_action_GrepCurWord_triggered() 30 | { 31 | grep(true); 32 | } 33 | void MainWindow::on_action_Grep_triggered() 34 | { 35 | grep(false); 36 | } 37 | void MainWindow::grep(bool curWord) 38 | { 39 | if( m_grepEngine != 0 ) return; 40 | #if 0 41 | if( !certified() && !m_possibleGrepCount ) { 42 | QMessageBox::information(this, "SakuSakuEditor", 43 | tr("You can't Grep, beause of Grep Count is 0\n") 44 | + tr("Grep Count will increse every 10 minits.")); 45 | return; 46 | } 47 | #endif 48 | GrepDlg aDlg(globSettings(), m_grepDirHist, m_possibleGrepCount); 49 | //EditView *view = (EditView *)ui.tabWidget->currentWidget(); 50 | EditView *view = currentWidget(); 51 | if( isEditViewFocused(view) ) { 52 | if( curWord ) { // カーソル位置単語を検索パターンに設定 53 | TextCursor cur(*view->textCursor()); 54 | cur.movePosition(TextCursor::BEG_WORD); 55 | cur.movePosition(TextCursor::END_WORD, TextCursor::KEEP_ANCHOR); 56 | aDlg.setFindString(cur.selectedText()); 57 | } else if( view->hasSelectionInALine() ) { 58 | aDlg.setFindString(view->selectedText()); 59 | } 60 | } 61 | if( isEditView(view) ) { 62 | aDlg.setTypeName(view->typeSettings()->name()); 63 | } 64 | if( aDlg.exec() != QDialog::Accepted ) return; 65 | QSettings settings; 66 | settings.setValue("grepExclude", aDlg.exclude()); 67 | //if( !certified() && !view->isSakuSakuGame() ) 68 | // --m_possibleGrepCount; 69 | globSettings()->setBoolValue(GlobalSettings::IGNORE_CASE, aDlg.ignoreCase()); 70 | globSettings()->setBoolValue(GlobalSettings::WHOLE_WORD_ONLY, aDlg.wholeWordOnly()); 71 | globSettings()->setBoolValue(GlobalSettings::REGEXP, aDlg.regExp()); 72 | globSettings()->setBoolValue(GlobalSettings::GREP_SUB_DIR, aDlg.grepSubDir()); 73 | const bool bGrepView = aDlg.grepView(); 74 | globSettings()->setBoolValue(GlobalSettings::GREP_VIEW, bGrepView); 75 | QString dirStr = aDlg.dir(); 76 | int ix = m_grepDirHist.indexOf(dirStr); 77 | if( ix >= 0 ) m_grepDirHist.removeAt(ix); 78 | m_grepDirHist.push_front(dirStr); 79 | setFindString(aDlg.findString()); 80 | updateFindStringCB(); 81 | 82 | m_grepEngine = new GrepEngine(globSettings()); 83 | m_grepEngine->moveToThread(&m_thread); 84 | connect(this, SIGNAL(doGrep(QString, QString, QString, QString)), m_grepEngine, SLOT(doGrep(QString, QString, QString, QString))); 85 | connect(m_grepEngine, SIGNAL(finished(int)), this, SLOT(grepFinished(int))); 86 | const QString mess = tr("* grepping '%1' at %2, %3 ...\n") 87 | .arg(aDlg.findString()).arg(dirStr).arg(aDlg.extentions()); 88 | #if 0 89 | if( bGrepView ) { 90 | addNewView(m_grepView = createView(), QString("Grep%1").arg(++m_seqGrepView)); 91 | m_grepView->setGrepView(); 92 | connect(m_grepEngine, SIGNAL(doOutput(const QString &)), this, SLOT(doOutputToGrepView(const QString &))); //## 93 | doOutputToGrepView(mess); 94 | } else 95 | #endif 96 | { 97 | connect(m_grepEngine, SIGNAL(doOutput(const QString &)), this, SLOT(doOutputToBar(const QString &))); //## 98 | m_outputWidget->clear(); 99 | doOutput(mess); 100 | } 101 | GreppingDlg dlg; // グレップ中ダイアログ 102 | //connect(&dlg, SIGNAL(terminate()), m_grepEngine, SLOT(terminate())); 103 | connect(m_grepEngine, SIGNAL(greppingDir(const QString &)), &dlg, SLOT(setGreppingDir(const QString &))); 104 | connect(m_grepEngine, SIGNAL(finished(int)), &dlg, SLOT(reject())); 105 | 106 | ///QMessageBox mb(); 107 | 108 | //m_grepEngine->doGrep(aDlg.findString(), aDlg.extentions(), dirStr); 109 | #if 1 110 | emit doGrep(aDlg.findString(), aDlg.extentions(), dirStr, aDlg.exclude()); 111 | #else 112 | const bool b = QMetaObject::invokeMethod(m_grepEngine, "doGrep", 113 | //Qt::QueuedConnection, 114 | //Q_RETURN_ARG(), 115 | Q_ARG(QString, aDlg.findString()), 116 | Q_ARG(QString, aDlg.extentions()), 117 | Q_ARG(QString, dirStr), 118 | Q_ARG(QString, aDlg.exclude())); 119 | #endif 120 | 121 | dlg.exec(); 122 | if( m_grepEngine != 0 ) 123 | m_grepEngine->terminate(); 124 | if( !bGrepView ) 125 | m_outputWidget->setFocus(); 126 | } 127 | void MainWindow::grepFinished(int cnt) 128 | { 129 | delete m_grepEngine; 130 | m_grepEngine = 0; 131 | const QString mess = tr("\n* grep finished, %1 line(s) matched.\n").arg(cnt); 132 | if( true /*m_grepView == 0*/ ) { 133 | doOutput(mess); 134 | } else { 135 | doOutputToGrepView(mess); 136 | m_grepView->setModified(false); 137 | m_grepView->clearLineFlags(); 138 | m_grepView->update(); 139 | m_grepView->setFocus(); 140 | m_grepView = 0; 141 | } 142 | updateSearchOptions(); 143 | } 144 | 145 | -------------------------------------------------------------------------------- /vivi/vivi64/globalSettings.cpp: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------- 2 | // 3 | // File: "globalSettings.cpp" 4 | // Created: 15-9-2013 5 | // Author: 津田伸秀 6 | // Description: 7 | // 8 | //---------------------------------------------------------------------- 9 | 10 | #include "globalSettings.h" 11 | #include "charEncoding.h" 12 | #include 13 | 14 | struct KeyBoolItem 15 | { 16 | cchar *m_key; // キー名 17 | bool m_value; // 18 | }; 19 | static KeyBoolItem keyBoolTable[] = { 20 | {"IgnoreCase", true}, 21 | {"MatchWholeWordOnly", false}, 22 | {"RegExp", false}, 23 | {"LoopSearch", true}, 24 | {"IncrementalSearch", true}, 25 | {"GrepSubDir", true}, 26 | {"ViewRtBtmPicture", true}, 27 | {"SyncVertScroll", false}, 28 | {"SyncHorzScroll", false}, 29 | {"ignoreMocFile", true}, 30 | //{"statementCompletion", true}, 31 | //{"wordCompletion", true}, 32 | //{"keywordCompletion", true}, 33 | {"withBOM", true}, 34 | {"MiniMap", true}, 35 | {"viCommand", false}, 36 | {"openOpenedDocs", true}, 37 | {"grepView", false}, 38 | {"outputView", false}, 39 | {0, 0} 40 | }; 41 | struct KeyTextItem 42 | { 43 | cchar *m_key; // キー名 44 | cwchar *m_value; // 45 | }; 46 | static KeyTextItem keyTextTable[] = { 47 | //{"pict1Path", L""}, 48 | //{"pict2Path", L""}, 49 | {"OutputFontName", L"メイリオ"}, 50 | //{"MailAddress", L""}, 51 | //{"UserName", L""}, 52 | //{"CertCode", L""}, 53 | //{"PassCode", L""}, 54 | {"ZenCodingPath", L""}, 55 | {"htdocsRoot", L""}, 56 | {0, 0} 57 | }; 58 | struct KeyEnumItem 59 | { 60 | cchar *m_key; // キー名 61 | int m_value; // 62 | } keyEnumTable[] = { 63 | {"CharEncoding", 0}, 64 | {"DocType", 0}, 65 | {0, 0} 66 | }; 67 | struct KeyIntItem 68 | { 69 | cchar *m_key; // キー名 70 | int m_value; // 71 | }; 72 | static KeyIntItem keyIntTable[] = { 73 | {"OutputFontSize", 10}, 74 | {"PictureOpacity", 100}, 75 | {"PictureScale", 50}, // % 76 | {0, 0} 77 | }; 78 | 79 | GlobalSettings::GlobalSettings() 80 | { 81 | init(); 82 | readSettings(); 83 | } 84 | void GlobalSettings::init() 85 | { 86 | //for(int i = 0; i < N_COLOR; ++i) 87 | // m_colors[i] = QColor(keyColorTable[i].m_color); 88 | //for(int i = 0; i < N_BOOL; ++i) 89 | // m_boolValues[i] = keyBoolTable[i].m_value; 90 | for(int i = 0; i < N_INT; ++i) 91 | m_intValues[i] = keyIntTable[i].m_value; 92 | for(int i = 0; i < N_TEXT; ++i) 93 | m_textValues[i] = QString((QChar *)keyTextTable[i].m_value); 94 | for(int i = 0; i < N_ENUM; ++i) 95 | m_enumValues[i] = keyEnumTable[i].m_value; 96 | } 97 | void GlobalSettings::writeSettings() const 98 | { 99 | QSettings settings; 100 | for(int i = 0; i < N_BOOL; ++i) { 101 | const QString key = QString("global/") + QString("/bool") + QString(keyBoolTable[i].m_key); 102 | settings.setValue(key, m_boolValues[i]); 103 | } 104 | for(int i = 0; i < N_INT; ++i) { 105 | const QString key = QString("global/") + QString("/int") + QString(keyIntTable[i].m_key); 106 | settings.setValue(key, m_intValues[i]); 107 | } 108 | for(int i = 0; i < N_TEXT; ++i) { 109 | const QString key = QString("global/") + QString("/text") + QString(keyTextTable[i].m_key); 110 | settings.setValue(key, m_textValues[i]); 111 | } 112 | for(int i = 0; i < N_ENUM; ++i) { 113 | const QString key = QString("global/") + QString("/enum") + QString(keyEnumTable[i].m_key); 114 | settings.setValue(key, m_enumValues[i]); 115 | } 116 | } 117 | void GlobalSettings::readSettings() 118 | { 119 | QSettings settings; 120 | for(int i = 0; i < N_BOOL; ++i) { 121 | const QString key = QString("global/") + QString("/bool") + QString(keyBoolTable[i].m_key); 122 | const bool v = settings.value(key, keyBoolTable[i].m_value).toBool(); 123 | m_boolValues[i] = v; 124 | } 125 | for(int i = 0; i < N_INT; ++i) { 126 | const QString key = QString("global/") + QString("/int") + QString(keyIntTable[i].m_key); 127 | const int v = settings.value(key, keyIntTable[i].m_value).toInt(); 128 | m_intValues[i] = v; 129 | } 130 | for(int i = 0; i < N_TEXT; ++i) { 131 | const QString key = QString("global/") + QString("/text") + QString(keyTextTable[i].m_key); 132 | const QString t = settings.value(key, QString((QChar *)keyTextTable[i].m_value)).toString(); 133 | m_textValues[i] = t; 134 | } 135 | for(int i = 0; i < N_ENUM; ++i) { 136 | const QString key = QString("global/") + QString("/enum") + QString(keyEnumTable[i].m_key); 137 | const int v = settings.value(key, keyEnumTable[i].m_value).toInt(); 138 | m_enumValues[i] = v; 139 | } 140 | } 141 | QByteArray GlobalSettings::codecName(int enc) const 142 | { 143 | switch( enc ) { 144 | default: 145 | case CharEncoding::UTF8: return QByteArray("UTF-8"); 146 | case CharEncoding::UTF16LE: return QByteArray("UTF-16LE"); 147 | case CharEncoding::UTF16BE: return QByteArray("UTF-16BE"); 148 | case CharEncoding::SJIS: return QByteArray("Shift-JIS"); 149 | case CharEncoding::EUC: return QByteArray("EUC-JP"); 150 | } 151 | } 152 | QByteArray GlobalSettings::defaultCodecName() const 153 | { 154 | return codecName(enumValue(CHAR_ENCODING)); 155 | #if 0 156 | switch( enumValue(CHAR_ENCODING) ) { 157 | default: 158 | case CHAR_ENC_UTF_8: return QByteArray("UTF-8"); 159 | case CHAR_ENC_UTF_16LE: return QByteArray("UTF-16LE"); 160 | case CHAR_ENC_UTF_16BE: return QByteArray("UTF-16BE"); 161 | case CHAR_ENC_SJIS: return QByteArray("Shift_JIS"); 162 | case CHAR_ENC_EUC: return QByteArray("EUC"); 163 | } 164 | #endif 165 | } 166 | -------------------------------------------------------------------------------- /vivi/vivi64/GlobalStgDlg.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "GlobalStgDlg.h" 4 | #include "globalSettings.h" 5 | 6 | GlobalStgDlg::GlobalStgDlg(GlobalSettings *globSettings, QWidget *parent) 7 | : QDialog(parent) 8 | , m_globSettings(globSettings) 9 | { 10 | ui.setupUi(this); 11 | QStringList lst; 12 | lst << "UTF-8" << "UTF-16LE" << "UTF-16BE" << "Sjift_JIS" << "EUC"; 13 | ui.charEncodingCB->addItems(lst); 14 | ui.charEncodingCB->setCurrentIndex(m_globSettings->enumValue(GlobalSettings::CHAR_ENCODING)); 15 | ui.withBOM->setChecked(m_globSettings->boolValue(GlobalSettings::WITH_BOM)); 16 | lst.clear(); 17 | lst << "Default" << "CPP" << "C#" << "CSS" << "F#" << "HLSL" << "HTML" 18 | << "JAVA" << "JS" << "TS" << "LOG" << "MARKDN" << "PASCAL" << "PERL" << "PHP" 19 | << "PYTHON" << "GDSCRIPT" << "RUBY" << "SQL" << "TXT"; 20 | ui.docTypeCB->addItems(lst); 21 | ui.docTypeCB->setCurrentIndex(m_globSettings->enumValue(GlobalSettings::DOC_TYPE)); 22 | ui.docTypeCB->setMaxVisibleItems(ui.docTypeCB->count()); 23 | //ui.pict1FilePath->setText(m_globSettings->textValue(GlobalSettings::PICTURE1_PATH)); 24 | //connect(ui.pict1Ref, SIGNAL(clicked()), this, SLOT(refPict1FilePath())); 25 | //ui.pict2FilePath->setText(m_globSettings->textValue(GlobalSettings::PICTURE2_PATH)); 26 | //connect(ui.pict2Ref, SIGNAL(clicked()), this, SLOT(refPict2FilePath())); 27 | //ui.alphaSB->setValue(m_globSettings->intValue(GlobalSettings::PICTURE_OPACITY)/100.0); 28 | //ui.scaleSB->setValue(m_globSettings->intValue(GlobalSettings::PICTURE_SCALE)/100.0); 29 | //ui.ZenCodingFilePath->setText(m_globSettings->textValue(GlobalSettings::ZEN_CODING_PATH)); 30 | //connect(ui.ZCFRef, SIGNAL(clicked()), this, SLOT(ZenCodingFilePath())); 31 | ui.htdocsRoot->setText(m_globSettings->textValue(GlobalSettings::HTDOCS_ROOT)); 32 | connect(ui.htdocsRef, SIGNAL(clicked()), this, SLOT(htdocsRootPath())); 33 | //ui.statementCompletion->setChecked(m_globSettings->boolValue(GlobalSettings::STATEMENT_COMPLETION)); 34 | //ui.wordCompletion->setChecked(m_globSettings->boolValue(GlobalSettings::WORD_COMPLETION)); 35 | //ui.keywordCompletion->setChecked(m_globSettings->boolValue(GlobalSettings::KEYWORD_COMPLETION)); 36 | ui.MiniMap->setChecked(m_globSettings->boolValue(GlobalSettings::MINI_MAP)); 37 | ui.OpenOpenedDocs->setChecked(m_globSettings->boolValue(GlobalSettings::OPEN_OPENED_DOCS)); 38 | 39 | QFontDatabase db; 40 | ui.fontFamilyCB->addItems(db.families()); 41 | setFontFamily(m_globSettings->textValue(GlobalSettings::OUTPUT_FONT_NAME)); 42 | ui.fontSizeSB->setValue(m_globSettings->intValue(GlobalSettings::OUTPUT_FONT_SIZE)); 43 | ui.outputBar->setChecked(!m_globSettings->boolValue(GlobalSettings::OUTPUT_VIEW)); 44 | ui.outputView->setChecked(m_globSettings->boolValue(GlobalSettings::OUTPUT_VIEW)); 45 | } 46 | GlobalStgDlg::~GlobalStgDlg() 47 | { 48 | } 49 | void GlobalStgDlg::setFontFamily(const QString &name) 50 | { 51 | int ix = ui.fontFamilyCB->findText(name); 52 | if( ix >= 0 ) 53 | ui.fontFamilyCB->setCurrentIndex(ix); 54 | } 55 | void GlobalStgDlg::accept() 56 | { 57 | m_globSettings->setEnumValue(GlobalSettings::CHAR_ENCODING, ui.charEncodingCB->currentIndex()); 58 | m_globSettings->setBoolValue(GlobalSettings::WITH_BOM, ui.withBOM->isChecked()); 59 | //m_globSettings->setBoolValue(GlobalSettings::STATEMENT_COMPLETION, ui.statementCompletion->isChecked()); 60 | //m_globSettings->setBoolValue(GlobalSettings::WORD_COMPLETION, ui.wordCompletion->isChecked()); 61 | //m_globSettings->setBoolValue(GlobalSettings::KEYWORD_COMPLETION, ui.keywordCompletion->isChecked()); 62 | m_globSettings->setEnumValue(GlobalSettings::DOC_TYPE, ui.docTypeCB->currentIndex()); 63 | m_globSettings->setTextValue(GlobalSettings::OUTPUT_FONT_NAME, ui.fontFamilyCB->currentText()); 64 | m_globSettings->setIntValue(GlobalSettings::OUTPUT_FONT_SIZE, ui.fontSizeSB->value()); 65 | m_globSettings->setBoolValue(GlobalSettings::OUTPUT_VIEW, ui.outputView->isChecked()); 66 | //m_globSettings->setTextValue(GlobalSettings::PICTURE1_PATH, ui.pict1FilePath->text()); 67 | //m_globSettings->setTextValue(GlobalSettings::PICTURE2_PATH, ui.pict2FilePath->text()); 68 | m_globSettings->setTextValue(GlobalSettings::ZEN_CODING_PATH, ui.ZenCodingFilePath->text()); 69 | m_globSettings->setTextValue(GlobalSettings::HTDOCS_ROOT, ui.htdocsRoot->text()); 70 | //qDebug() << m_globSettings->textValue(GlobalSettings::PICTURE1_PATH); 71 | //m_globSettings->setIntValue(GlobalSettings::PICTURE_OPACITY, (int)(ui.alphaSB->value() * 100)); 72 | //m_globSettings->setIntValue(GlobalSettings::PICTURE_SCALE, (int)(ui.scaleSB->value() * 100)); 73 | m_globSettings->setBoolValue(GlobalSettings::MINI_MAP, ui.MiniMap->isChecked()); 74 | m_globSettings->setBoolValue(GlobalSettings::OPEN_OPENED_DOCS, ui.OpenOpenedDocs->isChecked()); 75 | QDialog::accept(); 76 | } 77 | #if 0 78 | void GlobalStgDlg::refPict1FilePath() 79 | { 80 | QString fileName = QFileDialog::getOpenFileName(this, "Pictue File Name"); 81 | if( !fileName.isEmpty() ) 82 | ui.pict1FilePath->setText(fileName); 83 | } 84 | void GlobalStgDlg::refPict2FilePath() 85 | { 86 | QString fileName = QFileDialog::getOpenFileName(this, "Pictue File Name"); 87 | if( !fileName.isEmpty() ) 88 | ui.pict2FilePath->setText(fileName); 89 | } 90 | #endif 91 | void GlobalStgDlg::ZenCodingFilePath() 92 | { 93 | QString fileName = QFileDialog::getOpenFileName(this, "Zen-Coding File Name"); 94 | if( !fileName.isEmpty() ) 95 | ui.ZenCodingFilePath->setText(fileName); 96 | } 97 | void GlobalStgDlg::htdocsRootPath() 98 | { 99 | QString dir = QFileDialog::getExistingDirectory(this, "HTML Docs Root Dir"); 100 | if( !dir.isEmpty() ) { 101 | dir.replace("\\", "/"); 102 | ui.htdocsRoot->setText(dir); 103 | } 104 | } 105 | -------------------------------------------------------------------------------- /vivi/vivi64/GrepDlg.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "GrepDlg.h" 3 | #include "globalSettings.h" 4 | #include "version.h" 5 | 6 | GrepDlg::GrepDlg(GlobalSettings *globSettings, const QStringList &grepDirHist, int cnt, QWidget *parent) 7 | : QDialog(parent) 8 | , m_globSettings(globSettings) 9 | { 10 | ui.setupUi(this); 11 | //if( !globSettings->certified() ) 12 | // setWindowTitle(tr("GrepDlg (you can grep %1 times, including this one)").arg(cnt)); 13 | //ui.ignoreCase->setIcon(QIcon(QPixmap(":/MainWindow/Resources/icSearch.png"))); 14 | //ui.wholeWordOnly->setIcon(QIcon(QPixmap(":/MainWindow/Resources/wordSearch.png"))); 15 | //ui.regExp->setIcon(QIcon(QPixmap(":/MainWindow/Resources/regexp.png"))); 16 | ui.findString->setCompleter(0); 17 | ui.ignoreCase->setChecked(m_globSettings->boolValue(GlobalSettings::IGNORE_CASE)); 18 | ui.wholeWordOnly->setChecked(m_globSettings->boolValue(GlobalSettings::WHOLE_WORD_ONLY)); 19 | ui.regExp->setChecked(m_globSettings->boolValue(GlobalSettings::REGEXP)); 20 | ui.grepSubDir->setChecked(m_globSettings->boolValue(GlobalSettings::GREP_SUB_DIR)); 21 | connect(ui.regexpHelp, SIGNAL(clicked()), this, SLOT(regexpHelp())); 22 | ui.outputBar->setChecked(!m_globSettings->boolValue(GlobalSettings::GREP_VIEW)); 23 | ui.grepView->setChecked(m_globSettings->boolValue(GlobalSettings::GREP_VIEW)); 24 | 25 | QSettings settings; 26 | QStringList strList1 = settings.value("findStringList").toStringList(); 27 | ui.findString->addItems(strList1); 28 | ui.findString->lineEdit()->setSelection(0, ui.findString->lineEdit()->text().size()); 29 | QStringList strList2; 30 | strList2 << "*.*" // 0 setTypeName() の番号と一致すること! 31 | << "*.h;*.cpp;*.c;*.cxx" // 1 32 | << "*.cs" // 2 33 | << "*.java" // 3 34 | << "*.pas;*.inc;*.int" // 4 35 | << "*.rb" // 5 36 | << "*.cgi;*.pm;*.pl;*.t" // 6 37 | << "*.py" // 7 38 | << "*.html;*.htm;*.php,*phtml" // 8 39 | << "*.js;*.ts" // 9 40 | << "*.css" // 10 41 | << "*.fs,*fsi,*fsx,*fsscript,*ml,*mli" // 11 42 | << "*.log" // 12 43 | << "*.sql" // 13 44 | << "*.txt"; // 14 45 | ui.extensions->addItems(strList2); 46 | ui.dir->addItems(grepDirHist); 47 | ui.dir->lineEdit()->setText(QDir::currentPath()); 48 | ui.exclude->setText(settings.value("grepExclude").toString()); 49 | m_fileSystemModel.setRootPath(QDir::currentPath()); 50 | m_fileSystemModel.setFilter(QDir::Dirs | QDir::NoDot | QDir::NoDotDot); 51 | ui.treeView->setModel(&m_fileSystemModel); 52 | connect(ui.treeView, SIGNAL(doubleClicked ( QModelIndex )), 53 | this, SLOT(dirViewDoubleClicked ( QModelIndex ))); 54 | //connect(ui.treeView, SIGNAL(clicked ( QModelIndex)), 55 | // this, SLOT(dirViewClicked ( QModelIndex))); 56 | QHeaderView *header = ui.treeView->header(); 57 | header->hideSection(1); 58 | header->hideSection(2); 59 | header->hideSection(3); 60 | } 61 | void GrepDlg::setTypeName(const QString &typeName) 62 | { 63 | if( typeName == "CPP" ) 64 | ui.extensions->setCurrentIndex(1); 65 | else if( typeName == "C#" ) 66 | ui.extensions->setCurrentIndex(2); 67 | else if( typeName == "JAVA" ) 68 | ui.extensions->setCurrentIndex(3); 69 | else if( typeName == "PASCAL" ) 70 | ui.extensions->setCurrentIndex(4); 71 | else if( typeName == "RUBY" ) 72 | ui.extensions->setCurrentIndex(5); 73 | else if( typeName == "PERL" ) 74 | ui.extensions->setCurrentIndex(6); 75 | else if( typeName == "PYTHON" ) 76 | ui.extensions->setCurrentIndex(7); 77 | else if( typeName == "GDSCRIPT" ) 78 | ui.extensions->setCurrentIndex(8); 79 | else if( typeName == "HTML" || typeName == "PHP" ) 80 | ui.extensions->setCurrentIndex(9); 81 | else if( typeName == "JS" || typeName == "TS" ) 82 | ui.extensions->setCurrentIndex(10); 83 | else if( typeName == "CSS" ) 84 | ui.extensions->setCurrentIndex(11); 85 | else if( typeName == "F#" ) 86 | ui.extensions->setCurrentIndex(12); 87 | else if( typeName == "LOG" ) 88 | ui.extensions->setCurrentIndex(13); 89 | else if( typeName == "SQL" ) 90 | ui.extensions->setCurrentIndex(14); 91 | else if( typeName == "TXT" ) 92 | ui.extensions->setCurrentIndex(15); 93 | } 94 | 95 | GrepDlg::~GrepDlg() 96 | { 97 | } 98 | void GrepDlg::dirViewClicked( QModelIndex index ) 99 | { 100 | } 101 | void GrepDlg::dirViewDoubleClicked( QModelIndex index ) 102 | { 103 | //int row = index.row(); 104 | QString path = m_fileSystemModel.filePath(index); 105 | ui.dir->lineEdit()->setText(path); 106 | } 107 | QString GrepDlg::findString() const 108 | { 109 | return ui.findString->lineEdit()->text(); 110 | } 111 | QString GrepDlg::extentions() const 112 | { 113 | return ui.extensions->lineEdit()->text(); 114 | } 115 | QString GrepDlg::dir() const 116 | { 117 | return ui.dir->lineEdit()->text(); 118 | } 119 | QString GrepDlg::exclude() const 120 | { 121 | return ui.exclude->text(); 122 | } 123 | bool GrepDlg::ignoreCase() const 124 | { 125 | return ui.ignoreCase->isChecked(); 126 | } 127 | bool GrepDlg::wholeWordOnly() const 128 | { 129 | return ui.wholeWordOnly->isChecked(); 130 | } 131 | bool GrepDlg::regExp() const 132 | { 133 | return ui.regExp->isChecked(); 134 | } 135 | bool GrepDlg::grepSubDir() const 136 | { 137 | return ui.grepSubDir->isChecked(); 138 | } 139 | bool GrepDlg::grepView() const 140 | { 141 | return ui.grepView->isChecked(); 142 | } 143 | void GrepDlg::setFindString(const QString &txt) 144 | { 145 | ui.findString->lineEdit()->setText(txt); 146 | } 147 | void GrepDlg::regexpHelp() 148 | { 149 | QString url = "http://vivi.dyndns.org/sse/regexp.html?from=" + QString(VERSION_STR); 150 | QDesktopServices::openUrl(QUrl(url)); 151 | } 152 | void GrepDlg::keyPressEvent(QKeyEvent *event) 153 | { 154 | QDialog::keyPressEvent(event); 155 | } 156 | -------------------------------------------------------------------------------- /vivi/testBufferQt/testBufferQt.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | x64 7 | 8 | 9 | Release 10 | x64 11 | 12 | 13 | 14 | {B50E36B3-57EC-4D22-B5AB-21C5E6ED6456} 15 | QtVS_v302 16 | 10.0 17 | $(MSBuildProjectDirectory)\QtMsBuild 18 | 19 | 20 | 21 | Application 22 | v142 23 | 24 | 25 | Application 26 | v142 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | msvc2017_64 46 | core 47 | 48 | 49 | msvc2017_64 50 | core 51 | 52 | 53 | 54 | 55 | 56 | 57 | true 58 | Disabled 59 | ProgramDatabase 60 | MultiThreadedDebugDLL 61 | true 62 | 63 | 64 | Console 65 | $(OutDir)\$(ProjectName).exe 66 | true 67 | 68 | 69 | 70 | 71 | true 72 | 73 | MultiThreadedDLL 74 | true 75 | 76 | 77 | Console 78 | $(OutDir)\$(ProjectName).exe 79 | false 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | -------------------------------------------------------------------------------- /vivi/TestBuffer/TestBuffer.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | x64 7 | 8 | 9 | Release 10 | x64 11 | 12 | 13 | 14 | {43F913F6-9F36-43A2-9885-72EEEB34279A} 15 | QtVS_v302 16 | 10.0 17 | $(MSBuildProjectDirectory)\QtMsBuild 18 | 19 | 20 | 21 | Application 22 | v142 23 | 24 | 25 | Application 26 | v142 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | msvc2017_64 46 | core 47 | 48 | 49 | msvc2017_64 50 | core 51 | 52 | 53 | 54 | 55 | 56 | 57 | true 58 | Disabled 59 | ProgramDatabase 60 | MultiThreadedDebugDLL 61 | true 62 | 63 | 64 | Console 65 | $(OutDir)\$(ProjectName).exe 66 | true 67 | 68 | 69 | 70 | 71 | true 72 | 73 | MultiThreadedDLL 74 | true 75 | 76 | 77 | Console 78 | $(OutDir)\$(ProjectName).exe 79 | false 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | -------------------------------------------------------------------------------- /vivi/vivi64/NamedColorDlg.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (C) 2012 by Nobuhide Tsuda 4 | 5 | */ 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include "NamedColorDlg.h" 13 | 14 | typedef const char cchar; 15 | 16 | struct SColorTable { 17 | uint m_color; 18 | cchar *m_name; 19 | }; 20 | 21 | static SColorTable colorTable[] = { 22 | {0xfff8f0, "aliceblue"}, {0xd7ebfa, "antiquewhite"}, {0xffff00, "aqua"}, {0xd4ff7f, "aquamarine"}, 23 | {0xfffff0, "azure"}, {0xdcf5f5, "beige"}, {0xc4e4ff, "bisque"}, {0x000000, "black"}, 24 | {0xcdebff, "blanchedalmond"}, {0xff0000, "blue"}, {0xe22b8a, "blueviolet"}, {0x2a2aa5, "brown"}, 25 | {0x87b8de, "burlywood"}, {0xa09e5f, "cadetblue"}, {0x00ff7f, "chartreuse"}, {0x1e69d2, "chocolate"}, 26 | {0x507fff, "coral"}, {0xed9564, "cornflowerblue"}, {0xdcf8ff, "cornsilk"}, {0x3c14dc, "crimson"}, 27 | {0xffff00, "cyan"}, {0x8b0000, "darkblue"}, {0x8b8b00, "darkcyan"}, {0x0b86b8, "darkgoldenrod"}, 28 | {0xa9a9a9, "darkgray"}, {0x006400, "darkgreen"}, {0x6bb7bd, "darkkhaki"}, {0x8b008b, "darkmagenta"}, 29 | {0x2f6b55, "darkolivegreen"}, {0x008cff, "darkorange"}, {0xcc3299, "darkorchid"}, {0x00008b, "darkred"}, 30 | {0x7a96e9, "darksalmon"}, {0x8fbc8f, "darkseagreen"}, {0x8b3d48, "darkslateblue"}, {0x4f4f2f, "darkslategray"}, 31 | {0xd1ce00, "darkturquoise"}, {0xd30094, "darkviolet"}, {0x9314ff, "deeppink"}, {0xffbf00, "deepskyblue"}, 32 | {0x696969, "dimgray"}, {0xff901e, "dodgerblue"}, {0x2222b2, "firebrick"}, {0xf0faff, "floralwhite"}, 33 | {0x228b22, "forestgreen"}, {0xff00ff, "fuchsia"}, {0xdcdcdc, "gainsboro"}, {0xfff8f8, "ghostwhite"}, 34 | {0x00d7ff, "gold"}, {0x20a5da, "goldenrod"}, {0x808080, "gray"}, {0x008000, "green"}, 35 | {0x2fffad, "greenyellow"}, {0xf0fff0, "honeydew"}, {0xb469ff, "hotpink"}, {0x5c5ccd, "indianred"}, 36 | {0x82004b, "indigo"}, {0xf0ffff, "ivory"}, {0x8ce6f0, "khaki"}, {0xfae6e6, "lavender"}, 37 | {0xf5f0ff, "lavenderblush"}, {0x00fc7c, "lawngreen"}, {0xcdfaff, "lemonchiffon"}, {0xe6d8ad, "lightblue"}, 38 | {0x8080f0, "lightcoral"}, {0xffffe0, "lightcyan"}, {0xd2fafa, "lightgoldenrodyellow"}, {0x90ee90, "lightgreen"}, 39 | {0xd3d3d3, "lightgrey"}, {0xc1b6ff, "lightpink"}, {0x7aa0ff, "lightsalmon"}, {0xaab220, "lightseagreen"}, 40 | {0xface87, "lightskyblue"}, {0x998877, "lightslategray"}, {0xdec4b0, "lightsteelblue"}, {0xe0ffff, "lightyellow"}, 41 | {0x00ff00, "lime"}, {0x32cd32, "limegreen"}, {0xe6f0fa, "linen"}, {0xff00ff, "magenta"}, 42 | {0x000080, "maroon"}, {0xaacd66, "mediumaquamarine"}, {0xcd0000, "mediumblue"}, {0xd355ba, "mediumorchid"}, 43 | {0xdb7093, "mediumpurple"}, {0x71b33c, "mediumseagreen"}, {0xee687b, "mediumslateblue"}, {0x9afa00, "mediumspringgreen"}, 44 | {0xccd148, "mediumturquoise"}, {0x8515c7, "mediumvioletred"}, {0x701919, "midnightblue"}, {0xfafff5, "mintcream"}, 45 | {0xe1e4ff, "mistyrose"}, {0xb5e4ff, "moccasin"}, {0xaddeff, "navajowhite"}, {0x800000, "navy"}, 46 | {0xe6f5fd, "oldlace"}, {0x008080, "olive"}, {0x238e6b, "olivedrab"}, {0x00a5ff, "orange"}, 47 | {0x0045ff, "orangered"}, {0xd670da, "orchid"}, {0xaae8ee, "palegoldenrod"}, {0x98fb98, "palegreen"}, 48 | {0xeeeeaf, "paleturquoise"}, {0x9370db, "palevioletred"}, {0xd5efff, "papayawhip"}, {0xb9daff, "peachpuff"}, 49 | {0x3f85cd, "peru"}, {0xcbc0ff, "pink"}, {0xdda0dd, "plum"}, {0xe6e0b0, "powderblue"}, 50 | {0x800080, "purple"}, {0x0000ff, "red"}, {0x8f8fbc, "rosybrown"}, {0xe16941, "royalblue"}, 51 | {0x13458b, "saddlebrown"}, {0x7280fa, "salmon"}, {0x60a4f4, "sandybrown"}, {0x578b2e, "seagreen"}, 52 | {0xeef5ff, "seashell"}, {0x2d52a0, "sienna"}, {0xc0c0c0, "silver"}, {0xebce87, "skyblue"}, 53 | {0xcd5a6a, "slateblue"}, {0x908070, "slategray"}, {0xfafaff, "snow"}, {0x7fff00, "springgreen"}, 54 | {0xb48246, "steelblue"}, {0x8cb4d2, "tan"}, {0x808000, "teal"}, {0xd8bfd8, "thistle"}, 55 | {0x4763ff, "tomato"}, {0xd0e040, "turquoise"}, {0xee82ee, "violet"}, {0xb3def5, "wheat"}, 56 | {0xffffff, "white"}, {0xf5f5f5, "whitesmoke"}, {0x00ffff, "yellow"}, {0x32cd9a, "yellowgreen"}, 57 | #if 0 58 | {0x01000000, "sysColor0"}, {0x01000001, "sysColor1"}, {0x01000002, "sysColor2"}, {0x01000003, "sysColor3"}, 59 | {0x01000004, "sysColor4"}, {0x01000005, "sysColor5"}, {0x01000006, "sysColor6"}, {0x01000007, "sysColor7"}, 60 | {0x01000008, "sysColor8"}, {0x01000009, "sysColor9"}, {0x0100000a, "sysColor10"}, {0x0100000b, "sysColor11"}, 61 | {0x0100000c, "sysColor12"}, {0x0100000d, "sysColor13"}, {0x0100000e, "sysColor14"}, {0x0100000f, "sysColor15"}, 62 | {0x01000010, "sysColor16"}, {0x01000011, "sysColor17"}, {0x01000012, "sysColor18"}, {0x01000013, "sysColor19"}, 63 | #endif 64 | {0, 0} 65 | }; 66 | 67 | NamedColorDlg::NamedColorDlg(QWidget *parent) 68 | : QDialog(parent) 69 | { 70 | QVBoxLayout *layout = new QVBoxLayout; 71 | QPushButton *okButton = new QPushButton(tr("OK")); 72 | okButton->setDefault(true); 73 | connect(okButton, SIGNAL(clicked()), this, SLOT(accept())); 74 | QHBoxLayout *hLayout = new QHBoxLayout; 75 | hLayout->addStretch(); 76 | hLayout->addWidget(okButton); 77 | m_lineEdit = new QLineEdit; 78 | connect(m_lineEdit, SIGNAL(textChanged(const QString &)), this, SLOT(setupColorList())); 79 | m_listWidget = new QListWidget; 80 | setupColorList(); 81 | connect(m_listWidget, SIGNAL(itemDoubleClicked ( QListWidgetItem *)), 82 | this, SLOT(itemDoubleClicked ( QListWidgetItem *))); 83 | layout->addWidget(m_lineEdit); 84 | layout->addWidget(m_listWidget); 85 | layout->addLayout(hLayout); 86 | setLayout(layout); 87 | } 88 | 89 | NamedColorDlg::~NamedColorDlg() 90 | { 91 | 92 | } 93 | 94 | void NamedColorDlg::accept() 95 | { 96 | QListWidgetItem *item = m_listWidget->currentItem(); 97 | if( item == 0 ) { 98 | qDebug() << "???\n"; 99 | return; 100 | } 101 | m_colorName = item->text(); 102 | QDialog::accept(); 103 | } 104 | 105 | void NamedColorDlg::itemDoubleClicked ( QListWidgetItem * item ) 106 | { 107 | m_colorName = item->text(); 108 | QDialog::accept(); 109 | } 110 | 111 | QIcon createColorIcon(int color) 112 | { 113 | QPixmap pixmap(20, 20); 114 | QPainter painter(&pixmap); 115 | painter.setPen(Qt::NoPen); 116 | const int r = color & 0xff; 117 | const int g = (color>>8) & 0xff; 118 | const int b = (color>>16) & 0xff; 119 | painter.fillRect(QRect(0, 0, 20, 20), QColor(r, g, b)); 120 | return QIcon(pixmap); 121 | } 122 | void NamedColorDlg::setupColorList() 123 | { 124 | for(int ix = m_listWidget->count() - 1; ix >= 0; --ix) { 125 | QListWidgetItem *ptr = m_listWidget->takeItem(ix); 126 | delete ptr; 127 | } 128 | QString fillter = m_lineEdit->text(); 129 | QListWidgetItem *curItem = 0; 130 | for(SColorTable *ptr = colorTable; ptr->m_name != 0; ++ptr) { 131 | if( fillter.isEmpty() || QString(ptr->m_name).startsWith(fillter) ) { 132 | QListWidgetItem *item = new QListWidgetItem(createColorIcon(ptr->m_color), ptr->m_name, m_listWidget); 133 | if( curItem == 0 ) 134 | m_listWidget->setCurrentItem(curItem = item); 135 | } 136 | } 137 | } 138 | 139 | --------------------------------------------------------------------------------