From 33c9b5635d93f1edfea6228155ca80fcd077eff2 Mon Sep 17 00:00:00 2001 From: adonais Date: Wed, 25 Oct 2023 09:41:38 +0800 Subject: [PATCH] Release 4.0.7 version --- conf/conf.d/cfg.lua | 16 + conf/conf.d/eu_conf.lua | 8 +- conf/conf.d/eu_core.lua | 15 +- conf/conf.d/eu_docs.lua | 66 ++- conf/conf.d/eu_theme.lua | 2 +- conf/conf.d/ini.lua | 26 ++ conf/conf.d/inno.lua | 111 +++++ conf/conf.d/log.lua | 18 + conf/conf.d/nsis.lua | 112 ++++++ conf/conf.d/text.lua | 31 ++ locales/src/en-us.rc | 111 ++++- locales/src/zh-cn.rc | 111 ++++- share/changelog | 9 + src/3rdparty/luajit/src/jit/bcsave.lua | 4 +- src/3rdparty/luajit/src/lj_carith.c | 4 + src/3rdparty/luajit/src/lj_ctype.h | 6 +- src/3rdparty/scintilla/src/src/CallTip.cxx | 31 +- src/3rdparty/scintilla/src/src/Document.cxx | 9 + src/3rdparty/scintilla/src/src/EditView.cxx | 20 +- src/3rdparty/scintilla/src/src/Geometry.h | 35 +- src/3rdparty/scintilla/src/src/Indicator.h | 4 +- src/3rdparty/scintilla/src/src/LineMarker.h | 4 +- src/3rdparty/scintilla/src/src/MarginView.cxx | 2 +- src/3rdparty/scintilla/src/src/RESearch.cxx | 7 +- src/3rdparty/scintilla/src/src/RESearch.h | 7 +- .../scintilla/src/src/ScintillaBase.h | 4 + src/3rdparty/scintilla/src/src/Style.cxx | 4 +- src/3rdparty/scintilla/src/src/ViewStyle.cxx | 9 +- src/3rdparty/scintilla/src/src/XPM.cxx | 2 +- .../scintilla/src/win32/ScintillaWin.cxx | 8 +- src/eu_api.c | 34 +- src/eu_api.h | 3 +- src/eu_doctype.c | 92 ++++- src/eu_doctype.h | 18 +- src/eu_edit.c | 33 ++ src/eu_menu.c | 20 +- src/eu_menu.h | 2 +- src/eu_proc.c | 380 +++++++++--------- src/eu_proc.h | 11 +- src/eu_scintilla.c | 4 +- src/eu_search.c | 21 +- src/eu_statusbar.c | 92 +++-- src/eu_theme.c | 17 +- src/eu_updatechecker.c | 2 +- src/eu_util.c | 29 ++ src/eu_util.h | 1 + src/targetver.h | 34 +- src/version_display.txt | 2 +- 48 files changed, 1236 insertions(+), 355 deletions(-) create mode 100644 conf/conf.d/inno.lua create mode 100644 conf/conf.d/nsis.lua create mode 100644 conf/conf.d/text.lua diff --git a/conf/conf.d/cfg.lua b/conf/conf.d/cfg.lua index 8fbb15c0..1a6bdf4e 100644 --- a/conf/conf.d/cfg.lua +++ b/conf/conf.d/cfg.lua @@ -7,6 +7,14 @@ function cfg.get_comments() return line_t, block_t end +function cfg.get_fonts() + local fonts0_set = "Fira Code" + local fonts1_set = "Microsoft YaHei UI" + local fonts2_set = "Microsoft YaHei" + local fonts_size = 0 + return fonts0_set,fonts1_set,fonts2_set,fonts_size +end + function cfg.create_bakup(path) local cfg_code = { "user_cfg = {}\n", @@ -18,6 +26,14 @@ function cfg.create_bakup(path) " return line_t, block_t\n", "end\n", "\n", + "function user_cfg.get_fonts()\n", + " local fonts0_set = \"Fira Code\"\n", + " local fonts1_set = \"Microsoft YaHei UI\"\n", + " local fonts2_set = \"Microsoft YaHei\"\n", + " local fonts_size = 0\n", + " return fonts0_set,fonts1_set,fonts2_set,fonts_size\n", + "end\n", + "\n", "return user_cfg", } local shell_code = table.concat(cfg_code) diff --git a/conf/conf.d/eu_conf.lua b/conf/conf.d/eu_conf.lua index 7fef957f..6551c7f6 100644 --- a/conf/conf.d/eu_conf.lua +++ b/conf/conf.d/eu_conf.lua @@ -24,8 +24,14 @@ function eu_conf.fill_customize(s) if (eu_core.table_is_empty(process_customized)) then process_customized[1] = {['hide'] = false, ['name'] = "44500", ['path'] = "conf/conf.d/eu_evaluation.lua", ['param'] = "%CURRENT_SELSTR% %NUM_SELSTR%", ['micon'] = 44305, ['posid'] = 0, ['hbmp'] = 0} - process_customized[2] = {['hide'] = false, ['name'] = "44501", ['path'] = "%windir%/system32/win32calc.exe", + process_customized[2] = {['hide'] = false, ['name'] = "44501", ['path'] = "", ['param'] = "", ['micon'] = 0, ['posid'] = 0, ['hbmp'] = 0} + local ver = eu_core.euapi.eu_win10_or_later() + if (ver ~= 0xFFFFFFFF) then + process_customized[2].path = "%windir%/system32/win32calc.exe" + else + process_customized[2].path = "%windir%/system32/calc.exe" + end end for i=0,msize-1 do if process_customized[i+1] ~= nil then diff --git a/conf/conf.d/eu_core.lua b/conf/conf.d/eu_core.lua index 68d93af8..00c39fdf 100644 --- a/conf/conf.d/eu_core.lua +++ b/conf/conf.d/eu_core.lua @@ -279,6 +279,14 @@ typedef struct _doc_comments bool initialized; } doc_comments; +typedef struct _doc_fonts +{ + const char *font0; + const char *font1; + const char *font2; + int size; +} doc_fonts; + typedef struct _snippet_t { intptr_t start; @@ -320,6 +328,7 @@ typedef struct _doc_data eutype_t ctshow_tree; // 函数提示hash表 doc_styles style; // 文档关键字类型与高亮颜色 doc_comments comment; // 文档注释 + doc_fonts font_list; // 文档字体 } doctype_t; // for tinyexpr @@ -347,7 +356,7 @@ void eu_lua_calltip(const char *pstr); // 获取配置文件指针 bool eu_config_ptr(struct eu_config *pconfig); -bool eu_theme_ptr(struct eu_theme *ptheme, bool init); +bool eu_theme_ptr(struct eu_theme *ptheme); bool eu_accel_ptr(ACCEL *paccel); bool eu_toolbar_ptr(eue_toolbar *pdata, int num); bool eu_exist_path(const char *path); @@ -417,6 +426,7 @@ int on_doc_json_like(void *pnode, void *lpnotify); int on_doc_makefile_like(void *pnode, void *lpnotify); int on_doc_cmake_like(void *pnode, void *lpnotify); int on_doc_text_like(void *pnode, void *lpnotify); +int on_doc_general_like(void *pnode, void *lpnotify); /* 默认的 reload_list_ptr,reload_tree_ptr 回调函数入口 */ int on_doc_reload_list_reqular(void *pnode); @@ -460,6 +470,9 @@ void eu_reset_accs_mask(void); void eu_reset_snip_mask(void); void eu_reset_theme_mask(void); +/* 获取系统版本 */ +const uint32_t eu_win10_or_later(void); + ]] function eu_core.process_path() diff --git a/conf/conf.d/eu_docs.lua b/conf/conf.d/eu_docs.lua index 8f3f48de..a106d748 100644 --- a/conf/conf.d/eu_docs.lua +++ b/conf/conf.d/eu_docs.lua @@ -62,6 +62,8 @@ if (not eu_core.file_exists(user_file)) then " DOCTYPE_VERILOG = 41,\n", " DOCTYPE_PASCAL = 42,\n", " DOCTYPE_TCL = 43,\n", + " DOCTYPE_INNO = 44,\n", + " DOCTYPE_NSIS = 45,\n", " }\n", " local ffi_null = eu_core.ffi.cast(\"void *\", nil)\n", " local docs_t = eu_core.ffi.new (\"doctype_t[?]\", i,\n", @@ -219,7 +221,7 @@ if (not eu_core.file_exists(user_file)) then " ffi_null,\n", " ffi_null,\n", " ffi_null,\n", - " ffi_null,\n", + " eu_core.euapi.on_doc_general_like,\n", " ffi_null,\n", " ffi_null,\n", " ffi_null,\n", @@ -259,7 +261,7 @@ if (not eu_core.file_exists(user_file)) then " ffi_null,\n", " ffi_null,\n", " eu_core.euapi.on_doc_keyup_general,\n", - " eu_core.euapi.on_doc_identation,\n", + " eu_core.euapi.on_doc_general_like,\n", " ffi_null,\n", " ffi_null,\n", " ffi_null,\n", @@ -339,8 +341,28 @@ if (not eu_core.file_exists(user_file)) then " ffi_null,\n", " ffi_null,\n", " ffi_null,\n", + " eu_core.euapi.on_doc_general_like,\n", + " ffi_null,\n", + " ffi_null,\n", + " ffi_null,\n", " ffi_null,\n", " ffi_null,\n", + " },\n", + " {\n", + " e.DOCTYPE_INNO,\n", + " \"inno\",\n", + " \";*.iss;*.isl;*.islu;\",\n", + " \"Inno Setup\",\n", + " \"inno.snippets\",\n", + " 0,\n", + " -1,\n", + " ffi_null,\n", + " ffi_null,\n", + " ffi_null,\n", + " ffi_null,\n", + " eu_core.euapi.on_doc_keyup_general,\n", + " eu_core.euapi.on_doc_general_like,\n", + " ffi_null,\n", " ffi_null,\n", " ffi_null,\n", " ffi_null,\n", @@ -499,7 +521,7 @@ if (not eu_core.file_exists(user_file)) then " ffi_null,\n", " ffi_null,\n", " ffi_null,\n", - " eu_core.euapi.on_doc_identation,\n", + " eu_core.euapi.on_doc_general_like,\n", " ffi_null,\n", " ffi_null,\n", " ffi_null,\n", @@ -607,6 +629,26 @@ if (not eu_core.file_exists(user_file)) then " ffi_null,\n", " },\n", " {\n", + " e.DOCTYPE_NSIS,\n", + " \"nsis\",\n", + " \";*.nsi;*.nsh;*.nlf;\",\n", + " \"Nsis Setup\",\n", + " \"nsis.snippets\",\n", + " 0,\n", + " -1,\n", + " ffi_null,\n", + " ffi_null,\n", + " ffi_null,\n", + " ffi_null,\n", + " eu_core.euapi.on_doc_keyup_general,\n", + " eu_core.euapi.on_doc_general_like,\n", + " ffi_null,\n", + " ffi_null,\n", + " ffi_null,\n", + " ffi_null,\n", + " ffi_null,\n", + " },\n", + " {\n", " e.DOCTYPE_PASCAL,\n", " \"pascal\",\n", " \";*.pas;*.inc;*.dpr;*.dpk;*.dfm;*.pp;*.lfm;*.lpr;*.fpd;\",\n", @@ -808,7 +850,7 @@ if (not eu_core.file_exists(user_file)) then " },\n", " {\n", " e.DOCTYPE_TXT,\n", - " ffi_null,\n", + " \"text\",\n", " \";*.txt;\",\n", " \"Text\",\n", " \"text.snippets\",\n", @@ -885,7 +927,7 @@ if (not eu_core.file_exists(user_file)) then " ffi_null,\n", " ffi_null,\n", " ffi_null,\n", - " },\n", + " },\n", " {\n", " e.DOCTYPE_XML,\n", " \"xml\",\n", @@ -962,6 +1004,7 @@ function fetch_doctype(s) local m_config = eu_core.ffi.cast('doctype_t *', s) local m_req = nil local m_key0,m_key1,m_key2,m_key3,m_key4,m_key5 + local m_ftz,m_font0,m_font1,m_font2 local m_set = nil local m_styles = nil local m_line_comment = nil @@ -1047,7 +1090,7 @@ function fetch_doctype(s) end end local count = 0; - if (m_req.get_styles ~= ni) then + if (m_req.get_styles ~= nil) then m_styles = m_req.get_styles() if (m_styles ~= nil) then for k, v in pairs(m_styles) do @@ -1081,7 +1124,7 @@ function fetch_doctype(s) end end end - if (m_req.get_comments ~= ni) then + if (m_req.get_comments ~= nil) then m_line_comment,m_block_comment = m_req.get_comments() if (m_line_comment ~= nil and m_block_comment ~= nil) then m_config.comment.initialized = true @@ -1089,6 +1132,13 @@ function fetch_doctype(s) m_config.comment.block = eu_core.ffi.cast("const char *", m_block_comment) end end + if (m_req.get_fonts ~= nil) then + m_font0,m_font1,m_font2, m_ftz = m_req.get_fonts() + if (m_font0 ~= nil) then m_config.font_list.font0 = eu_core.ffi.cast("const char *", m_font0) end + if (m_font1 ~= nil) then m_config.font_list.font1 = eu_core.ffi.cast("const char *", m_font1) end + if (m_font2 ~= nil) then m_config.font_list.font2 = eu_core.ffi.cast("const char *", m_font2) end + if (m_ftz ~= nil) then m_config.font_list.size = eu_core.ffi.cast("int", m_ftz) end + end end end @@ -1096,7 +1146,7 @@ function fill_my_docs() local my_doc_config = user_docs.get_docs() local my_size = eu_core.ffi.sizeof(my_doc_config)/eu_core.ffi.sizeof("doctype_t") --print("my_size = " .. my_size) - if (my_size < 44) then + if (my_size < 46) then eu_core.euapi.eu_reset_docs_mask() end for i=0,my_size-1 do diff --git a/conf/conf.d/eu_theme.lua b/conf/conf.d/eu_theme.lua index c89dd59b..9f4aa47b 100644 --- a/conf/conf.d/eu_theme.lua +++ b/conf/conf.d/eu_theme.lua @@ -592,7 +592,7 @@ function eu_theme.load_default(name) {dochistory_font,dochistory_fontsize,dochistory_color,dochistory_bgcolor,dochistory_bold} } }) - return eu_core.euapi.eu_theme_ptr(m_theme, true) + return eu_core.euapi.eu_theme_ptr(m_theme) end return eu_theme diff --git a/conf/conf.d/ini.lua b/conf/conf.d/ini.lua index 94db27bd..732c88ce 100644 --- a/conf/conf.d/ini.lua +++ b/conf/conf.d/ini.lua @@ -7,6 +7,19 @@ function ini.get_comments() return line_t, block_t end +function ini.get_fonts() + local fonts0_set = "Fira Code" + local fonts1_set = "Microsoft YaHei UI" + local fonts2_set = "Microsoft YaHei" + local fonts_size = 0 + return fonts0_set,fonts1_set,fonts2_set,fonts_size +end + +function ini.get_reqular() + local symbol_reqular_exp = "^\\[(.+)\\][\\s\\r\\n]*" + return symbol_reqular_exp +end + function ini.create_bakup(path) local ini_code = { "user_ini = {}\n", @@ -17,6 +30,19 @@ function ini.create_bakup(path) " return line_t, block_t\n", "end\n", "\n", + "function user_ini.get_fonts()\n", + " local fonts0_set = \"Fira Code\"\n", + " local fonts1_set = \"Microsoft YaHei UI\"\n", + " local fonts2_set = \"Microsoft YaHei\"\n", + " local fonts_size = 0\n", + " return fonts0_set,fonts1_set,fonts2_set,fonts_size\n", + "end\n", + "\n", + "function user_ini.get_reqular()\n", + " local symbol_reqular_exp = \"^\\\\[(.+)\\\\][\\\\s\\\\r\\\\n]*\"\n", + " return symbol_reqular_exp\n", + "end\n", + "\n", "return user_ini", } local shell_code = table.concat(ini_code) diff --git a/conf/conf.d/inno.lua b/conf/conf.d/inno.lua new file mode 100644 index 00000000..bf440935 --- /dev/null +++ b/conf/conf.d/inno.lua @@ -0,0 +1,111 @@ +inno = {} + +require("eu_sci") +require("eu_core") + +function inno.init_after_callback(p) + local pnode = eu_core.ffi.cast("void *", p) + local res = eu_core.euapi.on_doc_init_after_scilexer(pnode, "inno") -- enable inno lex + if (res == 0) then + eu_core.euapi.on_doc_enable_foldline(pnode) -- enable fold line + end + return res +end + +function inno.get_styles() + local style_t = { + [SCE_INNO_COMMENT] = 0xC0C0C0, + [SCE_INNO_COMMENT_PASCAL] = 0xC0C0C0, + -- 区段关键字加上粗体 + [SCE_INNO_SECTION] = 0x00B050 + SCE_BOLD_FONT, + [SCE_INNO_KEYWORD] = 0x00B050, + [SCE_INNO_KEYWORD_USER] = 0x00B050, + [SCE_INNO_PREPROC] = 0x00B050, + [SCE_INNO_KEYWORD_PASCAL] = 0xBBBB00 + SCE_BOLD_FONT, + [SCE_INNO_STRING_DOUBLE] = 0xC080FF, + [SCE_INNO_STRING_SINGLE] = 0xC080FF, + } + return style_t +end + +function inno.get_keywords() + local keywords0_set = "setup code components custommessages dirs files ini icons installdelete langoptions languages messages registry run setuptasks types uninstalldelete uninstallrun" + local keywords1_set = "aslrcompatible additionalicons addonhostprogramnotfound allowcancelduringinstall allownetworkdrive allownoicons allowrootdirectory allowuncpath alwaysrestart alwaysshowcomponentslist alwaysshowdironreadypage alwaysshowgrouponreadypage alwaysusepersonalgroup appcomments appcontact appcopyright appid appmodifypath appmutex appname apppublisher apppublisherurl appreadmefile appsupportphone appsupporturl appupdatesurl appusermodelid appusermodeltoastactivatorclsid appvername appversion appenddefaultdirname appenddefaultgroupname architecturesallowed architecturesinstallin64bitmode assocfileextension associngfileextension attribs autostartprogram autostartprogramgroupdescription backcolor backcolor2 backcolordirection backsolid beveledlabel changesassociations changesenvironment check closeapplications closeapplicationsfilter comment components compression compressionthreads copymode copyrightfontname copyrightfontsize createappdir createdesktopicon createquicklaunchicon createuninstallregkey depcompatible defaultdialogfontname defaultdirname defaultgroupname defaultuserinfoname defaultuserinfoorg defaultuserinfoserial description destdir destname dialogfontname dialogfontsize direxistswarning disabledirpage disablefinishedpage disableprogramgrouppage disablereadymemo disablereadypage disablestartupprompt disablewelcomepage diskclustersize diskslicesize diskspanning enabledirdoesntexistwarning encryption excludes externalsize extradiskspacerequired filename flags flatcomponentslist fontinstall groupdescription helptextnote hotkey iconfilename iconindex infoafterfile infobeforefile internalcompresslevel key lzmaalgorithm lzmablocksize lzmadictionarysize lzmamatchfinder lzmanumblockthreads lzmanumfastbytes lzmauseseparateprocess languagecodepage languagedetectionmethod languageid languagename languages launchprogram licensefile mergeduplicatefiles messagesfile minversion missingmessageswarning missingrunonceidswarning name nameandversion notrecognizedmessageswarning onlybelowversion output outputbasefilename outputdir outputmanifestfile parameters password permissions privilegesrequired privilegesrequiredoverridesallowed programontheweb reservebytes restartapplications restartifneededbyrun righttoleft root runonceid section setupiconfile setuplogging setupmutex showcomponentsizes showlanguagedialog showtaskstreelines signtool signtoolminimumtimebetween signtoolretrycount signtoolretrydelay signtoolrunminimized signeduninstaller signeduninstallerdir slicesperdisk solidcompression source sourcedir statusmsg string strongassemblyname subkey terminalservicesaware timestamprounding timestampsinutc titlefontname titlefontsize touchdate touchtime type types uninstalldisplayicon uninstalldisplayname uninstalldisplaysize uninstallfilesdir uninstalllogmode uninstallprogram uninstallrestartcomputer uninstallable updateuninstalllogappname usepreviousappdir usepreviousgroup usepreviouslanguage usepreviousprivigeles useprevioussetuptype useprevioustasks useprevioususerinfo usesetupldr useduserareaswarning userinfopage valuedata valuename verb versioninfocompany versioninfocopyright versioninfodescription versioninfooriginalfilename versioninfoproductname versioninfoproducttextversion versioninfoproductversion versioninfotextversion versioninfoversion welcomefontname welcomefontsize windowresizable windowshowcaption windowstartmaximized windowvisible wizardimagealphaformat wizardimagefile wizardimagestretch wizardresizable wizardsizepercent wizardsmallimagefile wizardstyle workingdir" + local keywords2_set = "app autoappdata autocf autocf32 autocf64 autodesktop autodocs autofonts autopf autopf32 autopf64 autoprograms autostartmenu autostartup autotemplates cf cf32 cf64 cm cmd code commonappdata commoncf commoncf32 commoncf64 commondesktop commondocs commonfonts commonpf commonpf32 commonpf64 commonprograms commonstartmenu commonstartup commontemplates computername dao dotnet40 dotnet4032 dotnet4064 drive fonts group groupname hwnd ini language localappdata log param pf pf32 pf64 reg sd sendto src srcexe sys sysnative sysuserinfoname sysuserinfoorg syswow64 tmp uninstallexe userappdata usercf userdesktop userdocs userfavorites userfonts userinfoname userinfoorg userinfoserial username userpf userprograms usersavedgames usersendto userstartmenu userstartup usertemplates win wizardhwnd and not or private protected public append define dim elif else emit endif endsub error expr file for if ifdef ifexist ifndef ifnexist include insert pragma preproc redim sub undef any func int str void" + local keywords3_set = "__COUNTER__ __FILE__ __INCLUDE__ __LINE__ __OPT_X__ __WIN32__ COMPANY_NAME CompilerPath faAnyFile faArchive faDirectory faHidden False faReadOnly faSymLink faSysFile faVolumeID FILE_DESCRIPTION FILE_VERSION FIND_AND FIND_BEGINS FIND_CASESENSITIVE FIND_CONTAINS FIND_ENDS FIND_MATCH FIND_NOT FIND_OR FIND_SENSITIVE FIND_TRIM HKCC HKCC64 HKCR HKCR64 HKCU HKCU64 HKEY_CLASSES_ROOT HKEY_CLASSES_ROOT_64 HKEY_CURRENT_CONFIG HKEY_CURRENT_CONFIG_64 HKEY_CURRENT_USER HKEY_CURRENT_USER_64 HKEY_LOCAL_MACHINE HKEY_LOCAL_MACHINE_64 HKEY_USERS HKEY_USERS_64 HKLM HKLM64 HKU HKU64 INTERNAL_NAME ISPP_INVOKED ISPPCC_INVOKED LEGAL_COPYRIGHT MaxInt MinInt NewLine No NULL ORIGINAL_FILENAME PREPROCVER PRODUCT_NAME PRODUCT_VERSION SourcePath SW_HIDE SW_MAX SW_MAXIMIZE SW_MINIMIZE SW_NORMAL SW_RESTORE SW_SHOW SW_SHOWDEFAULT SW_SHOWMAXIMIZED SW_SHOWMINIMIZED SW_SHOWMINNOACTIVE SW_SHOWNA SW_SHOWNOACTIVATE SW_SHOWNORMAL Tab True TYPE_ARRAY TYPE_ERROR TYPE_FUNC TYPE_INTEGER TYPE_MACRO TYPE_NULL TYPE_STRING UNICODE Ver WINDOWS Yes" + local keywords4_set = "and begin break case class const constructor continue do downto else end event except external finally for function if interface not of or procedure property read record repeat then to try type until uses var while with write msgbox" + local keywords5_set = "AnsiString Boolean Byte Char Directory HBITMAP IDispatch Int64 Integer IUnknown Longint String TAlign TAlignment TAlphaFormat TAnchorKind TAnchors TBevel TBevelKind TBevelShape TBevelStyle TBevelWidth TBitmap TBitmapImage TBorderIcon TBorderIcons TBorderStyle TBorderWidth TBrush TBrushStyle TButton TButtonControl TCanvas TCheckBox TCheckBoxState TCheckItemOperation TCloseAction TCloseEvent TCloseQueryEvent TColor TComboBox TComboBoxStyle TComponent TConstraintSize TControl TCustomCheckBox TCustomComboBox TCustomControl TCustomEdit TCustomFolderTreeView TCustomLabel TCustomListBox TCustomMemo TCustomPanel TDownloadWizardPage TDuplicates TEdit TEditCharCase TEShiftState TFileStream TFolderRenameEvent TFolderTreeView TFont TFontStyle TFontStyles TForm TFormBorderStyle TFormStyle TGraphic TGraphicControl TGraphicsObject THandleStream TInputDirWizardPage TInputFileWizardPage TInputOptionWizardPage TInputQueryWizardPage TKeyEvent TKeyPressEvent TLabel TListBox TListBoxStyle TMainForm TMemo TNewButton TNewCheckBox TNewCheckListBox TNewComboBox TNewEdit TNewListBox TNewMemo TNewNotebook TNewNotebookPage TNewProgressBar TNewProgressBarState TNewProgressBarStyle TNewRadioButton TNewStaticText TNotebook TNotifyEvent TObject TOutputMarqueeProgressWizardPage TOutputMsgMemoWizardPage TOutputMsgWizardPage TOutputProgressWizardPage TPanel TPanelBevel TPasswordEdit TPen TPenMode TPenStyle TPersistent TPosition TRadioButton TRichEditViewer TScrollBarInc TScrollBarKind TScrollingWinControl TScrollStyle TSetupForm TSetupStep TShiftState TSizeConstraints TStartMenuFolderTreeView TStream TStringList TStrings TStringStream TUIStateForm TUninstallProgressForm TUninstallStep TWinControl TWizardForm TWizardPage TWizardPageButtonEvent TWizardPageCancelEvent TWizardPageNotifyEvent TWizardPageShouldSkipEvent Word" + return keywords0_set,keywords1_set,keywords2_set,keywords3_set,keywords4_set,keywords5_set +end + +function inno.get_autocomplete() + local autocomplete_set = "Setup Code Components CustomMessages Dirs Files INI Icons InstallDelete LangOptions Languages Messages Registry Run SetupTasks Types UninstallDelete UninstallRun ASLRCompatible AdditionalIcons AddonHostProgramNotFound AllowCancelDuringInstall AllowNetworkDrive AllowNoIcons AllowRootDirectory AllowUNCPath AlwaysRestart AlwaysShowComponentsList AlwaysShowDirOnReadyPage AlwaysShowGroupOnReadyPage AlwaysUsePersonalGroup AppComments AppContact AppCopyright AppId AppModifyPath AppMutex AppName AppPublisher AppPublisherURL AppReadmeFile AppSupportPhone AppSupportURL AppUpdatesURL AppUserModelID AppUserModelToastActivatorCLSID AppVerName AppVersion AppendDefaultDirName AppendDefaultGroupName ArchitecturesAllowed ArchitecturesInstallIn64BitMode AssocFileExtension AssocingFileExtension Attribs AutoStartProgram AutoStartProgramGroupDescription BackColor BackColor2 BackColorDirection BackSolid BeveledLabel ChangesAssociations ChangesEnvironment Check CloseApplications CloseApplicationsFilter Comment Components Compression CompressionThreads CopyMode CopyrightFontName CopyrightFontSize CreateAppDir CreateDesktopIcon CreateQuickLaunchIcon CreateUninstallRegKey DEPCompatible DefaultDialogFontName DefaultDirName DefaultGroupName DefaultUserInfoName DefaultUserInfoOrg DefaultUserInfoSerial Description DestDir DestName DialogFontName DialogFontSize DirExistsWarning DisableDirPage DisableFinishedPage DisableProgramGroupPage DisableReadyMemo DisableReadyPage DisableStartupPrompt DisableWelcomePage DiskClusterSize DiskSliceSize DiskSpanning EnableDirDoesntExistWarning Encryption Excludes ExternalSize ExtraDiskSpaceRequired Filename Flags FlatComponentsList FontInstall GroupDescription HelpTextNote HotKey IconFilename IconIndex InfoAfterFile InfoBeforeFile InternalCompressLevel Key LZMAAlgorithm LZMABlockSize LZMADictionarySize LZMAMatchFinder LZMANumBlockThreads LZMANumFastBytes LZMAUseSeparateProcess LanguageCodePage LanguageDetectionMethod LanguageID LanguageName Languages LaunchProgram LicenseFile MergeDuplicateFiles MessagesFile MinVersion MissingMessagesWarning MissingRunOnceIdsWarning Name NameAndVersion NotRecognizedMessagesWarning OnlyBelowVersion Output OutputBaseFilename OutputDir OutputManifestFile Parameters Password Permissions PrivilegesRequired PrivilegesRequiredOverridesAllowed ProgramOnTheWeb ReserveBytes RestartApplications RestartIfNeededByRun RightToLeft Root RunOnceId Section SetupIconFile SetupLogging SetupMutex ShowComponentSizes ShowLanguageDialog ShowTasksTreeLines SignTool SignToolMinimumTimeBetween SignToolRetryCount SignToolRetryDelay SignToolRunMinimized SignedUninstaller SignedUninstallerDir SlicesPerDisk SolidCompression Source SourceDir StatusMsg String StrongAssemblyName Subkey TerminalServicesAware TimeStampRounding TimeStampsInUTC TitleFontName TitleFontSize TouchDate TouchTime Type Types UninstallDisplayIcon UninstallDisplayName UninstallDisplaySize UninstallFilesDir UninstallLogMode UninstallProgram UninstallRestartComputer Uninstallable UpdateUninstallLogAppName UsePreviousAppDir UsePreviousGroup UsePreviousLanguage UsePreviousPrivigeles UsePreviousSetupType UsePreviousTasks UsePreviousUserInfo UseSetupLdr UsedUserAreasWarning UserInfoPage ValueData ValueName Verb VersionInfoCompany VersionInfoCopyright VersionInfoDescription VersionInfoOriginalFileName VersionInfoProductName VersionInfoProductTextVersion VersionInfoProductVersion VersionInfoTextVersion VersionInfoVersion WelcomeFontName WelcomeFontSize WindowResizable WindowShowCaption WindowStartMaximized WindowVisible WizardImageAlphaFormat WizardImageFile WizardImageStretch WizardResizable WizardSizePercent WizardSmallImageFile WizardStyle WorkingDir app autoappdata autocf autocf32 autocf64 autodesktop autodocs autofonts autopf autopf32 autopf64 autoprograms autostartmenu autostartup autotemplates cf cf32 cf64 cm cmd code commonappdata commoncf commoncf32 commoncf64 commondesktop commondocs commonfonts commonpf commonpf32 commonpf64 commonprograms commonstartmenu commonstartup commontemplates computername dao dotnet40 dotnet4032 dotnet4064 drive fonts group groupname hwnd ini language localappdata log param pf pf32 pf64 reg sd sendto src srcexe sys sysnative sysuserinfoname sysuserinfoorg syswow64 tmp uninstallexe userappdata usercf userdesktop userdocs userfavorites userfonts userinfoname userinfoorg userinfoserial username userpf userprograms usersavedgames usersendto userstartmenu userstartup usertemplates win wizardhwnd and not or private protected public append define dim elif else emit endif endsub error expr file for if ifdef ifexist ifndef ifnexist include insert pragma preproc redim sub undef any func int str void __COUNTER__ __FILE__ __INCLUDE__ __LINE__ __OPT_X__ __WIN32__ COMPANY_NAME CompilerPath faAnyFile faArchive faDirectory faHidden False faReadOnly faSymLink faSysFile faVolumeID FILE_DESCRIPTION FILE_VERSION FIND_AND FIND_BEGINS FIND_CASESENSITIVE FIND_CONTAINS FIND_ENDS FIND_MATCH FIND_NOT FIND_OR FIND_SENSITIVE FIND_TRIM HKCC HKCC64 HKCR HKCR64 HKCU HKCU64 HKEY_CLASSES_ROOT HKEY_CLASSES_ROOT_64 HKEY_CURRENT_CONFIG HKEY_CURRENT_CONFIG_64 HKEY_CURRENT_USER HKEY_CURRENT_USER_64 HKEY_LOCAL_MACHINE HKEY_LOCAL_MACHINE_64 HKEY_USERS HKEY_USERS_64 HKLM HKLM64 HKU HKU64 INTERNAL_NAME ISPP_INVOKED ISPPCC_INVOKED LEGAL_COPYRIGHT MaxInt MinInt NewLine No NULL ORIGINAL_FILENAME PREPROCVER PRODUCT_NAME PRODUCT_VERSION SourcePath SW_HIDE SW_MAX SW_MAXIMIZE SW_MINIMIZE SW_NORMAL SW_RESTORE SW_SHOW SW_SHOWDEFAULT SW_SHOWMAXIMIZED SW_SHOWMINIMIZED SW_SHOWMINNOACTIVE SW_SHOWNA SW_SHOWNOACTIVATE SW_SHOWNORMAL Tab True TYPE_ARRAY TYPE_ERROR TYPE_FUNC TYPE_INTEGER TYPE_MACRO TYPE_NULL TYPE_STRING UNICODE Ver WINDOWS Yes and begin break case class const constructor continue do downto else end event except external finally for function if interface not of or procedure property read record repeat then to try type until uses var while with write AnsiString Boolean Byte Char Directory HBITMAP IDispatch Int64 Integer IUnknown Longint String TAlign TAlignment TAlphaFormat TAnchorKind TAnchors TBevel TBevelKind TBevelShape TBevelStyle TBevelWidth TBitmap TBitmapImage TBorderIcon TBorderIcons TBorderStyle TBorderWidth TBrush TBrushStyle TButton TButtonControl TCanvas TCheckBox TCheckBoxState TCheckItemOperation TCloseAction TCloseEvent TCloseQueryEvent TColor TComboBox TComboBoxStyle TComponent TConstraintSize TControl TCustomCheckBox TCustomComboBox TCustomControl TCustomEdit TCustomFolderTreeView TCustomLabel TCustomListBox TCustomMemo TCustomPanel TDownloadWizardPage TDuplicates TEdit TEditCharCase TEShiftState TFileStream TFolderRenameEvent TFolderTreeView TFont TFontStyle TFontStyles TForm TFormBorderStyle TFormStyle TGraphic TGraphicControl TGraphicsObject THandleStream TInputDirWizardPage TInputFileWizardPage TInputOptionWizardPage TInputQueryWizardPage TKeyEvent TKeyPressEvent TLabel TListBox TListBoxStyle TMainForm TMemo TNewButton TNewCheckBox TNewCheckListBox TNewComboBox TNewEdit TNewListBox TNewMemo TNewNotebook TNewNotebookPage TNewProgressBar TNewProgressBarState TNewProgressBarStyle TNewRadioButton TNewStaticText TNotebook TNotifyEvent TObject TOutputMarqueeProgressWizardPage TOutputMsgMemoWizardPage TOutputMsgWizardPage TOutputProgressWizardPage TPanel TPanelBevel TPasswordEdit TPen TPenMode TPenStyle TPersistent TPosition TRadioButton TRichEditViewer TScrollBarInc TScrollBarKind TScrollingWinControl TScrollStyle TSetupForm TSetupStep TShiftState TSizeConstraints TStartMenuFolderTreeView TStream TStringList TStrings TStringStream TUIStateForm TUninstallProgressForm TUninstallStep TWinControl TWizardForm TWizardPage TWizardPageButtonEvent TWizardPageCancelEvent TWizardPageNotifyEvent TWizardPageShouldSkipEvent Word MsgBox" + return autocomplete_set +end + +function inno.get_reqular() + local symbol_reqular_exp = "^\\[([_a-zA-Z]+[_a-zA-Z0-9]*)\\][\\s\\r\\n]*" + return symbol_reqular_exp +end + +function inno.create_bakup(path) + local inno_code = { + "user_inno = {}\n", + "\n", + "require(\"eu_sci\")\n", + "require(\"eu_core\")\n", + "\n", + "function user_inno.init_after_callback(p)\n", + " local pnode = eu_core.ffi.cast(\"void *\", p)\n", + " local res = eu_core.euapi.on_doc_init_after_scilexer(pnode, \"inno\") -- enable inno lex\n", + " if (res == 0) then\n", + " eu_core.euapi.on_doc_enable_foldline(pnode) -- enable fold line\n", + " end\n", + " return res\n", + "end\n", + "\n", + "function user_inno.get_styles()\n", + " local style_t = {\n", + " [SCE_INNO_COMMENT] = 0xC0C0C0,\n", + " [SCE_INNO_COMMENT_PASCAL] = 0xC0C0C0,\n", + " -- 区段关键字加上粗体\n", + " [SCE_INNO_SECTION] = 0x00B050 + SCE_BOLD_FONT,\n", + " [SCE_INNO_KEYWORD] = 0x00B050,\n", + " [SCE_INNO_KEYWORD_USER] = 0x00B050,\n", + " [SCE_INNO_PREPROC] = 0x00B050,\n", + " [SCE_INNO_KEYWORD_PASCAL] = 0xBBBB00 + SCE_BOLD_FONT,\n", + " [SCE_INNO_STRING_DOUBLE] = 0xC080FF,\n", + " [SCE_INNO_STRING_SINGLE] = 0xC080FF,\n", + " }\n", + " return style_t\n", + "end\n", + "\n", + "function user_inno.get_keywords()\n", + " local keywords0_set = \"setup code components custommessages dirs files ini icons installdelete langoptions languages messages registry run setuptasks types uninstalldelete uninstallrun\"\n", + " local keywords1_set = \"aslrcompatible additionalicons addonhostprogramnotfound allowcancelduringinstall allownetworkdrive allownoicons allowrootdirectory allowuncpath alwaysrestart alwaysshowcomponentslist alwaysshowdironreadypage alwaysshowgrouponreadypage alwaysusepersonalgroup appcomments appcontact appcopyright appid appmodifypath appmutex appname apppublisher apppublisherurl appreadmefile appsupportphone appsupporturl appupdatesurl appusermodelid appusermodeltoastactivatorclsid appvername appversion appenddefaultdirname appenddefaultgroupname architecturesallowed architecturesinstallin64bitmode assocfileextension associngfileextension attribs autostartprogram autostartprogramgroupdescription backcolor backcolor2 backcolordirection backsolid beveledlabel changesassociations changesenvironment check closeapplications closeapplicationsfilter comment components compression compressionthreads copymode copyrightfontname copyrightfontsize createappdir createdesktopicon createquicklaunchicon createuninstallregkey depcompatible defaultdialogfontname defaultdirname defaultgroupname defaultuserinfoname defaultuserinfoorg defaultuserinfoserial description destdir destname dialogfontname dialogfontsize direxistswarning disabledirpage disablefinishedpage disableprogramgrouppage disablereadymemo disablereadypage disablestartupprompt disablewelcomepage diskclustersize diskslicesize diskspanning enabledirdoesntexistwarning encryption excludes externalsize extradiskspacerequired filename flags flatcomponentslist fontinstall groupdescription helptextnote hotkey iconfilename iconindex infoafterfile infobeforefile internalcompresslevel key lzmaalgorithm lzmablocksize lzmadictionarysize lzmamatchfinder lzmanumblockthreads lzmanumfastbytes lzmauseseparateprocess languagecodepage languagedetectionmethod languageid languagename languages launchprogram licensefile mergeduplicatefiles messagesfile minversion missingmessageswarning missingrunonceidswarning name nameandversion notrecognizedmessageswarning onlybelowversion output outputbasefilename outputdir outputmanifestfile parameters password permissions privilegesrequired privilegesrequiredoverridesallowed programontheweb reservebytes restartapplications restartifneededbyrun righttoleft root runonceid section setupiconfile setuplogging setupmutex showcomponentsizes showlanguagedialog showtaskstreelines signtool signtoolminimumtimebetween signtoolretrycount signtoolretrydelay signtoolrunminimized signeduninstaller signeduninstallerdir slicesperdisk solidcompression source sourcedir statusmsg string strongassemblyname subkey terminalservicesaware timestamprounding timestampsinutc titlefontname titlefontsize touchdate touchtime type types uninstalldisplayicon uninstalldisplayname uninstalldisplaysize uninstallfilesdir uninstalllogmode uninstallprogram uninstallrestartcomputer uninstallable updateuninstalllogappname usepreviousappdir usepreviousgroup usepreviouslanguage usepreviousprivigeles useprevioussetuptype useprevioustasks useprevioususerinfo usesetupldr useduserareaswarning userinfopage valuedata valuename verb versioninfocompany versioninfocopyright versioninfodescription versioninfooriginalfilename versioninfoproductname versioninfoproducttextversion versioninfoproductversion versioninfotextversion versioninfoversion welcomefontname welcomefontsize windowresizable windowshowcaption windowstartmaximized windowvisible wizardimagealphaformat wizardimagefile wizardimagestretch wizardresizable wizardsizepercent wizardsmallimagefile wizardstyle workingdir\"\n", + " local keywords2_set = \"app autoappdata autocf autocf32 autocf64 autodesktop autodocs autofonts autopf autopf32 autopf64 autoprograms autostartmenu autostartup autotemplates cf cf32 cf64 cm cmd code commonappdata commoncf commoncf32 commoncf64 commondesktop commondocs commonfonts commonpf commonpf32 commonpf64 commonprograms commonstartmenu commonstartup commontemplates computername dao dotnet40 dotnet4032 dotnet4064 drive fonts group groupname hwnd ini language localappdata log param pf pf32 pf64 reg sd sendto src srcexe sys sysnative sysuserinfoname sysuserinfoorg syswow64 tmp uninstallexe userappdata usercf userdesktop userdocs userfavorites userfonts userinfoname userinfoorg userinfoserial username userpf userprograms usersavedgames usersendto userstartmenu userstartup usertemplates win wizardhwnd and not or private protected public append define dim elif else emit endif endsub error expr file for if ifdef ifexist ifndef ifnexist include insert pragma preproc redim sub undef any func int str void\"\n", + " local keywords3_set = \"__COUNTER__ __FILE__ __INCLUDE__ __LINE__ __OPT_X__ __WIN32__ COMPANY_NAME CompilerPath faAnyFile faArchive faDirectory faHidden False faReadOnly faSymLink faSysFile faVolumeID FILE_DESCRIPTION FILE_VERSION FIND_AND FIND_BEGINS FIND_CASESENSITIVE FIND_CONTAINS FIND_ENDS FIND_MATCH FIND_NOT FIND_OR FIND_SENSITIVE FIND_TRIM HKCC HKCC64 HKCR HKCR64 HKCU HKCU64 HKEY_CLASSES_ROOT HKEY_CLASSES_ROOT_64 HKEY_CURRENT_CONFIG HKEY_CURRENT_CONFIG_64 HKEY_CURRENT_USER HKEY_CURRENT_USER_64 HKEY_LOCAL_MACHINE HKEY_LOCAL_MACHINE_64 HKEY_USERS HKEY_USERS_64 HKLM HKLM64 HKU HKU64 INTERNAL_NAME ISPP_INVOKED ISPPCC_INVOKED LEGAL_COPYRIGHT MaxInt MinInt NewLine No NULL ORIGINAL_FILENAME PREPROCVER PRODUCT_NAME PRODUCT_VERSION SourcePath SW_HIDE SW_MAX SW_MAXIMIZE SW_MINIMIZE SW_NORMAL SW_RESTORE SW_SHOW SW_SHOWDEFAULT SW_SHOWMAXIMIZED SW_SHOWMINIMIZED SW_SHOWMINNOACTIVE SW_SHOWNA SW_SHOWNOACTIVATE SW_SHOWNORMAL Tab True TYPE_ARRAY TYPE_ERROR TYPE_FUNC TYPE_INTEGER TYPE_MACRO TYPE_NULL TYPE_STRING UNICODE Ver WINDOWS Yes\"\n", + " local keywords4_set = \"and begin break case class const constructor continue do downto else end event except external finally for function if interface not of or procedure property read record repeat then to try type until uses var while with write msgbox\"\n", + " local keywords5_set = \"AnsiString Boolean Byte Char Directory HBITMAP IDispatch Int64 Integer IUnknown Longint String TAlign TAlignment TAlphaFormat TAnchorKind TAnchors TBevel TBevelKind TBevelShape TBevelStyle TBevelWidth TBitmap TBitmapImage TBorderIcon TBorderIcons TBorderStyle TBorderWidth TBrush TBrushStyle TButton TButtonControl TCanvas TCheckBox TCheckBoxState TCheckItemOperation TCloseAction TCloseEvent TCloseQueryEvent TColor TComboBox TComboBoxStyle TComponent TConstraintSize TControl TCustomCheckBox TCustomComboBox TCustomControl TCustomEdit TCustomFolderTreeView TCustomLabel TCustomListBox TCustomMemo TCustomPanel TDownloadWizardPage TDuplicates TEdit TEditCharCase TEShiftState TFileStream TFolderRenameEvent TFolderTreeView TFont TFontStyle TFontStyles TForm TFormBorderStyle TFormStyle TGraphic TGraphicControl TGraphicsObject THandleStream TInputDirWizardPage TInputFileWizardPage TInputOptionWizardPage TInputQueryWizardPage TKeyEvent TKeyPressEvent TLabel TListBox TListBoxStyle TMainForm TMemo TNewButton TNewCheckBox TNewCheckListBox TNewComboBox TNewEdit TNewListBox TNewMemo TNewNotebook TNewNotebookPage TNewProgressBar TNewProgressBarState TNewProgressBarStyle TNewRadioButton TNewStaticText TNotebook TNotifyEvent TObject TOutputMarqueeProgressWizardPage TOutputMsgMemoWizardPage TOutputMsgWizardPage TOutputProgressWizardPage TPanel TPanelBevel TPasswordEdit TPen TPenMode TPenStyle TPersistent TPosition TRadioButton TRichEditViewer TScrollBarInc TScrollBarKind TScrollingWinControl TScrollStyle TSetupForm TSetupStep TShiftState TSizeConstraints TStartMenuFolderTreeView TStream TStringList TStrings TStringStream TUIStateForm TUninstallProgressForm TUninstallStep TWinControl TWizardForm TWizardPage TWizardPageButtonEvent TWizardPageCancelEvent TWizardPageNotifyEvent TWizardPageShouldSkipEvent Word\"\n", + " return keywords0_set,keywords1_set,keywords2_set,keywords3_set,keywords4_set,keywords5_set\n", + "end\n", + "\n", + "function user_inno.get_autocomplete()\n", + " local autocomplete_set = \"Setup Code Components CustomMessages Dirs Files INI Icons InstallDelete LangOptions Languages Messages Registry Run SetupTasks Types UninstallDelete UninstallRun ASLRCompatible AdditionalIcons AddonHostProgramNotFound AllowCancelDuringInstall AllowNetworkDrive AllowNoIcons AllowRootDirectory AllowUNCPath AlwaysRestart AlwaysShowComponentsList AlwaysShowDirOnReadyPage AlwaysShowGroupOnReadyPage AlwaysUsePersonalGroup AppComments AppContact AppCopyright AppId AppModifyPath AppMutex AppName AppPublisher AppPublisherURL AppReadmeFile AppSupportPhone AppSupportURL AppUpdatesURL AppUserModelID AppUserModelToastActivatorCLSID AppVerName AppVersion AppendDefaultDirName AppendDefaultGroupName ArchitecturesAllowed ArchitecturesInstallIn64BitMode AssocFileExtension AssocingFileExtension Attribs AutoStartProgram AutoStartProgramGroupDescription BackColor BackColor2 BackColorDirection BackSolid BeveledLabel ChangesAssociations ChangesEnvironment Check CloseApplications CloseApplicationsFilter Comment Components Compression CompressionThreads CopyMode CopyrightFontName CopyrightFontSize CreateAppDir CreateDesktopIcon CreateQuickLaunchIcon CreateUninstallRegKey DEPCompatible DefaultDialogFontName DefaultDirName DefaultGroupName DefaultUserInfoName DefaultUserInfoOrg DefaultUserInfoSerial Description DestDir DestName DialogFontName DialogFontSize DirExistsWarning DisableDirPage DisableFinishedPage DisableProgramGroupPage DisableReadyMemo DisableReadyPage DisableStartupPrompt DisableWelcomePage DiskClusterSize DiskSliceSize DiskSpanning EnableDirDoesntExistWarning Encryption Excludes ExternalSize ExtraDiskSpaceRequired Filename Flags FlatComponentsList FontInstall GroupDescription HelpTextNote HotKey IconFilename IconIndex InfoAfterFile InfoBeforeFile InternalCompressLevel Key LZMAAlgorithm LZMABlockSize LZMADictionarySize LZMAMatchFinder LZMANumBlockThreads LZMANumFastBytes LZMAUseSeparateProcess LanguageCodePage LanguageDetectionMethod LanguageID LanguageName Languages LaunchProgram LicenseFile MergeDuplicateFiles MessagesFile MinVersion MissingMessagesWarning MissingRunOnceIdsWarning Name NameAndVersion NotRecognizedMessagesWarning OnlyBelowVersion Output OutputBaseFilename OutputDir OutputManifestFile Parameters Password Permissions PrivilegesRequired PrivilegesRequiredOverridesAllowed ProgramOnTheWeb ReserveBytes RestartApplications RestartIfNeededByRun RightToLeft Root RunOnceId Section SetupIconFile SetupLogging SetupMutex ShowComponentSizes ShowLanguageDialog ShowTasksTreeLines SignTool SignToolMinimumTimeBetween SignToolRetryCount SignToolRetryDelay SignToolRunMinimized SignedUninstaller SignedUninstallerDir SlicesPerDisk SolidCompression Source SourceDir StatusMsg String StrongAssemblyName Subkey TerminalServicesAware TimeStampRounding TimeStampsInUTC TitleFontName TitleFontSize TouchDate TouchTime Type Types UninstallDisplayIcon UninstallDisplayName UninstallDisplaySize UninstallFilesDir UninstallLogMode UninstallProgram UninstallRestartComputer Uninstallable UpdateUninstallLogAppName UsePreviousAppDir UsePreviousGroup UsePreviousLanguage UsePreviousPrivigeles UsePreviousSetupType UsePreviousTasks UsePreviousUserInfo UseSetupLdr UsedUserAreasWarning UserInfoPage ValueData ValueName Verb VersionInfoCompany VersionInfoCopyright VersionInfoDescription VersionInfoOriginalFileName VersionInfoProductName VersionInfoProductTextVersion VersionInfoProductVersion VersionInfoTextVersion VersionInfoVersion WelcomeFontName WelcomeFontSize WindowResizable WindowShowCaption WindowStartMaximized WindowVisible WizardImageAlphaFormat WizardImageFile WizardImageStretch WizardResizable WizardSizePercent WizardSmallImageFile WizardStyle WorkingDir app autoappdata autocf autocf32 autocf64 autodesktop autodocs autofonts autopf autopf32 autopf64 autoprograms autostartmenu autostartup autotemplates cf cf32 cf64 cm cmd code commonappdata commoncf commoncf32 commoncf64 commondesktop commondocs commonfonts commonpf commonpf32 commonpf64 commonprograms commonstartmenu commonstartup commontemplates computername dao dotnet40 dotnet4032 dotnet4064 drive fonts group groupname hwnd ini language localappdata log param pf pf32 pf64 reg sd sendto src srcexe sys sysnative sysuserinfoname sysuserinfoorg syswow64 tmp uninstallexe userappdata usercf userdesktop userdocs userfavorites userfonts userinfoname userinfoorg userinfoserial username userpf userprograms usersavedgames usersendto userstartmenu userstartup usertemplates win wizardhwnd and not or private protected public append define dim elif else emit endif endsub error expr file for if ifdef ifexist ifndef ifnexist include insert pragma preproc redim sub undef any func int str void __COUNTER__ __FILE__ __INCLUDE__ __LINE__ __OPT_X__ __WIN32__ COMPANY_NAME CompilerPath faAnyFile faArchive faDirectory faHidden False faReadOnly faSymLink faSysFile faVolumeID FILE_DESCRIPTION FILE_VERSION FIND_AND FIND_BEGINS FIND_CASESENSITIVE FIND_CONTAINS FIND_ENDS FIND_MATCH FIND_NOT FIND_OR FIND_SENSITIVE FIND_TRIM HKCC HKCC64 HKCR HKCR64 HKCU HKCU64 HKEY_CLASSES_ROOT HKEY_CLASSES_ROOT_64 HKEY_CURRENT_CONFIG HKEY_CURRENT_CONFIG_64 HKEY_CURRENT_USER HKEY_CURRENT_USER_64 HKEY_LOCAL_MACHINE HKEY_LOCAL_MACHINE_64 HKEY_USERS HKEY_USERS_64 HKLM HKLM64 HKU HKU64 INTERNAL_NAME ISPP_INVOKED ISPPCC_INVOKED LEGAL_COPYRIGHT MaxInt MinInt NewLine No NULL ORIGINAL_FILENAME PREPROCVER PRODUCT_NAME PRODUCT_VERSION SourcePath SW_HIDE SW_MAX SW_MAXIMIZE SW_MINIMIZE SW_NORMAL SW_RESTORE SW_SHOW SW_SHOWDEFAULT SW_SHOWMAXIMIZED SW_SHOWMINIMIZED SW_SHOWMINNOACTIVE SW_SHOWNA SW_SHOWNOACTIVATE SW_SHOWNORMAL Tab True TYPE_ARRAY TYPE_ERROR TYPE_FUNC TYPE_INTEGER TYPE_MACRO TYPE_NULL TYPE_STRING UNICODE Ver WINDOWS Yes and begin break case class const constructor continue do downto else end event except external finally for function if interface not of or procedure property read record repeat then to try type until uses var while with write AnsiString Boolean Byte Char Directory HBITMAP IDispatch Int64 Integer IUnknown Longint String TAlign TAlignment TAlphaFormat TAnchorKind TAnchors TBevel TBevelKind TBevelShape TBevelStyle TBevelWidth TBitmap TBitmapImage TBorderIcon TBorderIcons TBorderStyle TBorderWidth TBrush TBrushStyle TButton TButtonControl TCanvas TCheckBox TCheckBoxState TCheckItemOperation TCloseAction TCloseEvent TCloseQueryEvent TColor TComboBox TComboBoxStyle TComponent TConstraintSize TControl TCustomCheckBox TCustomComboBox TCustomControl TCustomEdit TCustomFolderTreeView TCustomLabel TCustomListBox TCustomMemo TCustomPanel TDownloadWizardPage TDuplicates TEdit TEditCharCase TEShiftState TFileStream TFolderRenameEvent TFolderTreeView TFont TFontStyle TFontStyles TForm TFormBorderStyle TFormStyle TGraphic TGraphicControl TGraphicsObject THandleStream TInputDirWizardPage TInputFileWizardPage TInputOptionWizardPage TInputQueryWizardPage TKeyEvent TKeyPressEvent TLabel TListBox TListBoxStyle TMainForm TMemo TNewButton TNewCheckBox TNewCheckListBox TNewComboBox TNewEdit TNewListBox TNewMemo TNewNotebook TNewNotebookPage TNewProgressBar TNewProgressBarState TNewProgressBarStyle TNewRadioButton TNewStaticText TNotebook TNotifyEvent TObject TOutputMarqueeProgressWizardPage TOutputMsgMemoWizardPage TOutputMsgWizardPage TOutputProgressWizardPage TPanel TPanelBevel TPasswordEdit TPen TPenMode TPenStyle TPersistent TPosition TRadioButton TRichEditViewer TScrollBarInc TScrollBarKind TScrollingWinControl TScrollStyle TSetupForm TSetupStep TShiftState TSizeConstraints TStartMenuFolderTreeView TStream TStringList TStrings TStringStream TUIStateForm TUninstallProgressForm TUninstallStep TWinControl TWizardForm TWizardPage TWizardPageButtonEvent TWizardPageCancelEvent TWizardPageNotifyEvent TWizardPageShouldSkipEvent Word MsgBox\"\n", + " return autocomplete_set\n", + "end\n", + "\n", + "function user_inno.get_reqular()\n", + " local symbol_reqular_exp = \"^\\\\[([_a-zA-Z]+[_a-zA-Z0-9]*)\\\\][\\\\s\\\\r\\\\n]*\"\n", + " return symbol_reqular_exp\n", + "end\n", + "\n", + "return user_inno", + } + local shell_code = table.concat(inno_code) + eu_core.save_file(path, shell_code) + shell_code = nil + inno_code = nil +end + +return inno \ No newline at end of file diff --git a/conf/conf.d/log.lua b/conf/conf.d/log.lua index e99b6f3c..85cd2ba1 100644 --- a/conf/conf.d/log.lua +++ b/conf/conf.d/log.lua @@ -6,14 +6,32 @@ function log.get_keywords() return keywords0_set,keywords1_set end +function log.get_fonts() + local fonts0_set = "Fira Code" + local fonts1_set = "Microsoft YaHei UI" + local fonts2_set = "Microsoft YaHei" + local fonts_size = 0 + return fonts0_set,fonts1_set,fonts2_set,fonts_size +end + function log.create_bakup(path) local log_code = { "user_log = {}\n", + "\n", "function user_log.get_keywords()\n", " local keywords0_set = \"adonais trace debug info TRACE DEBUG INFO\"\n", " local keywords1_set = \"warn error fatal WARN ERROR FATAL\"\n", " return keywords0_set,keywords1_set\n", "end\n", + "\n", + "function user_log.get_fonts()\n", + " local fonts0_set = \"Fira Code\"\n", + " local fonts1_set = \"Microsoft YaHei UI\"\n", + " local fonts2_set = \"Microsoft YaHei\"\n", + " local fonts_size = 0\n", + " return fonts0_set,fonts1_set,fonts2_set,fonts_size\n", + "end\n", + "\n", "return user_log", } local shell_code = table.concat(log_code) diff --git a/conf/conf.d/nsis.lua b/conf/conf.d/nsis.lua new file mode 100644 index 00000000..ef5e0041 --- /dev/null +++ b/conf/conf.d/nsis.lua @@ -0,0 +1,112 @@ +nsis = {} + +require("eu_sci") +require("eu_core") + +function nsis.init_after_callback(p) + local pnode = eu_core.ffi.cast("void *", p) + local res = eu_core.euapi.on_doc_init_after_scilexer(pnode, "nsis") -- enable nsis lex + if (res == 0) then + eu_core.euapi.on_doc_enable_foldline(pnode) -- enable fold line + end + return res +end + +function nsis.get_styles() + local style_t = { + [SCE_NSIS_COMMENT] = 0xC0C0C0, + [SCE_NSIS_COMMENTBOX] = 0xC0C0C0, + -- 区段关键字加上粗体 + [SCE_NSIS_SECTIONDEF] = 0x00B050 + SCE_BOLD_FONT, + [SCE_NSIS_PAGEEX] = 0x00B050 + SCE_BOLD_FONT, + [SCE_NSIS_FUNCTIONDEF] = 0x00B050 + SCE_BOLD_FONT, + [SCE_NSIS_FUNCTION] = 0x00B050, + [SCE_NSIS_SUBSECTIONDEF] = 0xBBBB00 + SCE_BOLD_FONT, + [SCE_NSIS_IFDEFINEDEF] = 0xBBBB00, + [SCE_NSIS_MACRODEF] = 0xBBBB00, + [SCE_NSIS_USERDEFINED] = 0xBBBB00, + [SCE_NSIS_VARIABLE] = 0xC080FF, + [SCE_NSIS_STRINGVAR] = 0xC080FF, + } + return style_t +end + +function nsis.get_keywords() + local keywords0_set = "Goto Page PageEx PageExEnd Return Section SectionEnd SectionGroup SectionGroupEnd UninstPage WriteINIStr BannerTrimPath ConfigRead ConfigReadS ConfigWrite ConfigWriteS DirState DriveSpace FileJoin FileReadFromEnd FileRecode GetBaseName GetDrives GetExeName GetExePath GetFileAttributes GetFileExt GetFileName GetFileVersion GetOptions GetOptionsS GetParameters GetParent GetRoot GetSize GetTime LineFind LineRead LineSum Locate RefreshShellIcons StrFilter StrFilterS TextCompare TextCompareS TrimNewLines VersionCompare VersionConvert WordAdd WordAddS WordFind WordFind2X WordFind2XS WordFind3X WordFind3XS WordFindS WordInsert WordInsertS WordReplace WordReplaceS onGUIEnd onGUIInit onInit onInstFailed onInstSuccess onMouseOverSection onRebootFailed onSelChange onUninstFailed onUninstSuccess onUserAbort onVerifyInstDir AddBrandingImage AllowRootDirInstall AllowSkipFiles AutoCloseWindow BGFont BGGradient BrandingText CRCCheck Caption ChangeUI CheckBitmap CompletedText ComponentText DetailsButtonText DirText DirVar DirVerify FileBufSize FileErrorText Icon InstProgressFlags InstallButtonText InstallColors InstallDir InstallDirRegKey LicenseBkColor LicenseData LicenseForceSelection LicenseText ManifestDPIAware ManifestLongPathAware ManifestSupportedOS MiscButtonText Name OutFile PEAddResource PERemoveResource RequestExecutionLevel SetCompress SetCompressor SetCompressorDictSize SetDatablockOptimize SetDateSave SetFont SetOverwrite ShowInstDetails ShowUninstDetails SilentInstall SilentUnInstall SpaceTexts SubCaption Unicode UninstallButtonText UninstallCaption UninstallIcon UninstallSubCaption UninstallText VIAddVersionKey VIFileVersion VIProductVersion WindowIcon XPStyle Abort AddSize BringToFront Call CallInstDLL ClearErrors CopyFiles CreateDirectory CreateFont CreateShortcut Delete DeleteINISec DeleteINIStr DeleteRegKey DeleteRegValue DetailPrint EnableWindow EnumRegKey EnumRegValue Exch Exec ExecShell ExecShellWait ExecWait ExpandEnvStrings File FileClose FileOpen FileRead FileReadByte FileReadUTF16LE FileReadWord FileSeek FileWrite FileWriteByte FileWriteUTF16LE FileWriteWord FindClose FindFirst FindNext FindWindow FlushINI GetCurInstType GetCurrentAddress GetDLLVersion GetDLLVersionLocal GetDlgItem GetErrorLevel GetFileTime GetFileTimeLocal GetFullPathName GetFunctionAddress GetInstDirError GetKnownFolderPath GetLabelAddress GetTempFileName GetWinVer HideWindow IfAbort IfErrors IfFileExists IfRebootFlag IfRtlLanguage IfShellVarContextAll IfSilent InitPluginsDir InstType InstTypeGetText InstTypeSetText Int64Cmp Int64CmpU Int64Fmt IntCmp IntCmpU IntFmt IntOp IntPtrCmp IntPtrCmpU IntPtrOp IsWindow LangString LicenseLangString LoadAndSetImage LoadLanguageFile LockWindow LogSet LogText MessageBox Nop PageCallbacks Pop Push Quit RMDir ReadEnvStr ReadINIStr ReadRegDWORD ReadRegStr Reboot RegDLL Rename ReserveFile SearchPath SectionGetFlags SectionGetInstTypes SectionGetSize SectionGetText SectionIn SectionInstType SectionSetFlags SectionSetInstTypes SectionSetSize SectionSetText SendMessage SetAutoClose SetBrandingImage SetCtlColors SetCurInstType SetDetailsPrint SetDetailsView SetErrorLevel SetErrors SetFileAttributes SetOutPath SetRebootFlag SetRegView SetShellVarContext SetSilent ShowWindow Sleep StrCmp StrCmpS StrCpy StrLen UnRegDLL WriteINIStr WriteRegBin WriteRegDWORD WriteRegExpandStr WriteRegMultiStr WriteRegNone WriteRegStr WriteUninstaller" + local keywords1_set = "Var" + local keywords2_set = nil + local keywords3_set = "ADMINTOOLS APPDATA CDBURN_AREA COOKIES DESKTOP DOCUMENTS EXEDIR EXEFILE EXEPATH FAVORITES FONTS HISTORY HWNDPARENT INTERNET_CACHE LOCALAPPDATA MUSIC NETHOOD NSISDIR NSIS_CHAR_SIZE NSIS_PACKEDVERSION NSIS_PTR_SIZE NSIS_VERSION PICTURES PLUGINSDIR PRINTHOOD PROFILE PROGRAMFILES PROGRAMFILES32 PROGRAMFILES64 QUICKLAUNCH RECENT RESOURCES RESOURCES_LOCALIZED SENDTO SMPROGRAMS SMSTARTUP STARTMENU SYSDIR TEMP TEMPLATES VIDEOS WINDIR __COUNTER__ __DATE__ __FILEDIR__ __FILE__ __LINE__ __TIMESTAMP__ __TIME__ !include !insertmacro !addincludedir !addplugindir !appendfile !assert !cd !define !delfile !echo !error !execute !finalize !getdllversion !gettlbversion !makensis !packhdr !pragma !searchparse !searchreplace !system !tempfile !undef !uninstfinalize !verbose !warning" + return keywords0_set,keywords1_set,keywords2_set,keywords3_set +end + +function nsis.get_autocomplete() + local autocomplete_set = "Function FunctionEnd Goto Page PageEx PageExEnd Return Section SectionEnd SectionGroup SectionGroupEnd UninstPage Var addincludedir addplugindir appendfile assert cd define delfile echo else endif error execute finalize getdllversion gettlbversion if ifdef ifmacrodef ifmacrondef ifndef include insertmacro macro macroend macroundef makensis packhdr pragma searchparse searchreplace system tempfile undef uninstfinalize verbose warning Abort AddSize BringToFront Call CallInstDLL ClearErrors CopyFiles CreateDirectory CreateFont CreateShortcut Delete DeleteINISec DeleteINIStr DeleteRegKey DeleteRegValue DetailPrint EnableWindow EnumRegKey EnumRegValue Exch Exec ExecShell ExecShellWait ExecWait ExpandEnvStrings File FileClose FileOpen FileRead FileReadByte FileReadUTF16LE FileReadWord FileSeek FileWrite FileWriteByte FileWriteUTF16LE FileWriteWord FindClose FindFirst FindNext FindWindow FlushINI GetCurInstType GetCurrentAddress GetDLLVersion GetDLLVersionLocal GetDlgItem GetErrorLevel GetFileTime GetFileTimeLocal GetFullPathName GetFunctionAddress GetInstDirError GetKnownFolderPath GetLabelAddress GetTempFileName GetWinVer HideWindow IfAbort IfErrors IfFileExists IfRebootFlag IfRtlLanguage IfShellVarContextAll IfSilent InitPluginsDir InstType InstTypeGetText InstTypeSetText Int64Cmp Int64CmpU Int64Fmt IntCmp IntCmpU IntFmt IntOp IntPtrCmp IntPtrCmpU IntPtrOp IsWindow LangString LicenseLangString LoadAndSetImage LoadLanguageFile LockWindow LogSet LogText MessageBox Nop PageCallbacks Pop Push Quit RMDir ReadEnvStr ReadINIStr ReadRegDWORD ReadRegStr Reboot RegDLL Rename ReserveFile SearchPath SectionGetFlags SectionGetInstTypes SectionGetSize SectionGetText SectionIn SectionInstType SectionSetFlags SectionSetInstTypes SectionSetSize SectionSetText SendMessage SetAutoClose SetBrandingImage SetCtlColors SetCurInstType SetDetailsPrint SetDetailsView SetErrorLevel SetErrors SetFileAttributes SetOutPath SetRebootFlag SetRegView SetShellVarContext SetSilent ShowWindow Sleep StrCmp StrCmpS StrCpy StrLen UnRegDLL WriteINIStr WriteRegBin WriteRegDWORD WriteRegExpandStr WriteRegMultiStr WriteRegNone WriteRegStr WriteUninstaller AddBrandingImage AllowRootDirInstall AllowSkipFiles AutoCloseWindow BGFont BGGradient BrandingText CRCCheck Caption ChangeUI CheckBitmap CompletedText ComponentText DetailsButtonText DirText DirVar DirVerify FileBufSize FileErrorText Icon InstProgressFlags InstallButtonText InstallColors InstallDir InstallDirRegKey LicenseBkColor LicenseData LicenseForceSelection LicenseText ManifestDPIAware ManifestLongPathAware ManifestSupportedOS MiscButtonText Name OutFile PEAddResource PERemoveResource RequestExecutionLevel SetCompress SetCompressor SetCompressorDictSize SetDatablockOptimize SetDateSave SetFont SetOverwrite ShowInstDetails ShowUninstDetails SilentInstall SilentUnInstall SpaceTexts SubCaption Unicode UninstallButtonText UninstallCaption UninstallIcon UninstallSubCaption UninstallText VIAddVersionKey VIFileVersion VIProductVersion WindowIcon XPStyle BannerTrimPath ConfigRead ConfigReadS ConfigWrite ConfigWriteS DirState DriveSpace FileJoin FileReadFromEnd FileRecode GetBaseName GetDrives GetExeName GetExePath GetFileAttributes GetFileExt GetFileName GetFileVersion GetOptions GetOptionsS GetParameters GetParent GetRoot GetSize GetTime LineFind LineRead LineSum Locate RefreshShellIcons StrFilter StrFilterS TextCompare TextCompareS TrimNewLines VersionCompare VersionConvert WordAdd WordAddS WordFind WordFind2X WordFind2XS WordFind3X WordFind3XS WordFindS WordInsert WordInsertS WordReplace WordReplaceS onGUIEnd onGUIInit onInit onInstFailed onInstSuccess onMouseOverSection onRebootFailed onSelChange onUninstFailed onUninstSuccess onUserAbort onVerifyInstDir ADMINTOOLS APPDATA CDBURN_AREA COOKIES DESKTOP DOCUMENTS EXEDIR EXEFILE EXEPATH FAVORITES FONTS HISTORY HWNDPARENT INTERNET_CACHE LOCALAPPDATA MUSIC NETHOOD NSISDIR NSIS_CHAR_SIZE NSIS_PACKEDVERSION NSIS_PTR_SIZE NSIS_VERSION PICTURES PLUGINSDIR PRINTHOOD PROFILE PROGRAMFILES PROGRAMFILES32 PROGRAMFILES64 QUICKLAUNCH RECENT RESOURCES RESOURCES_LOCALIZED SENDTO SMPROGRAMS SMSTARTUP STARTMENU SYSDIR TEMP TEMPLATES VIDEOS WINDIR __COUNTER__ __DATE__ __FILEDIR__ __FILE__ __LINE__ __TIMESTAMP__ __TIME__" + return autocomplete_set +end + +function nsis.get_reqular() + local symbol_reqular_exp = "^function[ \\t]+([._a-zA-Z0-9]+)[\\s\\r\\n]*" + return symbol_reqular_exp +end + +function nsis.create_bakup(path) + local nsis_code = { + "user_nsis = {}\n", + "\n", + "require(\"eu_sci\")\n", + "require(\"eu_core\")\n", + "\n", + "function user_nsis.init_after_callback(p)\n", + " local pnode = eu_core.ffi.cast(\"void *\", p)\n", + " local res = eu_core.euapi.on_doc_init_after_scilexer(pnode, \"nsis\") -- enable nsis lex\n", + " if (res == 0) then\n", + " eu_core.euapi.on_doc_enable_foldline(pnode) -- enable fold line\n", + " end\n", + " return res\n", + "end\n", + "\n", + "function user_nsis.get_styles()\n", + " local style_t = {\n", + " [SCE_NSIS_COMMENT] = 0xC0C0C0,\n", + " [SCE_NSIS_COMMENTBOX] = 0xC0C0C0,\n", + " -- 区段关键字加上粗体\n", + " [SCE_NSIS_SECTIONDEF] = 0x00B050 + SCE_BOLD_FONT,\n", + " [SCE_NSIS_PAGEEX] = 0x00B050 + SCE_BOLD_FONT,\n", + " [SCE_NSIS_FUNCTIONDEF] = 0x00B050 + SCE_BOLD_FONT,\n", + " [SCE_NSIS_FUNCTION] = 0x00B050,\n", + " [SCE_NSIS_SUBSECTIONDEF] = 0xBBBB00 + SCE_BOLD_FONT,\n", + " [SCE_NSIS_IFDEFINEDEF] = 0xBBBB00,\n", + " [SCE_NSIS_MACRODEF] = 0xBBBB00,\n", + " [SCE_NSIS_USERDEFINED] = 0xBBBB00,\n", + " [SCE_NSIS_VARIABLE] = 0xC080FF,\n", + " [SCE_NSIS_STRINGVAR] = 0xC080FF,\n", + " }\n", + " return style_t\n", + "end\n", + "\n", + "function user_nsis.get_keywords()\n", + " local keywords0_set = \"Goto Page PageEx PageExEnd Return Section SectionEnd SectionGroup SectionGroupEnd UninstPage WriteINIStr BannerTrimPath ConfigRead ConfigReadS ConfigWrite ConfigWriteS DirState DriveSpace FileJoin FileReadFromEnd FileRecode GetBaseName GetDrives GetExeName GetExePath GetFileAttributes GetFileExt GetFileName GetFileVersion GetOptions GetOptionsS GetParameters GetParent GetRoot GetSize GetTime LineFind LineRead LineSum Locate RefreshShellIcons StrFilter StrFilterS TextCompare TextCompareS TrimNewLines VersionCompare VersionConvert WordAdd WordAddS WordFind WordFind2X WordFind2XS WordFind3X WordFind3XS WordFindS WordInsert WordInsertS WordReplace WordReplaceS onGUIEnd onGUIInit onInit onInstFailed onInstSuccess onMouseOverSection onRebootFailed onSelChange onUninstFailed onUninstSuccess onUserAbort onVerifyInstDir AddBrandingImage AllowRootDirInstall AllowSkipFiles AutoCloseWindow BGFont BGGradient BrandingText CRCCheck Caption ChangeUI CheckBitmap CompletedText ComponentText DetailsButtonText DirText DirVar DirVerify FileBufSize FileErrorText Icon InstProgressFlags InstallButtonText InstallColors InstallDir InstallDirRegKey LicenseBkColor LicenseData LicenseForceSelection LicenseText ManifestDPIAware ManifestLongPathAware ManifestSupportedOS MiscButtonText Name OutFile PEAddResource PERemoveResource RequestExecutionLevel SetCompress SetCompressor SetCompressorDictSize SetDatablockOptimize SetDateSave SetFont SetOverwrite ShowInstDetails ShowUninstDetails SilentInstall SilentUnInstall SpaceTexts SubCaption Unicode UninstallButtonText UninstallCaption UninstallIcon UninstallSubCaption UninstallText VIAddVersionKey VIFileVersion VIProductVersion WindowIcon XPStyle Abort AddSize BringToFront Call CallInstDLL ClearErrors CopyFiles CreateDirectory CreateFont CreateShortcut Delete DeleteINISec DeleteINIStr DeleteRegKey DeleteRegValue DetailPrint EnableWindow EnumRegKey EnumRegValue Exch Exec ExecShell ExecShellWait ExecWait ExpandEnvStrings File FileClose FileOpen FileRead FileReadByte FileReadUTF16LE FileReadWord FileSeek FileWrite FileWriteByte FileWriteUTF16LE FileWriteWord FindClose FindFirst FindNext FindWindow FlushINI GetCurInstType GetCurrentAddress GetDLLVersion GetDLLVersionLocal GetDlgItem GetErrorLevel GetFileTime GetFileTimeLocal GetFullPathName GetFunctionAddress GetInstDirError GetKnownFolderPath GetLabelAddress GetTempFileName GetWinVer HideWindow IfAbort IfErrors IfFileExists IfRebootFlag IfRtlLanguage IfShellVarContextAll IfSilent InitPluginsDir InstType InstTypeGetText InstTypeSetText Int64Cmp Int64CmpU Int64Fmt IntCmp IntCmpU IntFmt IntOp IntPtrCmp IntPtrCmpU IntPtrOp IsWindow LangString LicenseLangString LoadAndSetImage LoadLanguageFile LockWindow LogSet LogText MessageBox Nop PageCallbacks Pop Push Quit RMDir ReadEnvStr ReadINIStr ReadRegDWORD ReadRegStr Reboot RegDLL Rename ReserveFile SearchPath SectionGetFlags SectionGetInstTypes SectionGetSize SectionGetText SectionIn SectionInstType SectionSetFlags SectionSetInstTypes SectionSetSize SectionSetText SendMessage SetAutoClose SetBrandingImage SetCtlColors SetCurInstType SetDetailsPrint SetDetailsView SetErrorLevel SetErrors SetFileAttributes SetOutPath SetRebootFlag SetRegView SetShellVarContext SetSilent ShowWindow Sleep StrCmp StrCmpS StrCpy StrLen UnRegDLL WriteINIStr WriteRegBin WriteRegDWORD WriteRegExpandStr WriteRegMultiStr WriteRegNone WriteRegStr WriteUninstaller\"\n", + " local keywords1_set = \"Var\"\n", + " local keywords2_set = nil\n", + " local keywords3_set = \"ADMINTOOLS APPDATA CDBURN_AREA COOKIES DESKTOP DOCUMENTS EXEDIR EXEFILE EXEPATH FAVORITES FONTS HISTORY HWNDPARENT INTERNET_CACHE LOCALAPPDATA MUSIC NETHOOD NSISDIR NSIS_CHAR_SIZE NSIS_PACKEDVERSION NSIS_PTR_SIZE NSIS_VERSION PICTURES PLUGINSDIR PRINTHOOD PROFILE PROGRAMFILES PROGRAMFILES32 PROGRAMFILES64 QUICKLAUNCH RECENT RESOURCES RESOURCES_LOCALIZED SENDTO SMPROGRAMS SMSTARTUP STARTMENU SYSDIR TEMP TEMPLATES VIDEOS WINDIR __COUNTER__ __DATE__ __FILEDIR__ __FILE__ __LINE__ __TIMESTAMP__ __TIME__ !include !insertmacro !addincludedir !addplugindir !appendfile !assert !cd !define !delfile !echo !error !execute !finalize !getdllversion !gettlbversion !makensis !packhdr !pragma !searchparse !searchreplace !system !tempfile !undef !uninstfinalize !verbose !warning\"\n", + " return keywords0_set,keywords1_set,keywords2_set,keywords3_set\n", + "end\n", + "\n", + "function user_nsis.get_autocomplete()\n", + " local autocomplete_set = \"Function FunctionEnd Goto Page PageEx PageExEnd Return Section SectionEnd SectionGroup SectionGroupEnd UninstPage Var addincludedir addplugindir appendfile assert cd define delfile echo else endif error execute finalize getdllversion gettlbversion if ifdef ifmacrodef ifmacrondef ifndef include insertmacro macro macroend macroundef makensis packhdr pragma searchparse searchreplace system tempfile undef uninstfinalize verbose warning Abort AddSize BringToFront Call CallInstDLL ClearErrors CopyFiles CreateDirectory CreateFont CreateShortcut Delete DeleteINISec DeleteINIStr DeleteRegKey DeleteRegValue DetailPrint EnableWindow EnumRegKey EnumRegValue Exch Exec ExecShell ExecShellWait ExecWait ExpandEnvStrings File FileClose FileOpen FileRead FileReadByte FileReadUTF16LE FileReadWord FileSeek FileWrite FileWriteByte FileWriteUTF16LE FileWriteWord FindClose FindFirst FindNext FindWindow FlushINI GetCurInstType GetCurrentAddress GetDLLVersion GetDLLVersionLocal GetDlgItem GetErrorLevel GetFileTime GetFileTimeLocal GetFullPathName GetFunctionAddress GetInstDirError GetKnownFolderPath GetLabelAddress GetTempFileName GetWinVer HideWindow IfAbort IfErrors IfFileExists IfRebootFlag IfRtlLanguage IfShellVarContextAll IfSilent InitPluginsDir InstType InstTypeGetText InstTypeSetText Int64Cmp Int64CmpU Int64Fmt IntCmp IntCmpU IntFmt IntOp IntPtrCmp IntPtrCmpU IntPtrOp IsWindow LangString LicenseLangString LoadAndSetImage LoadLanguageFile LockWindow LogSet LogText MessageBox Nop PageCallbacks Pop Push Quit RMDir ReadEnvStr ReadINIStr ReadRegDWORD ReadRegStr Reboot RegDLL Rename ReserveFile SearchPath SectionGetFlags SectionGetInstTypes SectionGetSize SectionGetText SectionIn SectionInstType SectionSetFlags SectionSetInstTypes SectionSetSize SectionSetText SendMessage SetAutoClose SetBrandingImage SetCtlColors SetCurInstType SetDetailsPrint SetDetailsView SetErrorLevel SetErrors SetFileAttributes SetOutPath SetRebootFlag SetRegView SetShellVarContext SetSilent ShowWindow Sleep StrCmp StrCmpS StrCpy StrLen UnRegDLL WriteINIStr WriteRegBin WriteRegDWORD WriteRegExpandStr WriteRegMultiStr WriteRegNone WriteRegStr WriteUninstaller AddBrandingImage AllowRootDirInstall AllowSkipFiles AutoCloseWindow BGFont BGGradient BrandingText CRCCheck Caption ChangeUI CheckBitmap CompletedText ComponentText DetailsButtonText DirText DirVar DirVerify FileBufSize FileErrorText Icon InstProgressFlags InstallButtonText InstallColors InstallDir InstallDirRegKey LicenseBkColor LicenseData LicenseForceSelection LicenseText ManifestDPIAware ManifestLongPathAware ManifestSupportedOS MiscButtonText Name OutFile PEAddResource PERemoveResource RequestExecutionLevel SetCompress SetCompressor SetCompressorDictSize SetDatablockOptimize SetDateSave SetFont SetOverwrite ShowInstDetails ShowUninstDetails SilentInstall SilentUnInstall SpaceTexts SubCaption Unicode UninstallButtonText UninstallCaption UninstallIcon UninstallSubCaption UninstallText VIAddVersionKey VIFileVersion VIProductVersion WindowIcon XPStyle BannerTrimPath ConfigRead ConfigReadS ConfigWrite ConfigWriteS DirState DriveSpace FileJoin FileReadFromEnd FileRecode GetBaseName GetDrives GetExeName GetExePath GetFileAttributes GetFileExt GetFileName GetFileVersion GetOptions GetOptionsS GetParameters GetParent GetRoot GetSize GetTime LineFind LineRead LineSum Locate RefreshShellIcons StrFilter StrFilterS TextCompare TextCompareS TrimNewLines VersionCompare VersionConvert WordAdd WordAddS WordFind WordFind2X WordFind2XS WordFind3X WordFind3XS WordFindS WordInsert WordInsertS WordReplace WordReplaceS onGUIEnd onGUIInit onInit onInstFailed onInstSuccess onMouseOverSection onRebootFailed onSelChange onUninstFailed onUninstSuccess onUserAbort onVerifyInstDir ADMINTOOLS APPDATA CDBURN_AREA COOKIES DESKTOP DOCUMENTS EXEDIR EXEFILE EXEPATH FAVORITES FONTS HISTORY HWNDPARENT INTERNET_CACHE LOCALAPPDATA MUSIC NETHOOD NSISDIR NSIS_CHAR_SIZE NSIS_PACKEDVERSION NSIS_PTR_SIZE NSIS_VERSION PICTURES PLUGINSDIR PRINTHOOD PROFILE PROGRAMFILES PROGRAMFILES32 PROGRAMFILES64 QUICKLAUNCH RECENT RESOURCES RESOURCES_LOCALIZED SENDTO SMPROGRAMS SMSTARTUP STARTMENU SYSDIR TEMP TEMPLATES VIDEOS WINDIR __COUNTER__ __DATE__ __FILEDIR__ __FILE__ __LINE__ __TIMESTAMP__ __TIME__\"\n", + " return autocomplete_set\n", + "end\n", + "\n", + "function user_nsis.get_reqular()\n", + " local symbol_reqular_exp = \"^function[ \\\\t]+([._a-zA-Z0-9]+)[\\\\s\\\\r\\\\n]*\"\n", + " return symbol_reqular_exp\n", + "end\n", + "return user_nsis", + } + local shell_code = table.concat(nsis_code) + eu_core.save_file(path, shell_code) + shell_code = nil + nsis_code = nil +end + +return nsis \ No newline at end of file diff --git a/conf/conf.d/text.lua b/conf/conf.d/text.lua new file mode 100644 index 00000000..fb6d4b40 --- /dev/null +++ b/conf/conf.d/text.lua @@ -0,0 +1,31 @@ +text = {} + +function text.get_fonts() + local fonts0_set = "Fira Code" + local fonts1_set = "Microsoft YaHei UI" + local fonts2_set = "Microsoft YaHei" + local fonts_size = 0 + return fonts0_set,fonts1_set,fonts2_set,fonts_size +end + +function text.create_bakup(path) + local text_code = { + "user_text = {}\n", + "\n", + "function user_text.get_fonts()\n", + " local fonts0_set = \"Fira Code\"\n", + " local fonts1_set = \"Microsoft YaHei UI\"\n", + " local fonts2_set = \"Microsoft YaHei\"\n", + " local fonts_size = 0\n", + " return fonts0_set,fonts1_set,fonts2_set,fonts_size\n", + "end\n", + "\n", + "return user_text", + } + local shell_code = table.concat(text_code) + eu_core.save_file(path, shell_code) + shell_code = nil + text_code = nil +end + +return text \ No newline at end of file diff --git a/locales/src/en-us.rc b/locales/src/en-us.rc index c9089c66..0bffe472 100644 --- a/locales/src/en-us.rc +++ b/locales/src/en-us.rc @@ -880,7 +880,111 @@ IDR_TYPES_MENU MENUEX DISCARDABLE BEGIN POPUP "0" { - MENUITEM "Unsupported", IDM_TYPES_0 + MENUITEM "Unsupported", IDM_TYPES_0 + POPUP "A", IDM_TYPES_A + BEGIN + MENUITEM " (NULL) ", IDM_TYPES_ZERO,,0x00000003 + END + POPUP "B", IDM_TYPES_B + BEGIN + MENUITEM " (NULL) ", IDM_TYPES_ZERO,,0x00000003 + END + POPUP "C", IDM_TYPES_C + BEGIN + MENUITEM " (NULL) ", IDM_TYPES_ZERO,,0x00000003 + END + POPUP "D", IDM_TYPES_D + BEGIN + MENUITEM " (NULL) ", IDM_TYPES_ZERO,,0x00000003 + END + POPUP "E", IDM_TYPES_E + BEGIN + MENUITEM " (NULL) ", IDM_TYPES_ZERO,,0x00000003 + END + POPUP "F", IDM_TYPES_F + BEGIN + MENUITEM " (NULL) ", IDM_TYPES_ZERO,,0x00000003 + END + POPUP "G", IDM_TYPES_G + BEGIN + MENUITEM " (NULL) ", IDM_TYPES_ZERO,,0x00000003 + END + POPUP "H", IDM_TYPES_H + BEGIN + MENUITEM " (NULL) ", IDM_TYPES_ZERO,,0x00000003 + END + POPUP "I", IDM_TYPES_I + BEGIN + MENUITEM " (NULL) ", IDM_TYPES_ZERO,,0x00000003 + END + POPUP "J", IDM_TYPES_J + BEGIN + MENUITEM " (NULL) ", IDM_TYPES_ZERO,,0x00000003 + END + POPUP "K", IDM_TYPES_K + BEGIN + MENUITEM " (NULL) ", IDM_TYPES_ZERO,,0x00000003 + END + POPUP "L", IDM_TYPES_L + BEGIN + MENUITEM " (NULL) ", IDM_TYPES_ZERO,,0x00000003 + END + POPUP "M", IDM_TYPES_M + BEGIN + MENUITEM " (NULL) ", IDM_TYPES_ZERO,,0x00000003 + END + POPUP "N", IDM_TYPES_N + BEGIN + MENUITEM " (NULL) ", IDM_TYPES_ZERO,,0x00000003 + END + POPUP "O", IDM_TYPES_O + BEGIN + MENUITEM " (NULL) ", IDM_TYPES_ZERO,,0x00000003 + END + POPUP "P", IDM_TYPES_P + BEGIN + MENUITEM " (NULL) ", IDM_TYPES_ZERO,,0x00000003 + END + POPUP "Q", IDM_TYPES_Q + BEGIN + MENUITEM " (NULL) ", IDM_TYPES_ZERO,,0x00000003 + END + POPUP "R", IDM_TYPES_R + BEGIN + MENUITEM " (NULL) ", IDM_TYPES_ZERO,,0x00000003 + END + POPUP "S", IDM_TYPES_S + BEGIN + MENUITEM " (NULL) ", IDM_TYPES_ZERO,,0x00000003 + END + POPUP "T", IDM_TYPES_T + BEGIN + MENUITEM " (NULL) ", IDM_TYPES_ZERO,,0x00000003 + END + POPUP "U", IDM_TYPES_U + BEGIN + MENUITEM " (NULL) ", IDM_TYPES_ZERO,,0x00000003 + END + POPUP "V", IDM_TYPES_V + BEGIN + MENUITEM " (NULL) ", IDM_TYPES_ZERO,,0x00000003 + END + POPUP "W", IDM_TYPES_W + BEGIN + MENUITEM " (NULL) ", IDM_TYPES_ZERO,,0x00000003 + END + POPUP "X", IDM_TYPES_X + BEGIN + MENUITEM " (NULL) ", IDM_TYPES_ZERO,,0x00000003 + END + POPUP "Y", IDM_TYPES_Y + BEGIN + MENUITEM " (NULL) ", IDM_TYPES_ZERO,,0x00000003 + END + POPUP "Z", IDM_TYPES_Z + BEGIN + MENUITEM " (NULL) ", IDM_TYPES_ZERO,,0x00000003 + END } END @@ -1176,7 +1280,7 @@ STRINGTABLE DISCARDABLE IDC_MSG_SYMLIST_FAIL "Failed to create symbol list control" IDC_MSG_PCRE_FAIL "Regular expressions cannot be resolved" IDC_MSG_HISTORY_ZERO " (NULL) " - IDC_MSG_OPEN_FILE_EDIT "Open files with Skylark" + IDC_MSG_OPEN_FILE_EDIT "Open files with Skylark" IDC_MSG_DIRECTORYFILES "Open all the files in the directory with Skylark" IDC_MSG_LOC_DIRECTORY "Using Skylark to locate the directory" IDC_MSG_REGIST_ERR1 "Cannot create key in registry [*\\shell\\skylark]" @@ -1341,7 +1445,8 @@ STRINGTABLE DISCARDABLE IDS_EXTRA_PATH "External program path: " IDS_EDITOR_PATH "External editor path: " IDS_EDITOR_BCOMPARE "Bcompare path: " - IDS_THEME_TIPS "Tips: The foreground color of some keywords on this page is realized by user script and does not follow the theme" + IDS_THEME_TIPS1 "Tips: The editor font for this page is implemented by user scripts and does not follow the theme" + IDS_THEME_TIPS2 "Tips: The foreground color of some keywords on this page is realized by user script and does not follow the theme" IDS_RE_ERROR "Error: invalid regular expression" IDS_HEXVIEW_BYTES "Number of bytes to insert (decimal): " IDS_RESULT_STR_TIPS "The number of matches has exceeded 131071 times, If the search continues, It will take a lot of time, Is it terminated?\n" diff --git a/locales/src/zh-cn.rc b/locales/src/zh-cn.rc index ba918897..214c23e7 100644 --- a/locales/src/zh-cn.rc +++ b/locales/src/zh-cn.rc @@ -881,6 +881,110 @@ BEGIN POPUP "0" { MENUITEM "不支持高亮", IDM_TYPES_0 + POPUP "A", IDM_TYPES_A + BEGIN + MENUITEM " (空) ", IDM_TYPES_ZERO,,0x00000003 + END + POPUP "B", IDM_TYPES_B + BEGIN + MENUITEM " (空) ", IDM_TYPES_ZERO,,0x00000003 + END + POPUP "C", IDM_TYPES_C + BEGIN + MENUITEM " (空) ", IDM_TYPES_ZERO,,0x00000003 + END + POPUP "D", IDM_TYPES_D + BEGIN + MENUITEM " (空) ", IDM_TYPES_ZERO,,0x00000003 + END + POPUP "E", IDM_TYPES_E + BEGIN + MENUITEM " (空) ", IDM_TYPES_ZERO,,0x00000003 + END + POPUP "F", IDM_TYPES_F + BEGIN + MENUITEM " (空) ", IDM_TYPES_ZERO,,0x00000003 + END + POPUP "G", IDM_TYPES_G + BEGIN + MENUITEM " (空) ", IDM_TYPES_ZERO,,0x00000003 + END + POPUP "H", IDM_TYPES_H + BEGIN + MENUITEM " (空) ", IDM_TYPES_ZERO,,0x00000003 + END + POPUP "I", IDM_TYPES_I + BEGIN + MENUITEM " (空) ", IDM_TYPES_ZERO,,0x00000003 + END + POPUP "J", IDM_TYPES_J + BEGIN + MENUITEM " (空) ", IDM_TYPES_ZERO,,0x00000003 + END + POPUP "K", IDM_TYPES_K + BEGIN + MENUITEM " (空) ", IDM_TYPES_ZERO,,0x00000003 + END + POPUP "L", IDM_TYPES_L + BEGIN + MENUITEM " (空) ", IDM_TYPES_ZERO,,0x00000003 + END + POPUP "M", IDM_TYPES_M + BEGIN + MENUITEM " (空) ", IDM_TYPES_ZERO,,0x00000003 + END + POPUP "N", IDM_TYPES_N + BEGIN + MENUITEM " (空) ", IDM_TYPES_ZERO,,0x00000003 + END + POPUP "O", IDM_TYPES_O + BEGIN + MENUITEM " (空) ", IDM_TYPES_ZERO,,0x00000003 + END + POPUP "P", IDM_TYPES_P + BEGIN + MENUITEM " (空) ", IDM_TYPES_ZERO,,0x00000003 + END + POPUP "Q", IDM_TYPES_Q + BEGIN + MENUITEM " (空) ", IDM_TYPES_ZERO,,0x00000003 + END + POPUP "R", IDM_TYPES_R + BEGIN + MENUITEM " (空) ", IDM_TYPES_ZERO,,0x00000003 + END + POPUP "S", IDM_TYPES_S + BEGIN + MENUITEM " (空) ", IDM_TYPES_ZERO,,0x00000003 + END + POPUP "T", IDM_TYPES_T + BEGIN + MENUITEM " (空) ", IDM_TYPES_ZERO,,0x00000003 + END + POPUP "U", IDM_TYPES_U + BEGIN + MENUITEM " (空) ", IDM_TYPES_ZERO,,0x00000003 + END + POPUP "V", IDM_TYPES_V + BEGIN + MENUITEM " (空) ", IDM_TYPES_ZERO,,0x00000003 + END + POPUP "W", IDM_TYPES_W + BEGIN + MENUITEM " (空) ", IDM_TYPES_ZERO,,0x00000003 + END + POPUP "X", IDM_TYPES_X + BEGIN + MENUITEM " (空) ", IDM_TYPES_ZERO,,0x00000003 + END + POPUP "Y", IDM_TYPES_Y + BEGIN + MENUITEM " (空) ", IDM_TYPES_ZERO,,0x00000003 + END + POPUP "Z", IDM_TYPES_Z + BEGIN + MENUITEM " (空) ", IDM_TYPES_ZERO,,0x00000003 + END } END @@ -1175,7 +1279,7 @@ STRINGTABLE DISCARDABLE IDC_MSG_SYMLIST_FAIL "创建符号列表控件失败" IDC_MSG_PCRE_FAIL "不能解析符号正则表达式" IDC_MSG_HISTORY_ZERO " (空) " - IDC_MSG_OPEN_FILE_EDIT "用 Skylark 打开文件" + IDC_MSG_OPEN_FILE_EDIT "用 Skylark 打开文件" IDC_MSG_DIRECTORYFILES "用 Skylark 打开目录中所有文件" IDC_MSG_LOC_DIRECTORY "用 Skylark 定位目录" IDC_MSG_REGIST_ERR1 "不能在注册表创建项 *\\shell\\skylark " @@ -1185,7 +1289,7 @@ STRINGTABLE DISCARDABLE IDC_MSG_REGIST_ERR5 "不能在注册表设置键 *\\shell\\skylark:(default) " IDC_MSG_REGIST_ERR6 "不能在注册表删除项 *\\shell\\skylark " IDC_MSG_REGIST_ERR7 "不能在注册表删除项 *\\shell\\skylark " - IDC_MSG_REGIST_ERR8 "在资源管理器卸载右键弹出菜单成功" + IDC_MSG_REGIST_ERR8 "右键菜单卸载成功" IDC_MSG_REGIST_ERR9 "不能在注册表创建项 Directory\\shell\\skylark " IDC_MSG_REGIST_ERR10 "不能在注册表设置键 Directory\\shell\\skylark:(default) " IDC_MSG_REGIST_ERR11 "不能在注册表设置键 Directory\\shell\\skylark:Icon " @@ -1339,7 +1443,8 @@ STRINGTABLE DISCARDABLE IDS_EXTRA_PATH "外部程序路径: " IDS_EDITOR_PATH "外部编辑器路径: " IDS_EDITOR_BCOMPARE "Bcompare路径: " - IDS_THEME_TIPS "提示: 此页面的部分关键字前景色由用户脚本实现, 不随主题" + IDS_THEME_TIPS1 "提示: 此页面的编辑器字体由用户脚本实现, 不随主题" + IDS_THEME_TIPS2 "提示: 此页面的部分关键字前景色由用户脚本实现, 不随主题" IDS_RE_ERROR "错误: 无效的正则表达式" IDS_HEXVIEW_BYTES "插入的字节数(十进制): " IDS_RESULT_STR_TIPS "匹配数量已经超过 131071 次, 如果继续搜索, 将耗费大量时间, 是否终止?\n" diff --git a/share/changelog b/share/changelog index 387f210b..8d0f4e31 100644 --- a/share/changelog +++ b/share/changelog @@ -1,3 +1,12 @@ +4.0.7 2023-10-24 adonais + * 新增: 支持Inno与Nsis脚本高亮显示 + * 新增: 通过lua脚本指定不跟随全局主题的字体样式 + * 变更: 合并状态栏上语言类型菜单 + * 变更: INI文件支持区段展示 + * 修复: 设置菜单上的盾牌图标遮挡了菜单项状态 + * 修复: Ctrl+Backspace无法删除搜索记录的问题 + * 修复: 修改字体后切换主题没有应用新主题字体 + 4.0.6 2023-10-13 adonais * 新增: XML树控件支持与格式化 * 新增: TCL脚本高亮与代码片段 diff --git a/src/3rdparty/luajit/src/jit/bcsave.lua b/src/3rdparty/luajit/src/jit/bcsave.lua index 74699f3d..390d297c 100644 --- a/src/3rdparty/luajit/src/jit/bcsave.lua +++ b/src/3rdparty/luajit/src/jit/bcsave.lua @@ -38,7 +38,7 @@ Save LuaJIT bytecode: luajit -b[options] input output -- Stop handling options. - Use stdin as input and/or stdout as output. -File types: c h obj o raw (default) +File types: c cc h obj o raw (default) ]] os.exit(1) end @@ -81,7 +81,7 @@ end ------------------------------------------------------------------------------ local map_type = { - raw = "raw", c = "c", h = "h", o = "obj", obj = "obj", + raw = "raw", c = "c", cc = "c", h = "h", o = "obj", obj = "obj", } local map_arch = { diff --git a/src/3rdparty/luajit/src/lj_carith.c b/src/3rdparty/luajit/src/lj_carith.c index df5f801e..9bea0a33 100644 --- a/src/3rdparty/luajit/src/lj_carith.c +++ b/src/3rdparty/luajit/src/lj_carith.c @@ -44,9 +44,13 @@ static int carith_checkarg(lua_State *L, CTState *cts, CDArith *ca) p = (uint8_t *)cdata_getptr(p, ct->size); if (ctype_isref(ct->info)) ct = ctype_rawchild(cts, ct); } else if (ctype_isfunc(ct->info)) { + CTypeID id0 = i ? ctype_typeid(cts, ca->ct[0]) : 0; p = (uint8_t *)*(void **)p; ct = ctype_get(cts, lj_ctype_intern(cts, CTINFO(CT_PTR, CTALIGN_PTR|id), CTSIZE_PTR)); + if (i) { /* cts->tab may have been reallocated. */ + ca->ct[0] = ctype_get(cts, id0); + } } if (ctype_isenum(ct->info)) ct = ctype_child(cts, ct); ca->ct[i] = ct; diff --git a/src/3rdparty/luajit/src/lj_ctype.h b/src/3rdparty/luajit/src/lj_ctype.h index 45e7234e..cde1cf01 100644 --- a/src/3rdparty/luajit/src/lj_ctype.h +++ b/src/3rdparty/luajit/src/lj_ctype.h @@ -276,6 +276,8 @@ typedef struct CTState { #define CTTYDEFP(_) #endif +#define CTF_LONG_IF8 (CTF_LONG * (sizeof(long) == 8)) + /* Common types. */ #define CTTYDEF(_) \ _(NONE, 0, CT_ATTRIB, CTATTRIB(CTA_BAD)) \ @@ -289,8 +291,8 @@ typedef struct CTState { _(UINT16, 2, CT_NUM, CTF_UNSIGNED|CTALIGN(1)) \ _(INT32, 4, CT_NUM, CTALIGN(2)) \ _(UINT32, 4, CT_NUM, CTF_UNSIGNED|CTALIGN(2)) \ - _(INT64, 8, CT_NUM, CTF_LONG|CTALIGN(3)) \ - _(UINT64, 8, CT_NUM, CTF_UNSIGNED|CTF_LONG|CTALIGN(3)) \ + _(INT64, 8, CT_NUM, CTF_LONG_IF8|CTALIGN(3)) \ + _(UINT64, 8, CT_NUM, CTF_UNSIGNED|CTF_LONG_IF8|CTALIGN(3)) \ _(FLOAT, 4, CT_NUM, CTF_FP|CTALIGN(2)) \ _(DOUBLE, 8, CT_NUM, CTF_FP|CTALIGN(3)) \ _(COMPLEX_FLOAT, 8, CT_ARRAY, CTF_COMPLEX|CTALIGN(2)|CTID_FLOAT) \ diff --git a/src/3rdparty/scintilla/src/src/CallTip.cxx b/src/3rdparty/scintilla/src/src/CallTip.cxx index 87a2bab0..188c9068 100644 --- a/src/3rdparty/scintilla/src/src/CallTip.cxx +++ b/src/3rdparty/scintilla/src/src/CallTip.cxx @@ -37,6 +37,22 @@ size_t Chunk::Length() const noexcept { return end - start; } +namespace { + +#ifdef __APPLE__ +// Archaic macOS colours for the default: black on light yellow +constexpr ColourRGBA colourTextAndArrow(black); +constexpr ColourRGBA colourBackground(0xff, 0xff, 0xc6); +#else +// Grey on white +constexpr ColourRGBA colourTextAndArrow(0x80, 0x80, 0x80); +constexpr ColourRGBA colourBackground(white); +#endif + +constexpr ColourRGBA silver(0xc0, 0xc0, 0xc0); + +} + CallTip::CallTip() noexcept { wCallTip = {}; inCallTipMode = false; @@ -54,17 +70,12 @@ CallTip::CallTip() noexcept { borderHeight = 2; // Extra line for border and an empty line at top and bottom. verticalOffset = 1; -#ifdef __APPLE__ - // proper apple colours for the default - colourBG = ColourRGBA(0xff, 0xff, 0xc6); - colourUnSel = ColourRGBA(0, 0, 0); -#else - colourBG = ColourRGBA(0xff, 0xff, 0xff); - colourUnSel = ColourRGBA(0x80, 0x80, 0x80); -#endif + colourBG = colourBackground; + colourUnSel = colourTextAndArrow; + colourSel = ColourRGBA(0, 0, 0x80); - colourShade = ColourRGBA(0, 0, 0); - colourLight = ColourRGBA(0xc0, 0xc0, 0xc0); + colourShade = black; + colourLight = silver; codePage = 0; clickPlace = 0; } diff --git a/src/3rdparty/scintilla/src/src/Document.cxx b/src/3rdparty/scintilla/src/src/Document.cxx index 94d126a7..a45479e4 100644 --- a/src/3rdparty/scintilla/src/src/Document.cxx +++ b/src/3rdparty/scintilla/src/src/Document.cxx @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -3293,7 +3294,11 @@ Sci::Position BuiltinRegex::FindText(Document *doc, Sci::Position minPos, Sci::P if ((resr.increment == -1) && !searchforLineStart) { // Check for the last match on this line. int repetitions = 1000; // Break out of infinite loop + RESearch::MatchPositions bopat{}; + RESearch::MatchPositions eopat{}; while (success && (search.eopat[0] <= endOfLine) && (repetitions--)) { + bopat = search.bopat; + eopat = search.eopat; success = search.Execute(di, pos+1, endOfLine); if (success) { if (search.eopat[0] <= minPos) { @@ -3304,6 +3309,10 @@ Sci::Position BuiltinRegex::FindText(Document *doc, Sci::Position minPos, Sci::P } } } + if (!success) { + search.bopat = bopat; + search.eopat = eopat; + } } break; } diff --git a/src/3rdparty/scintilla/src/src/EditView.cxx b/src/3rdparty/scintilla/src/src/EditView.cxx index 09a20eda..0e136a8b 100644 --- a/src/3rdparty/scintilla/src/src/EditView.cxx +++ b/src/3rdparty/scintilla/src/src/EditView.cxx @@ -831,13 +831,13 @@ Sci::Position EditView::StartEndDisplayLine(Surface *surface, const EditModel &m namespace { -constexpr ColourRGBA bugColour = ColourRGBA(0xff, 0, 0xfe, 0xf0); +constexpr ColourRGBA colourBug(0xff, 0, 0xfe, 0xf0); // Selection background colours are always defined, the value_or is to show if bug ColourRGBA SelectionBackground(const EditModel &model, const ViewStyle &vsDraw, InSelection inSelection) { if (inSelection == InSelection::inNone) - return bugColour; // Not selected is a bug + return colourBug; // Not selected is a bug Element element = Element::SelectionBack; if (inSelection == InSelection::inAdditional) @@ -846,7 +846,7 @@ ColourRGBA SelectionBackground(const EditModel &model, const ViewStyle &vsDraw, element = Element::SelectionSecondaryBack; if (!model.hasFocus && vsDraw.ElementColour(Element::SelectionInactiveBack)) element = Element::SelectionInactiveBack; - return vsDraw.ElementColour(element).value_or(bugColour); + return vsDraw.ElementColour(element).value_or(colourBug); } ColourOptional SelectionForeground(const EditModel &model, const ViewStyle &vsDraw, InSelection inSelection) { @@ -1411,9 +1411,9 @@ void EditView::DrawAnnotation(Surface *surface, const EditModel &model, const Vi } } } else { - // No annotation to draw so show bug with bugColour + // No annotation to draw so show bug with colourBug if (FlagSet(phase, DrawPhase::back)) { - surface->FillRectangle(rcSegment, bugColour.Opaque()); + surface->FillRectangle(rcSegment, colourBug.Opaque()); } } } @@ -2093,7 +2093,7 @@ ColourRGBA InvertedLight(ColourRGBA orig) noexcept { const unsigned int l = (r + g + b) / 3; // There is a better calculation for this that matches human eye const unsigned int il = 0xff - l; if (l == 0) - return ColourRGBA(0xff, 0xff, 0xff); + return white; r = r * il / l; g = g * il / l; b = b * il / l; @@ -2714,15 +2714,15 @@ Sci::Position EditView::FormatRange(bool draw, CharacterRangeFull chrg, Rectangl it->fore = InvertedLight(it->fore); it->back = InvertedLight(it->back); } else if (colourMode == PrintOption::BlackOnWhite) { - it->fore = ColourRGBA(0, 0, 0); - it->back = ColourRGBA(0xff, 0xff, 0xff); + it->fore = black; + it->back = white; } else if (colourMode == PrintOption::ColourOnWhite || colourMode == PrintOption::ColourOnWhiteDefaultBG) { - it->back = ColourRGBA(0xff, 0xff, 0xff); + it->back = white; } } // White background for the line numbers if PrintOption::ScreenColours isn't used if (colourMode != PrintOption::ScreenColours) { - vsPrint.styles[StyleLineNumber].back = ColourRGBA(0xff, 0xff, 0xff); + vsPrint.styles[StyleLineNumber].back = white; } // Printing uses different margins, so reset screen margins diff --git a/src/3rdparty/scintilla/src/src/Geometry.h b/src/3rdparty/scintilla/src/src/Geometry.h index f417caae..28f2f022 100644 --- a/src/3rdparty/scintilla/src/src/Geometry.h +++ b/src/3rdparty/scintilla/src/src/Geometry.h @@ -170,15 +170,19 @@ PRectangle PixelAlignOutside(const PRectangle &rc, int pixelDivisions) noexcept; /** * Holds an RGBA colour with 8 bits for each component. */ -constexpr const float componentMaximum = 255.0f; +constexpr float componentMaximum = 255.0F; +constexpr unsigned int maximumByte = 0xffU; class ColourRGBA { + static constexpr float ComponentAsFloat(unsigned int component) { + return component / componentMaximum; + } static constexpr int rgbMask = 0xffffff; int co; public: constexpr explicit ColourRGBA(int co_ = 0) noexcept : co(co_) { } - constexpr ColourRGBA(unsigned int red, unsigned int green, unsigned int blue, unsigned int alpha=0xff) noexcept : + constexpr ColourRGBA(unsigned int red, unsigned int green, unsigned int blue, unsigned int alpha= maximumByte) noexcept : ColourRGBA(red | (green << 8) | (blue << 16) | (alpha << 24)) { } @@ -187,11 +191,11 @@ class ColourRGBA { } static constexpr ColourRGBA FromRGB(int co_) noexcept { - return ColourRGBA(co_ | (0xffu << 24)); + return ColourRGBA(co_ | (maximumByte << 24)); } static constexpr ColourRGBA FromIpRGB(intptr_t co_) noexcept { - return ColourRGBA((co_ & rgbMask) | (0xffu << 24)); + return ColourRGBA((co_ & rgbMask) | (maximumByte << 24)); } constexpr ColourRGBA WithoutAlpha() const noexcept { @@ -199,7 +203,7 @@ class ColourRGBA { } constexpr ColourRGBA Opaque() const noexcept { - return ColourRGBA(co | (0xffu << 24)); + return ColourRGBA(co | (maximumByte << 24)); } constexpr int AsInteger() const noexcept { @@ -212,32 +216,32 @@ class ColourRGBA { // Red, green and blue values as bytes 0..255 constexpr unsigned char GetRed() const noexcept { - return co & 0xffU; + return co & maximumByte; } constexpr unsigned char GetGreen() const noexcept { - return (co >> 8) & 0xffU; + return (co >> 8) & maximumByte; } constexpr unsigned char GetBlue() const noexcept { - return (co >> 16) & 0xffU; + return (co >> 16) & maximumByte; } constexpr unsigned char GetAlpha() const noexcept { // Use a temporary here to prevent a 'Wconversion' warning from GCC const int shifted = co >> 24; - return shifted & 0xffU; + return shifted & maximumByte; } // Red, green, blue, and alpha values as float 0..1.0 constexpr float GetRedComponent() const noexcept { - return GetRed() / componentMaximum; + return ComponentAsFloat(GetRed()); } constexpr float GetGreenComponent() const noexcept { - return GetGreen() / componentMaximum; + return ComponentAsFloat(GetGreen()); } constexpr float GetBlueComponent() const noexcept { - return GetBlue() / componentMaximum; + return ComponentAsFloat(GetBlue()); } constexpr float GetAlphaComponent() const noexcept { - return GetAlpha() / componentMaximum; + return ComponentAsFloat(GetAlpha()); } constexpr bool operator==(const ColourRGBA &other) const noexcept { @@ -245,13 +249,16 @@ class ColourRGBA { } constexpr bool IsOpaque() const noexcept { - return GetAlpha() == 0xff; + return GetAlpha() == maximumByte; } ColourRGBA MixedWith(ColourRGBA other) const noexcept; ColourRGBA MixedWith(ColourRGBA other, double proportion) const noexcept; }; +constexpr ColourRGBA white(maximumByte, maximumByte, maximumByte); +constexpr ColourRGBA black(0x0, 0x0, 0x0); + /** * Holds an RGBA colour and stroke width to stroke a shape. */ diff --git a/src/3rdparty/scintilla/src/src/Indicator.h b/src/3rdparty/scintilla/src/src/Indicator.h index fc17a82c..5bdccaf3 100644 --- a/src/3rdparty/scintilla/src/src/Indicator.h +++ b/src/3rdparty/scintilla/src/src/Indicator.h @@ -15,7 +15,7 @@ struct StyleAndColour { ColourRGBA fore; StyleAndColour() noexcept : style(Scintilla::IndicatorStyle::Plain), fore(0, 0, 0) { } - StyleAndColour(Scintilla::IndicatorStyle style_, ColourRGBA fore_ = ColourRGBA(0, 0, 0)) noexcept : style(style_), fore(fore_) { + StyleAndColour(Scintilla::IndicatorStyle style_, ColourRGBA fore_ = black) noexcept : style(style_), fore(fore_) { } bool operator==(const StyleAndColour &other) const noexcept { return (style == other.style) && (fore == other.fore); @@ -36,7 +36,7 @@ class Indicator { XYPOSITION strokeWidth = 1.0f; Indicator() noexcept : under(false), fillAlpha(30), outlineAlpha(50), attributes(Scintilla::IndicFlag::None) { } - Indicator(Scintilla::IndicatorStyle style_, ColourRGBA fore_= ColourRGBA(0,0,0), bool under_=false, int fillAlpha_=30, int outlineAlpha_=50) noexcept : + Indicator(Scintilla::IndicatorStyle style_, ColourRGBA fore_= black, bool under_=false, int fillAlpha_=30, int outlineAlpha_=50) noexcept : sacNormal(style_, fore_), sacHover(style_, fore_), under(under_), fillAlpha(fillAlpha_), outlineAlpha(outlineAlpha_), attributes(Scintilla::IndicFlag::None) { } void Draw(Surface *surface, const PRectangle &rc, const PRectangle &rcLine, const PRectangle &rcCharacter, State drawState, int value) const; diff --git a/src/3rdparty/scintilla/src/src/LineMarker.h b/src/3rdparty/scintilla/src/src/LineMarker.h index 0a60da96..e82d6fe1 100644 --- a/src/3rdparty/scintilla/src/src/LineMarker.h +++ b/src/3rdparty/scintilla/src/src/LineMarker.h @@ -22,8 +22,8 @@ class LineMarker { enum class FoldPart { undefined, head, body, tail, headWithTail }; Scintilla::MarkerSymbol markType = Scintilla::MarkerSymbol::Circle; - ColourRGBA fore = ColourRGBA(0, 0, 0); - ColourRGBA back = ColourRGBA(0xff, 0xff, 0xff); + ColourRGBA fore = black; + ColourRGBA back = white; ColourRGBA backSelected = ColourRGBA(0xff, 0x00, 0x00); Scintilla::Layer layer = Scintilla::Layer::Base; Scintilla::Alpha alpha = Scintilla::Alpha::NoAlpha; diff --git a/src/3rdparty/scintilla/src/src/MarginView.cxx b/src/3rdparty/scintilla/src/src/MarginView.cxx index 6cc961db..348b5dd0 100644 --- a/src/3rdparty/scintilla/src/src/MarginView.cxx +++ b/src/3rdparty/scintilla/src/src/MarginView.cxx @@ -138,7 +138,7 @@ void MarginView::RefreshPixMaps(Surface *surfaceWindow, const ViewStyle &vsDraw) ColourRGBA colourFMFill = vsDraw.selbar; ColourRGBA colourFMStripes = vsDraw.selbarlight; - if (!(vsDraw.selbarlight == ColourRGBA(0xff, 0xff, 0xff))) { + if (!(vsDraw.selbarlight == white)) { // User has chosen an unusual chrome colour scheme so just use the highlight edge colour. // (Typically, the highlight colour is white.) colourFMFill = vsDraw.selbarlight; diff --git a/src/3rdparty/scintilla/src/src/RESearch.cxx b/src/3rdparty/scintilla/src/src/RESearch.cxx index 9a2981ff..98399c92 100644 --- a/src/3rdparty/scintilla/src/src/RESearch.cxx +++ b/src/3rdparty/scintilla/src/src/RESearch.cxx @@ -205,6 +205,7 @@ #include #include +#include #include #include @@ -260,11 +261,11 @@ RESearch::RESearch(CharClassify *charClassTable) { Clear(); } -void RESearch::Clear() noexcept { +void RESearch::Clear() { + bopat.fill(NOTFOUND); + eopat.fill(NOTFOUND); for (int i = 0; i < MAXTAG; i++) { pat[i].clear(); - bopat[i] = NOTFOUND; - eopat[i] = NOTFOUND; } } diff --git a/src/3rdparty/scintilla/src/src/RESearch.h b/src/3rdparty/scintilla/src/src/RESearch.h index 34c6c46f..c142441a 100644 --- a/src/3rdparty/scintilla/src/src/RESearch.h +++ b/src/3rdparty/scintilla/src/src/RESearch.h @@ -21,7 +21,7 @@ class RESearch { public: explicit RESearch(CharClassify *charClassTable); // No dynamic allocation so default copy constructor and assignment operator are OK. - void Clear() noexcept; + void Clear(); void GrabMatches(const CharacterIndexer &ci); const char *Compile(const char *pattern, Sci::Position length, bool caseSensitive, bool posix) noexcept; int Execute(const CharacterIndexer &ci, Sci::Position lp, Sci::Position endp); @@ -29,8 +29,9 @@ class RESearch { static constexpr int MAXTAG = 10; static constexpr int NOTFOUND = -1; - Sci::Position bopat[MAXTAG]; - Sci::Position eopat[MAXTAG]; + using MatchPositions = std::array; + MatchPositions bopat; + MatchPositions eopat; std::string pat[MAXTAG]; private: diff --git a/src/3rdparty/scintilla/src/src/ScintillaBase.h b/src/3rdparty/scintilla/src/src/ScintillaBase.h index b8331aaf..bfeb5a3d 100644 --- a/src/3rdparty/scintilla/src/src/ScintillaBase.h +++ b/src/3rdparty/scintilla/src/src/ScintillaBase.h @@ -10,6 +10,10 @@ namespace Scintilla::Internal { +// For most platforms (not Cocoa) all IME indicators are drawn in same colour, +// blue, with different patterns. +constexpr ColourRGBA colourIME(0x0, 0x0, 0xffU); + class LexState; /** */ diff --git a/src/3rdparty/scintilla/src/src/Style.cxx b/src/3rdparty/scintilla/src/src/Style.cxx index a4507229..fcde6398 100644 --- a/src/3rdparty/scintilla/src/src/Style.cxx +++ b/src/3rdparty/scintilla/src/src/Style.cxx @@ -65,8 +65,8 @@ int DefaultFontSize() noexcept { Style::Style(const char *fontName_) noexcept : FontSpecification(fontName_, DefaultFontSize() * FontSizeMultiplier), - fore(0,0,0), - back(0xff, 0xff, 0xff), + fore(black), + back(white), eolFilled(false), underline(false), caseForce(CaseForce::mixed), diff --git a/src/3rdparty/scintilla/src/src/ViewStyle.cxx b/src/3rdparty/scintilla/src/src/ViewStyle.cxx index b8fe0c0d..a669fce4 100644 --- a/src/3rdparty/scintilla/src/src/ViewStyle.cxx +++ b/src/3rdparty/scintilla/src/src/ViewStyle.cxx @@ -186,10 +186,10 @@ ViewStyle::ViewStyle(size_t stylesSize_) : controlCharWidth = 0; selbar = Platform::Chrome(); selbarlight = Platform::ChromeHighlight(); - styles[StyleLineNumber].fore = ColourRGBA(0, 0, 0); + styles[StyleLineNumber].fore = black; styles[StyleLineNumber].back = Platform::Chrome(); - elementBaseColours[Element::Caret] = ColourRGBA(0, 0, 0); + elementBaseColours[Element::Caret] = black; elementBaseColours[Element::CaretAdditional] = ColourRGBA(0x7f, 0x7f, 0x7f); elementAllowsTranslucent.insert({ Element::Caret, @@ -459,7 +459,7 @@ void ViewStyle::ClearStyles() { styles[StyleLineNumber].back = Platform::Chrome(); // Set call tip fore/back to match the values previously set for call tips - styles[StyleCallTip].back = ColourRGBA(0xff, 0xff, 0xff); + styles[StyleCallTip].back = white; styles[StyleCallTip].fore = ColourRGBA(0x80, 0x80, 0x80); } @@ -622,8 +622,7 @@ ColourRGBA ViewStyle::ElementColourForced(Element element) const { // This method avoids warnings for unwrapping potentially empty optionals from // Visual C++ Code Analysis const ColourOptional colour = ElementColour(element); - constexpr ColourRGBA opaqueBlack(0, 0, 0, 0xff); - return colour.value_or(opaqueBlack); + return colour.value_or(black); } bool ViewStyle::ElementAllowsTranslucent(Element element) const { diff --git a/src/3rdparty/scintilla/src/src/XPM.cxx b/src/3rdparty/scintilla/src/src/XPM.cxx index 5c7d8fee..57c401ee 100644 --- a/src/3rdparty/scintilla/src/src/XPM.cxx +++ b/src/3rdparty/scintilla/src/src/XPM.cxx @@ -117,7 +117,7 @@ void XPM::Init(const char *const *linesForm) { if (!linesForm) return; - std::fill(colourCodeTable, std::end(colourCodeTable), ColourRGBA(0, 0, 0)); + std::fill(colourCodeTable, std::end(colourCodeTable), black); const char *line0 = linesForm[0]; width = atoi(line0); line0 = NextField(line0); diff --git a/src/3rdparty/scintilla/src/win32/ScintillaWin.cxx b/src/3rdparty/scintilla/src/win32/ScintillaWin.cxx index c039a4dd..26ea0d08 100644 --- a/src/3rdparty/scintilla/src/win32/ScintillaWin.cxx +++ b/src/3rdparty/scintilla/src/win32/ScintillaWin.cxx @@ -616,10 +616,10 @@ ScintillaWin::ScintillaWin(HWND hwnd) { HMODULE user32 = ::GetModuleHandleW(L"user32.dll"); SetCoalescableTimerFn = DLLFunction(user32, "SetCoalescableTimer"); - vs.indicators[IndicatorUnknown] = Indicator(IndicatorStyle::Hidden, ColourRGBA(0, 0, 0xff)); - vs.indicators[IndicatorInput] = Indicator(IndicatorStyle::Dots, ColourRGBA(0, 0, 0xff)); - vs.indicators[IndicatorConverted] = Indicator(IndicatorStyle::CompositionThick, ColourRGBA(0, 0, 0xff)); - vs.indicators[IndicatorTarget] = Indicator(IndicatorStyle::StraightBox, ColourRGBA(0, 0, 0xff)); + vs.indicators[IndicatorUnknown] = Indicator(IndicatorStyle::Hidden, colourIME); + vs.indicators[IndicatorInput] = Indicator(IndicatorStyle::Dots, colourIME); + vs.indicators[IndicatorConverted] = Indicator(IndicatorStyle::CompositionThick, colourIME); + vs.indicators[IndicatorTarget] = Indicator(IndicatorStyle::StraightBox, colourIME); } ScintillaWin::~ScintillaWin() { diff --git a/src/eu_api.c b/src/eu_api.c index 647db2c5..499c2043 100644 --- a/src/eu_api.c +++ b/src/eu_api.c @@ -1531,10 +1531,9 @@ eu_utf16_utf8(const wchar_t *utf16, size_t *out_len) { int m, size = 0; char *utf8 = NULL; - - size = WideCharToMultiByte(CP_UTF8, 0, utf16, -1, NULL, 0, NULL, NULL); + size = utf16 ? WideCharToMultiByte(CP_UTF8, 0, utf16, -1, NULL, 0, NULL, NULL) : 0; utf8 = size > 0 ? (char*) malloc(size+1) : 0; - if (NULL == utf8 ) + if (NULL == utf8) { return NULL; } @@ -1637,9 +1636,8 @@ eu_mbcs_utf8(int codepage, const char *ansi, size_t *out_len) wchar_t* eu_utf8_utf16(const char *utf8, size_t *out_len) { - int size; wchar_t *u16 = NULL; - size = MultiByteToWideChar(CP_UTF8, 0, utf8, -1, NULL, 0); + int size = utf8 ? MultiByteToWideChar(CP_UTF8, 0, utf8, -1, NULL, 0) : 0; u16 = size > 0 ? (wchar_t*) malloc(sizeof(wchar_t) * (size + 1)) : 0; if (!u16) { @@ -1695,8 +1693,7 @@ eu_config_ptr(struct eu_config *pconfig) { return false; } - g_config = (struct eu_config *)malloc(sizeof(struct eu_config)); - if (g_config) + if ((g_config = (struct eu_config *)malloc(sizeof(struct eu_config)))) { memcpy(g_config, pconfig, sizeof(struct eu_config)); } @@ -1704,28 +1701,22 @@ eu_config_ptr(struct eu_config *pconfig) } bool -eu_theme_ptr(struct eu_theme *ptheme, bool init) +eu_theme_ptr(struct eu_theme *ptheme) { + struct eu_theme *psave = NULL; if (!ptheme) { return false; } - if (!init) + if (g_theme) { - if (g_theme) - { - free(g_theme); - } - g_theme = ptheme; + psave = g_theme; } - else + if ((g_theme = (struct eu_theme *)malloc(sizeof(struct eu_theme)))) { - g_theme = (struct eu_theme *)malloc(sizeof(struct eu_theme)); - if (g_theme) - { - memcpy(g_theme, ptheme, sizeof(struct eu_theme)); - } + memcpy(g_theme, ptheme, sizeof(struct eu_theme)); } + eu_safe_free(psave); return g_theme != NULL; } @@ -1768,8 +1759,7 @@ eu_toolbar_ptr(eue_toolbar *pdata, int num) { return false; } - g_toolbar = (eue_toolbar *)malloc(sizeof(eue_toolbar) * num); - if (g_toolbar) + if ((g_toolbar = (eue_toolbar *)malloc(sizeof(eue_toolbar) * num))) { memcpy(g_toolbar, pdata, sizeof(eue_toolbar) * num); } diff --git a/src/eu_api.h b/src/eu_api.h index 1e517593..5c63e22f 100644 --- a/src/eu_api.h +++ b/src/eu_api.h @@ -608,7 +608,7 @@ EU_EXT_CLASS wchar_t *eu_utf8_utf16(const char *utf8, size_t *out_len); EU_EXT_CLASS char *eu_utf8_mbcs(int codepage, const char *utf8, size_t *out_len); EU_EXT_CLASS void eu_setpos_window(HWND, HWND, int,int, int, int, uint32_t); EU_EXT_CLASS bool eu_config_ptr(struct eu_config *pconfig); -EU_EXT_CLASS bool eu_theme_ptr(struct eu_theme *ptheme, bool init); +EU_EXT_CLASS bool eu_theme_ptr(struct eu_theme *ptheme); EU_EXT_CLASS bool eu_accel_ptr(ACCEL *accel); EU_EXT_CLASS bool eu_toolbar_ptr(eue_toolbar *pdata, int num); EU_EXT_CLASS HANDLE eu_new_process(LPCTSTR wcmd, LPCTSTR param, LPCTSTR pcd, int flags, uint32_t *o); @@ -849,6 +849,7 @@ EU_EXT_CLASS int on_doc_json_like(eu_tabpage *pnode, ptr_notify lpnotify); EU_EXT_CLASS int on_doc_makefile_like(eu_tabpage *pnode, ptr_notify lpnotify); EU_EXT_CLASS int on_doc_cmake_like(eu_tabpage *pnode, ptr_notify lpnotify); EU_EXT_CLASS int on_doc_text_like(eu_tabpage *pnode, ptr_notify lpnotify); +EU_EXT_CLASS int on_doc_general_like(eu_tabpage *pnode, ptr_notify lpnotify); /* 默认的 reload_list_ptr,reload_tree_ptr 回调函数入口 */ EU_EXT_CLASS int on_doc_reload_list_reqular(eu_tabpage *pnode); diff --git a/src/eu_doctype.c b/src/eu_doctype.c index 5ae8628c..7ee3943d 100644 --- a/src/eu_doctype.c +++ b/src/eu_doctype.c @@ -30,6 +30,12 @@ on_doc_enable_foldline(eu_tabpage *pnode) { switch (pnode->doc_ptr->doc_type) { + case DOCTYPE_CPP: + { // Disable track preprocessor to avoid incorrect detection. + // In the most of cases, the symbols are defined outside of file. + eu_sci_call(pnode, SCI_SETPROPERTY, (WPARAM)("lexer.cpp.track.preprocessor"), (sptr_t)"0"); + break; + } case DOCTYPE_XML: eu_sci_call(pnode, SCI_SETPROPERTY, (sptr_t) "lexer.xml.allow.scripts", (sptr_t)"0"); eu_sci_call(pnode, SCI_SETPROPERTY, (sptr_t) "fold.xml.at.tag.open", (sptr_t)"1"); @@ -51,6 +57,9 @@ on_doc_enable_foldline(eu_tabpage *pnode) case DOCTYPE_PASCAL: eu_sci_call(pnode, SCI_SETPROPERTY, (sptr_t) "lexer.pascal.smart.highlighting", (sptr_t)"1"); break; + case DOCTYPE_NSIS: + eu_sci_call(pnode, SCI_SETPROPERTY, (sptr_t) "nsis.uservars", (sptr_t)"1"); + break; default: break; } @@ -172,7 +181,7 @@ on_doc_set_keyword(eu_tabpage *pnode) } bool -on_doc_is_customized(eu_tabpage *pnode, int lex) +on_doc_is_customized(const eu_tabpage *pnode, const int lex) { if (pnode && pnode->doc_ptr && pnode->doc_ptr->style.mask > 0) { @@ -629,9 +638,6 @@ int on_doc_init_after_cpp(eu_tabpage *pnode) { on_doc_key_scilexer(pnode, "cpp"); - // Disable track preprocessor to avoid incorrect detection. - // In the most of cases, the symbols are defined outside of file. - eu_sci_call(pnode, SCI_SETPROPERTY, (WPARAM)("lexer.cpp.track.preprocessor"), (LPARAM)"0"); on_doc_keyword_light(pnode, SCE_C_WORD, 0, 0); on_doc_function_light(pnode, SCE_C_WORD2, 1, 0); on_doc_string_light(pnode, SCE_C_STRING, 0); @@ -845,10 +851,6 @@ on_doc_get_ext(eu_tabpage *pnode) int on_doc_init_after_shell_sh(eu_tabpage *pnode) { - if (!pnode) - { - return 1; - } TCHAR *sp = on_doc_get_ext(pnode); if (sp && _tcsstr(_T(";*.bat;*.cmd;*.nt;"), sp)) { @@ -1053,6 +1055,7 @@ on_doc_init_after_html(eu_tabpage *pnode) on_doc_commentblock_light(pnode, SCE_HPHP_COMMENT, 0); on_doc_string_light(pnode, SCE_HPHP_SIMPLESTRING, 0); on_doc_enable_foldline(pnode); + on_doc_enable_regexp(pnode); return 0; } @@ -1071,6 +1074,7 @@ on_doc_init_after_css(eu_tabpage *pnode) on_doc_keyword_light(pnode, SCE_CSS_UNKNOWN_IDENTIFIER, 4, 0); on_doc_keyword_light(pnode, SCE_CSS_VALUE, 4, 0); on_doc_enable_foldline(pnode); + on_doc_enable_regexp(pnode); return 0; } @@ -1150,6 +1154,7 @@ on_doc_init_after_yaml(eu_tabpage *pnode) on_doc_operator_light(pnode, SCE_YAML_OPERATOR, 0); on_doc_commentblock_light(pnode, SCE_YAML_COMMENT, 0); on_doc_enable_foldline(pnode); + on_doc_enable_regexp(pnode); return 0; } @@ -1164,6 +1169,7 @@ on_doc_init_after_makefile(eu_tabpage *pnode) on_doc_tags_light(pnode, SCE_MAKE_TARGET, 0); // 折叠 on_doc_enable_foldline(pnode); + on_doc_enable_regexp(pnode); return 0; } @@ -1198,6 +1204,7 @@ on_doc_init_after_cmake(eu_tabpage *pnode) on_doc_number_light(pnode, SCE_CMAKE_NUMBER, 0); on_doc_commentblock_light(pnode, SCE_CMAKE_COMMENT, 0); on_doc_enable_foldline(pnode); + on_doc_enable_regexp(pnode); return 0; } @@ -1211,6 +1218,8 @@ on_doc_init_after_log(eu_tabpage *pnode) on_doc_operator_light(pnode, SCE_STTXT_OPERATOR, 0xff); on_doc_comment_light(pnode, SCE_STTXT_COMMENT, 0); on_doc_commentblock_light(pnode, SCE_STTXT_COMMENTLINE, 0); + on_doc_enable_foldline(pnode); + on_doc_enable_regexp(pnode); return 0; } @@ -1224,6 +1233,8 @@ on_doc_init_after_properties(eu_tabpage *pnode) on_doc_string_light(pnode, SCE_PROPS_SECTION, 0); on_doc_operator_light(pnode, SCE_PROPS_ASSIGNMENT, 0); on_doc_preprocessor_light(pnode, SCE_PROPS_DEFVAL, -1, 0); + on_doc_enable_foldline(pnode); + on_doc_enable_regexp(pnode); return 0; } @@ -1645,6 +1656,12 @@ on_doc_cmake_like(eu_tabpage *pnode, ptr_notify lpnotify) return on_doc_css_like(pnode, lpnotify); } +int +on_doc_general_like(eu_tabpage *pnode, ptr_notify lpnotify) +{ + return on_doc_css_like(pnode, lpnotify); +} + int on_doc_text_like(eu_tabpage *pnode, ptr_notify lpnotify) { @@ -1974,6 +1991,65 @@ on_doc_ptr_free(void) do_lua_parser_release(); } +bool +eu_doc_special_font(const eu_tabpage *pnode) +{ + bool ret = false; + if (pnode && pnode->doc_ptr) + { + if (STR_NOT_NUL(pnode->doc_ptr->font_list.font0) && util_font_available(pnode->doc_ptr->font_list.font0)) + { + ret = true; + } + else if (STR_NOT_NUL(pnode->doc_ptr->font_list.font1) && util_font_available(pnode->doc_ptr->font_list.font1)) + { + ret = true; + } + else if (STR_NOT_NUL(pnode->doc_ptr->font_list.font2) && util_font_available(pnode->doc_ptr->font_list.font2)) + { + ret = true; + } + } + return ret; +} + +sptr_t +eu_doc_get_font_size(const eu_tabpage *pnode) +{ + if (pnode && pnode->doc_ptr) + { + if (pnode->doc_ptr->font_list.size > 0) + { + return (sptr_t)(pnode->doc_ptr->font_list.size); + } + } + return (sptr_t)(eu_get_theme()->item.text.fontsize); +} + +sptr_t +eu_doc_get_font_name(const eu_tabpage *pnode) +{ + if (pnode && pnode->doc_ptr) + { + if (STR_NOT_NUL(pnode->doc_ptr->font_list.font0) && util_font_available(pnode->doc_ptr->font_list.font0)) + { + eu_logmsg("we apply [%s] font\n", pnode->doc_ptr->font_list.font0); + return (sptr_t)(pnode->doc_ptr->font_list.font0); + } + if (STR_NOT_NUL(pnode->doc_ptr->font_list.font1) && util_font_available(pnode->doc_ptr->font_list.font1)) + { + eu_logmsg("we apply [%s] font\n", pnode->doc_ptr->font_list.font1); + return (sptr_t)(pnode->doc_ptr->font_list.font1); + } + if (STR_NOT_NUL(pnode->doc_ptr->font_list.font2) && util_font_available(pnode->doc_ptr->font_list.font2)) + { + eu_logmsg("we apply [%s] font\n", pnode->doc_ptr->font_list.font2); + return (sptr_t)(pnode->doc_ptr->font_list.font2); + } + } + return (sptr_t)(eu_get_theme()->item.text.font); +} + doctype_t* eu_doc_get_ptr(void) { diff --git a/src/eu_doctype.h b/src/eu_doctype.h index 99300d0e..5b8b2116 100644 --- a/src/eu_doctype.h +++ b/src/eu_doctype.h @@ -84,7 +84,9 @@ enum dctype DOCTYPE_LATEX = 40, DOCTYPE_VERILOG = 41, DOCTYPE_PASCAL = 42, - DOCTYPE_TCL = 43 + DOCTYPE_TCL = 43, + DOCTYPE_INNO = 44, + DOCTYPE_NSIS = 45 }; typedef struct _doc_styles @@ -102,6 +104,14 @@ typedef struct _doc_comments bool initialized; } doc_comments; +typedef struct _doc_fonts +{ + const char *font0; + const char *font1; + const char *font2; + int size; +} doc_fonts; + typedef struct _doc_data { enum dctype doc_type; // 文档类型编号 @@ -133,6 +143,7 @@ typedef struct _doc_data eutype_t ctshow_tree; // 函数提示hash表 doc_styles style; // 文档关键字类型与高亮颜色, 最多支持32类 doc_comments comment; // 文档注释 + doc_fonts font_list; // 文档字体 } doctype_t; int on_doc_count(void); @@ -140,9 +151,12 @@ int on_doc_brace_light(eu_tabpage *pnode, bool keyup); void on_doc_set_vec(void); void on_doc_set_ptr(doctype_t *ptr); void on_doc_ptr_free(void); -bool on_doc_is_customized(eu_tabpage *pnode, int lex); +bool on_doc_is_customized(const eu_tabpage *pnode, const int lex); +bool eu_doc_special_font(const eu_tabpage *pnode); TCHAR *on_doc_get_ext(eu_tabpage *pnode); doctype_t *on_doc_get_type(const TCHAR *pfile); +sptr_t eu_doc_get_font_size(const eu_tabpage *pnode); +sptr_t eu_doc_get_font_name(const eu_tabpage *pnode); #ifdef __cplusplus } diff --git a/src/eu_edit.c b/src/eu_edit.c index 3b11b35f..334e5c7e 100644 --- a/src/eu_edit.c +++ b/src/eu_edit.c @@ -22,6 +22,9 @@ #define EOLS_UNDO_DESC "_eol/?@#$%^&*()`/~" #define ICON_UNDO_DESC "_iconv/?@#$%^&*()`/~" +// see LexInno.cxx +#define INNOLINESTATECODESECTION (0x1) + enum htmlblock { HTML_TEXT_BLOCK_TAG = 0, @@ -1924,6 +1927,7 @@ on_edit_comment_line(eu_tabpage *pnode) break; case DOCTYPE_LISP: case DOCTYPE_AU3: + case DOCTYPE_NSIS: eu_toggle_comment(pnode, "; ", false); break; case DOCTYPE_FORTRAN: @@ -1948,6 +1952,20 @@ on_edit_comment_line(eu_tabpage *pnode) } break; } + case DOCTYPE_INNO: + { + const sptr_t line = eu_sci_call(pnode, SCI_LINEFROMPOSITION, eu_sci_call(pnode, SCI_GETSELECTIONSTART, 0, 0), 0); + const int state = (const int)eu_sci_call(pnode, SCI_GETLINESTATE, line, 0); + if (state & INNOLINESTATECODESECTION) + { + eu_toggle_comment(pnode, "// ", false); + } + else + { + eu_toggle_comment(pnode, "; ", false); + } + break; + } default: break; } @@ -1984,6 +2002,7 @@ on_edit_comment_stream(eu_tabpage *pnode) case DOCTYPE_SQL: case DOCTYPE_KOTLIN: case DOCTYPE_VERILOG: + case DOCTYPE_NSIS: on_close_selection(pnode, "/*", "*/"); break; case DOCTYPE_CMAKE: @@ -2037,6 +2056,20 @@ on_edit_comment_stream(eu_tabpage *pnode) } break; } + case DOCTYPE_INNO: + { + const sptr_t line = eu_sci_call(pnode, SCI_LINEFROMPOSITION, eu_sci_call(pnode, SCI_GETSELECTIONSTART, 0, 0), 0); + const int state = (const int)eu_sci_call(pnode, SCI_GETLINESTATE, line, 0); + if (state & INNOLINESTATECODESECTION) + { + on_close_selection(pnode, "{ ", " }"); + } + else + { + eu_toggle_comment(pnode, "; ", false); + } + break; + } case DOCTYPE_AU3: on_comment_newline(pnode, "#cs", "#ce"); break; diff --git a/src/eu_menu.c b/src/eu_menu.c index ab884253..b9e7e770 100644 --- a/src/eu_menu.c +++ b/src/eu_menu.c @@ -384,21 +384,27 @@ menu_update_string(const HMENU hmenu, const int pos) return id; } -bool -menu_setup(HWND hwnd) +static unsigned __stdcall +menu_setup_thead(void* lp) { - if (eu_get_config() && SetMenu(hwnd, i18n_load_menu(IDC_SKYLARK))) + HWND hwnd = (HWND)lp; + if (hwnd && SetMenu(hwnd, i18n_load_menu(IDC_SKYLARK))) { HMENU root_menu = GetMenu(hwnd); HMENU setting_menu = root_menu ? GetSubMenu(root_menu, THEME_MENU) : NULL; setting_menu ? on_setting_update_menu(setting_menu) : (void)0; - if (!eu_get_config()->m_menubar) + if (eu_get_config() && !eu_get_config()->m_menubar) { SetMenu(hwnd, NULL); } - return true; } - return false; + return 0; +} + +void +menu_setup(HWND hwnd) +{ + CloseHandle((HANDLE) _beginthreadex(NULL, 0, menu_setup_thead, (void *)hwnd, 0, NULL)); } void @@ -634,7 +640,7 @@ menu_update_item(const HMENU menu, const bool init) menu_switch_theme(); if (!init) { // 盾牌图标 - menu_shield_icons(menu, IDM_ENV_FILE_POPUPMENU, IDM_ENV_SET_ASSOCIATED_WITH); + menu_shield_icons(menu, IDM_ENV_SET_ASSOCIATED_WITH, IDM_ENV_SET_ASSOCIATED_WITH); // 定制命令图标 menu_setting_icons(menu); // 定制命令菜单更新 diff --git a/src/eu_menu.h b/src/eu_menu.h index d5830658..b350ac93 100644 --- a/src/eu_menu.h +++ b/src/eu_menu.h @@ -51,7 +51,7 @@ void menu_switch_theme(void); void menu_destroy(const HWND hwnd); void menu_bmp_destroy(void); void menu_update_item(const HMENU menu, const bool init); -bool menu_setup(HWND hwnd); +void menu_setup(HWND hwnd); HMENU menu_load(const uint16_t mid); #ifdef __cplusplus diff --git a/src/eu_proc.c b/src/eu_proc.c index b321cbec..55949342 100644 --- a/src/eu_proc.c +++ b/src/eu_proc.c @@ -25,11 +25,11 @@ typedef UINT (WINAPI* GetDpiForWindowPtr)(HWND hwnd); typedef BOOL(WINAPI *AdjustWindowRectExForDpiPtr)(LPRECT lpRect, DWORD dwStyle, BOOL bMenu, DWORD dwExStyle, UINT dpi); -static HWND g_hwndmain; // 主窗口句柄 -volatile long g_interval_count = 0; // 启动自动更新的时间间隔 +static HWND g_hwndmain; // 主窗口句柄 +static volatile long g_interval_count = 0; // 启动自动更新的时间间隔 static int -on_create_window(HWND hwnd) +on_proc_create_widgets(HWND hwnd) { if (on_treebar_create_dlg(hwnd)) { @@ -45,7 +45,7 @@ on_create_window(HWND hwnd) } static int CALLBACK -enum_skylark_proc(HWND hwnd, LPARAM lParam) +on_proc_enum_skylark(HWND hwnd, LPARAM lParam) { if (IsWindowVisible(hwnd)) { @@ -81,7 +81,7 @@ on_proc_send_notify(void) { if (g_hwndmain == share_envent_get_hwnd()) { - if (!EnumWindows(enum_skylark_proc, 0) && GetLastError() == ERROR_CALLBACK_ABORT) + if (!EnumWindows(on_proc_enum_skylark, 0) && GetLastError() == ERROR_CALLBACK_ABORT) { if (eu_get_config()->upgrade.flags == VERSION_UPDATE_COMPLETED) { @@ -92,7 +92,7 @@ on_proc_send_notify(void) } static void -on_destory_window(HWND hwnd) +on_proc_destory_window(HWND hwnd) { // 保存主窗口位置 util_save_placement(hwnd); @@ -117,7 +117,7 @@ on_destory_window(HWND hwnd) } static bool -adjust_window_rect_dpi(LPRECT lpRect, DWORD dwStyle, DWORD dwExStyle, UINT dpi) +on_proc_adjust_dpi(LPRECT lpRect, DWORD dwStyle, DWORD dwExStyle, UINT dpi) { AdjustWindowRectExForDpiPtr fnAdjustWindowRectExForDpi = NULL; HMODULE user32 = GetModuleHandle(_T("user32.dll")); @@ -133,7 +133,7 @@ adjust_window_rect_dpi(LPRECT lpRect, DWORD dwStyle, DWORD dwExStyle, UINT dpi) * 在admin模式下启用拖放 ****************************************************************************/ static void -do_drop_fix(void) +on_proc_drop_fix(void) { typedef BOOL(WINAPI *ChangeWindowMessageFilterPtr)(UINT message, DWORD flag); ChangeWindowMessageFilterPtr fnChangeWindowMessageFilter = NULL; @@ -151,92 +151,11 @@ do_drop_fix(void) } } -HWND -eu_module_hwnd(void) -{ - return (g_hwndmain ? g_hwndmain : share_envent_get_hwnd()); -} - -HWND -eu_hwnd_self(void) -{ - return (g_hwndmain); -} - -uint32_t -eu_get_dpi(HWND hwnd) -{ - uint32_t dpi = 0; - GetDpiForWindowPtr fnGetDpiForWindow = NULL; - HMODULE user32 = GetModuleHandle(_T("user32.dll")); - if (user32) - { // PMv2, 使用GetDpiForWindow获取dpi - fnGetDpiForWindow = (GetDpiForWindowPtr)GetProcAddress(user32, "GetDpiForWindow"); - if (fnGetDpiForWindow && (dpi = fnGetDpiForWindow(hwnd ? hwnd : g_hwndmain)) > 0) - { - return dpi; - } - } - if (!dpi) - { // PMv1或Win7系统, 使用GetDeviceCaps获取dpi - HDC screen = GetDC(hwnd ? hwnd : g_hwndmain); - int x = GetDeviceCaps(screen,LOGPIXELSX); - int y = GetDeviceCaps(screen,LOGPIXELSY); - ReleaseDC(hwnd ? hwnd : g_hwndmain, screen); - dpi = (uint32_t)((x + y)/2); - } - return dpi; -} - -void -eu_window_layout_dpi(HWND hwnd, const RECT *pnew_rect, const uint32_t adpi) -{ - const uint32_t flags = SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED; - if (pnew_rect) - { - SetWindowPos(hwnd, NULL, pnew_rect->left, pnew_rect->top, - (pnew_rect->right - pnew_rect->left), (pnew_rect->bottom - pnew_rect->top), flags); - } - else - { - RECT rc = {0}; - GetWindowRect(hwnd, &rc); - const uint32_t dpi = adpi ? adpi : eu_get_dpi(hwnd); - adjust_window_rect_dpi((LPRECT)&rc, flags, 0, dpi); - SetWindowPos(hwnd, NULL, rc.left, rc.top, (rc.right - rc.left), (rc.bottom - rc.top), flags); - } - RedrawWindow(hwnd, NULL, NULL, RDW_FRAME | RDW_INVALIDATE | RDW_ERASE | RDW_INTERNALPAINT | RDW_ALLCHILDREN | RDW_UPDATENOW); -} - -int -eu_dpi_scale_font(void) -{ - return eu_get_dpi(NULL) > USER_DEFAULT_SCREEN_DPI ? 0 : -11; -} - -int -eu_dpi_scale_style(int value, const int scale, const int min_value) -{ - value = (scale == USER_DEFAULT_SCREEN_DPI*100) ? value : MulDiv(value, scale, USER_DEFAULT_SCREEN_DPI*100); - return MAX(value, min_value); -} - -int -eu_dpi_scale_xy(int adpi, int m) -{ - int dpx = adpi ? adpi : eu_get_dpi(NULL); - if (dpx) - { - return MulDiv(m, dpx, USER_DEFAULT_SCREEN_DPI); - } - return m; -} - /***************************************************************************** * 菜单栏下面 1px 分割线位置 ****************************************************************************/ static void -get_menu_border_rect(HWND hwnd, LPRECT r) +on_proc_menu_border(HWND hwnd, LPRECT r) { RECT rc_window; POINT client_top = {0}; @@ -248,24 +167,10 @@ get_menu_border_rect(HWND hwnd, LPRECT r) r->bottom = client_top.y - rc_window.top; } -bool -eu_create_toolbar(HWND hwnd) -{ - return (on_toolbar_create(hwnd) == 0); -} - -bool -eu_create_statusbar(HWND hwnd) -{ - return on_statusbar_init(hwnd); -} - -void -eu_create_fullscreen(HWND hwnd) -{ - on_view_setfullscreenimpl(hwnd); -} - +/***************************************************************************** + * 文档结构图与软链接窗口互拆 + * 共用右侧边栏 +******************************************************************************/ static void on_proc_move_sidebar(eu_tabpage *pnode) { @@ -476,18 +381,6 @@ on_proc_msg_size(HWND hwnd, eu_tabpage *ptab) } } -void -on_proc_resize(HWND hwnd) -{ // 当在线程需要刷新界面时, 使用消息让主线程刷新 - SendMessage(hwnd ? hwnd : eu_module_hwnd(), WM_SIZE, 0, 0); -} - -void -eu_window_resize(HWND hwnd) -{ - on_proc_msg_size(hwnd ? hwnd : eu_module_hwnd(), NULL); -} - static void on_proc_tab_click(HWND hwnd, eu_tabpage *pnode) { @@ -505,47 +398,6 @@ on_proc_tab_click(HWND hwnd, eu_tabpage *pnode) } } -int -eu_before_proc(MSG *p_msg) -{ - eu_tabpage *pnode = NULL; - if (p_msg->message == WM_SYSKEYDOWN && p_msg->wParam == VK_MENU && !(p_msg->lParam & 0xff00)) - { - return 1; - } - if (p_msg->message == WM_SYSKEYDOWN && 0x31 <= p_msg->wParam && p_msg->wParam <= 0x39 && (p_msg->lParam & (1 << 29))) - { - on_tabpage_active_one((int) (p_msg->wParam) - 0x31); - return 1; - } - if((pnode = on_tabpage_focus_at()) && pnode && pnode->doc_ptr && !pnode->hex_mode && p_msg->message == WM_KEYDOWN && p_msg->hwnd == pnode->hwnd_sc) - { - bool main_up = KEY_UP(VK_CONTROL) && KEY_UP(VK_MENU) && KEY_UP(VK_INSERT); - bool main_down = KEY_DOWN(VK_CONTROL) && KEY_DOWN(VK_MENU) && KEY_DOWN(VK_INSERT) && KEY_DOWN(VK_SHIFT); - if (p_msg->wParam == VK_TAB && main_up && eu_get_config() && eu_get_config()->eu_complete.snippet) - { - if (main_up) - { - eu_sci_call(pnode, SCI_CANCEL, 0, 0); - if (KEY_DOWN(VK_SHIFT)) - { - return on_complete_snippet_back(pnode); - } - else if (on_complete_snippet(pnode)) - { - return 1; - } - } - } - else if (main_down && pnode->doc_ptr->doc_type == DOCTYPE_CPP) - { - on_sci_insert_egg(pnode); - return 1; - } - } - return 0; -} - static int on_proc_save_remote(eu_tabpage *pnode) { @@ -576,6 +428,10 @@ on_proc_save_remote(eu_tabpage *pnode) return ret; } +/***************************************************************************** + * 与 sumatrapdf 插件通信 + * 在文件修改或保存后, 修改标签栏状态 +******************************************************************************/ static void on_proc_save_status(WPARAM flags, npn_nmhdr *lpnmhdr) { @@ -679,8 +535,18 @@ on_proc_save_status(WPARAM flags, npn_nmhdr *lpnmhdr) } } -LRESULT CALLBACK -eu_main_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) +static unsigned __stdcall +on_proc_enable_drop(void* lp) +{ + if (on_reg_admin()) + { + on_proc_drop_fix(); + } + return 0; +} + +static LRESULT CALLBACK +on_proc_main_callback(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { NMHDR *lpnmhdr = NULL; ptr_notify lpnotify = NULL; @@ -709,7 +575,7 @@ eu_main_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) } return 1; case WM_CREATE: - if (on_create_window(hwnd)) + if (on_proc_create_widgets(hwnd)) { PostQuitMessage(0); } @@ -717,9 +583,9 @@ eu_main_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { PostQuitMessage(0); } - if (!menu_setup(hwnd)) + else { - PostQuitMessage(0); + menu_setup(hwnd); } if (eu_get_config()) { @@ -753,14 +619,14 @@ eu_main_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) else if (i == THEME_WHITE) { hdc = GetWindowDC(hwnd); - get_menu_border_rect(hwnd, &r); + on_proc_menu_border(hwnd, &r); FillRect(hdc, &r, (HBRUSH)on_dark_get_bgbrush()); } } else { hdc = GetWindowDC(hwnd); - get_menu_border_rect(hwnd, &r); + on_proc_menu_border(hwnd, &r); FillRect(hdc, &r, (HBRUSH)on_dark_get_bgbrush()); } if (hdc) @@ -2223,7 +2089,7 @@ eu_main_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) break; case WM_DESTROY: { - on_destory_window(hwnd); + on_proc_destory_window(hwnd); eu_logmsg("main window WM_DESTROY\n"); break; } @@ -2237,11 +2103,11 @@ eu_main_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) * 注册主窗口类 ****************************************************************************/ static ATOM -class_register(HINSTANCE instance) +on_proc_class_register(HINSTANCE instance) { WNDCLASSEX wcex = {sizeof(WNDCLASSEX)}; wcex.style = CS_BYTEALIGNWINDOW | CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW; - wcex.lpfnWndProc = eu_main_proc; + wcex.lpfnWndProc = on_proc_main_callback; wcex.hInstance = instance; wcex.hIconSm = wcex.hIcon = NULL; wcex.hCursor = LoadCursor(NULL, IDC_ARROW); @@ -2250,16 +2116,6 @@ class_register(HINSTANCE instance) return RegisterClassEx(&wcex); } -static unsigned __stdcall -do_calss_drop(void* lp) -{ - if (on_reg_admin()) - { - do_drop_fix(); - } - return 0; -} - void on_proc_sync_wait(void) { // 销毁定时器 @@ -2272,6 +2128,164 @@ on_proc_sync_wait(void) on_session_thread_wait(); } +void +on_proc_resize(HWND hwnd) +{ // 当在线程需要刷新界面时, 使用消息让主线程刷新 + SendMessage(hwnd ? hwnd : eu_module_hwnd(), WM_SIZE, 0, 0); +} + +void +on_proc_counter_stop(void) +{ + _InterlockedExchange(&g_interval_count, (EU_UPTIMES + 2)); +} + +HWND +eu_module_hwnd(void) +{ + return (g_hwndmain ? g_hwndmain : share_envent_get_hwnd()); +} + +HWND +eu_hwnd_self(void) +{ + return (g_hwndmain); +} + +uint32_t +eu_get_dpi(HWND hwnd) +{ + uint32_t dpi = 0; + GetDpiForWindowPtr fnGetDpiForWindow = NULL; + HMODULE user32 = GetModuleHandle(_T("user32.dll")); + if (user32) + { // PMv2, 使用GetDpiForWindow获取dpi + fnGetDpiForWindow = (GetDpiForWindowPtr)GetProcAddress(user32, "GetDpiForWindow"); + if (fnGetDpiForWindow && (dpi = fnGetDpiForWindow(hwnd ? hwnd : g_hwndmain)) > 0) + { + return dpi; + } + } + if (!dpi) + { // PMv1或Win7系统, 使用GetDeviceCaps获取dpi + HDC screen = GetDC(hwnd ? hwnd : g_hwndmain); + int x = GetDeviceCaps(screen,LOGPIXELSX); + int y = GetDeviceCaps(screen,LOGPIXELSY); + ReleaseDC(hwnd ? hwnd : g_hwndmain, screen); + dpi = (uint32_t)((x + y)/2); + } + return dpi; +} + +void +eu_window_layout_dpi(HWND hwnd, const RECT *pnew_rect, const uint32_t adpi) +{ + const uint32_t flags = SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED; + if (pnew_rect) + { + SetWindowPos(hwnd, NULL, pnew_rect->left, pnew_rect->top, + (pnew_rect->right - pnew_rect->left), (pnew_rect->bottom - pnew_rect->top), flags); + } + else + { + RECT rc = {0}; + GetWindowRect(hwnd, &rc); + const uint32_t dpi = adpi ? adpi : eu_get_dpi(hwnd); + on_proc_adjust_dpi((LPRECT)&rc, flags, 0, dpi); + SetWindowPos(hwnd, NULL, rc.left, rc.top, (rc.right - rc.left), (rc.bottom - rc.top), flags); + } + RedrawWindow(hwnd, NULL, NULL, RDW_FRAME | RDW_INVALIDATE | RDW_ERASE | RDW_INTERNALPAINT | RDW_ALLCHILDREN | RDW_UPDATENOW); +} + +int +eu_dpi_scale_font(void) +{ + return eu_get_dpi(NULL) > USER_DEFAULT_SCREEN_DPI ? 0 : -11; +} + +int +eu_dpi_scale_style(int value, const int scale, const int min_value) +{ + value = (scale == USER_DEFAULT_SCREEN_DPI*100) ? value : MulDiv(value, scale, USER_DEFAULT_SCREEN_DPI*100); + return MAX(value, min_value); +} + +int +eu_dpi_scale_xy(int adpi, int m) +{ + int dpx = adpi ? adpi : eu_get_dpi(NULL); + if (dpx) + { + return MulDiv(m, dpx, USER_DEFAULT_SCREEN_DPI); + } + return m; +} + +bool +eu_create_toolbar(HWND hwnd) +{ + return (on_toolbar_create(hwnd) == 0); +} + +bool +eu_create_statusbar(HWND hwnd) +{ + return on_statusbar_init(hwnd); +} + +void +eu_create_fullscreen(HWND hwnd) +{ + on_view_setfullscreenimpl(hwnd); +} + +void +eu_window_resize(HWND hwnd) +{ + on_proc_msg_size(hwnd ? hwnd : eu_module_hwnd(), NULL); +} + +int +eu_before_proc(MSG *p_msg) +{ + eu_tabpage *pnode = NULL; + if (p_msg->message == WM_SYSKEYDOWN && p_msg->wParam == VK_MENU && !(p_msg->lParam & 0xff00)) + { + return 1; + } + if (p_msg->message == WM_SYSKEYDOWN && 0x31 <= p_msg->wParam && p_msg->wParam <= 0x39 && (p_msg->lParam & (1 << 29))) + { + on_tabpage_active_one((int) (p_msg->wParam) - 0x31); + return 1; + } + if((pnode = on_tabpage_focus_at()) && pnode && pnode->doc_ptr && !pnode->hex_mode && p_msg->message == WM_KEYDOWN && p_msg->hwnd == pnode->hwnd_sc) + { + bool main_up = KEY_UP(VK_CONTROL) && KEY_UP(VK_MENU) && KEY_UP(VK_INSERT); + bool main_down = KEY_DOWN(VK_CONTROL) && KEY_DOWN(VK_MENU) && KEY_DOWN(VK_INSERT) && KEY_DOWN(VK_SHIFT); + if (p_msg->wParam == VK_TAB && main_up && eu_get_config() && eu_get_config()->eu_complete.snippet) + { + if (main_up) + { + eu_sci_call(pnode, SCI_CANCEL, 0, 0); + if (KEY_DOWN(VK_SHIFT)) + { + return on_complete_snippet_back(pnode); + } + else if (on_complete_snippet(pnode)) + { + return 1; + } + } + } + else if (main_down && pnode->doc_ptr->doc_type == DOCTYPE_CPP) + { + on_sci_insert_egg(pnode); + return 1; + } + } + return 0; +} + void eu_close_edit(void) { @@ -2281,8 +2295,8 @@ eu_close_edit(void) HWND eu_create_main_window(HINSTANCE instance) { - CloseHandle((HANDLE) _beginthreadex(NULL, 0, do_calss_drop, NULL, 0, NULL)); - if (class_register(instance)) + CloseHandle((HANDLE) _beginthreadex(NULL, 0, on_proc_enable_drop, NULL, 0, NULL)); + if (on_proc_class_register(instance)) { uint32_t ac_flags = WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN; INITCOMMONCONTROLSEX icex = {sizeof(INITCOMMONCONTROLSEX)}; diff --git a/src/eu_proc.h b/src/eu_proc.h index 35cf2c1d..d47651a2 100644 --- a/src/eu_proc.h +++ b/src/eu_proc.h @@ -29,18 +29,15 @@ extern "C" { #endif -extern volatile long g_interval_count; - -int eu_dpi_scale_font(void); -int eu_dpi_scale_style(int value, const int scale, const int min_value); -int eu_dpi_scale_xy(int adpi, int m); -void on_proc_destory_brush(void); +void on_proc_counter_stop(void); void on_proc_resize(HWND hwnd); void on_proc_sync_wait(void); void eu_window_resize(HWND hwnd); void eu_window_layout_dpi(HWND hwnd, const RECT *pnew_rect, const uint32_t adpi); HWND eu_hwnd_self(void); -LRESULT __stdcall eu_main_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); +int eu_dpi_scale_font(void); +int eu_dpi_scale_style(int value, const int scale, const int min_value); +int eu_dpi_scale_xy(int adpi, int m); #ifdef __cplusplus } diff --git a/src/eu_scintilla.c b/src/eu_scintilla.c index fb47945e..3262ac57 100644 --- a/src/eu_scintilla.c +++ b/src/eu_scintilla.c @@ -106,8 +106,8 @@ on_sci_default_fonts(eu_tabpage *pnode, const uint32_t bgcolor) if (pnode) { eu_sci_call(pnode, SCI_STYLERESETDEFAULT, 0, 0); - eu_sci_call(pnode, SCI_STYLESETFONT, STYLE_DEFAULT, (sptr_t)(eu_get_theme()->item.text.font)); - eu_sci_call(pnode, SCI_STYLESETSIZE, STYLE_DEFAULT, eu_get_theme()->item.text.fontsize); + eu_sci_call(pnode, SCI_STYLESETFONT, STYLE_DEFAULT, eu_doc_get_font_name(pnode)); + eu_sci_call(pnode, SCI_STYLESETSIZE, STYLE_DEFAULT, eu_doc_get_font_size(pnode)); eu_sci_call(pnode, SCI_STYLESETFORE, STYLE_DEFAULT, eu_get_theme()->item.text.color); eu_sci_call(pnode, SCI_STYLESETBACK, STYLE_DEFAULT, bgcolor != (uint32_t)-1 ? bgcolor : eu_get_theme()->item.text.bgcolor); eu_sci_call(pnode, SCI_STYLESETBOLD, STYLE_DEFAULT, eu_get_theme()->item.text.bold); diff --git a/src/eu_search.c b/src/eu_search.c index a3da5711..be7ab6e6 100644 --- a/src/eu_search.c +++ b/src/eu_search.c @@ -1819,18 +1819,18 @@ on_search_delete_lword(HWND hedit) } static char * -on_search_get_combo_list(HWND hcombo, int index) +on_search_get_combo_list(const HWND hcombo, const int index) { char *text = NULL; TCHAR *buf = NULL; const int len = (const int)ComboBox_GetLBTextLen(hcombo, index); buf = len > 0 ? (TCHAR *)calloc(sizeof(TCHAR), len + 1) : NULL; - if (STR_NOT_NUL(buf)) + if (buf) { ComboBox_GetLBText(hcombo, index, buf); text = eu_utf16_utf8(buf, NULL); + free(buf); } - eu_safe_free(buf); return text; } @@ -2986,13 +2986,14 @@ on_search_at_replace_page(eu_tabpage *pnode, int opt) eu_logmsg("%s: point error\n", __FUNCTION__); return false; } - if (opt & ON_REPLACE_SELECTION) + if (!replace_str && !(replace_str = _strdup(""))) { - end_pos = eu_sci_call(pnode, SCI_GETSELECTIONEND, 0, 0); + free(find_str); + return false; } - if (!replace_str) + if (opt & ON_REPLACE_SELECTION) { - replace_str = _strdup(""); + end_pos = eu_sci_call(pnode, SCI_GETSELECTIONEND, 0, 0); } on_search_node_init(pnode, false); if (on_search_first(pnode, find_str, opt)) @@ -3016,7 +3017,11 @@ on_search_at_replace_page(eu_tabpage *pnode, int opt) } while (!(opt & ON_REPLACE_THIS) && result && next_result); eu_sci_call(pnode, SCI_ENDUNDOACTION, 0, 0); } - if (*replace_str != 0) + if (*find_str) + { + eu_push_find_history(find_str); + } + if (*replace_str) { eu_push_replace_history(replace_str); } diff --git a/src/eu_statusbar.c b/src/eu_statusbar.c index d58228a7..23b915ec 100644 --- a/src/eu_statusbar.c +++ b/src/eu_statusbar.c @@ -257,7 +257,7 @@ on_statusbar_create_button(HWND hstatus) } static void -on_statusbar_menu_check(HMENU hmenu, int first_id, int last_id, int id, int parts) +on_statusbar_menu_check(HMENU hmenu, const int first_id, const int last_id, int id, const int group_id, const int parts) { int len = 0; TCHAR buf[FILESIZE + 1] = {0xA554, 0x0020, 0}; @@ -267,11 +267,37 @@ on_statusbar_menu_check(HMENU hmenu, int first_id, int last_id, int id, int part } if ((len = GetMenuString(hmenu, id, &buf[2], FILESIZE-2, MF_BYCOMMAND)) > 0) { - for (int i = IDM_UNI_UTF8; hmenu == g_menu_code && i <= IDM_UNKNOWN; ++i) + if (STATUSBAR_DOC_ENC == parts) { - CheckMenuItem(hmenu, i, MF_BYCOMMAND | MFS_UNCHECKED); + for (int i = IDM_UNI_UTF8; hmenu == g_menu_code && i <= IDM_UNKNOWN; ++i) + { + CheckMenuItem(hmenu, i, MF_BYCOMMAND | MFS_UNCHECKED); + } + if (group_id >= 0 && group_id <= 5) + { + CheckMenuRadioItem(hmenu, 0, 5, group_id, MF_BYPOSITION); + } } - if (buf[2] && CheckMenuRadioItem(hmenu, first_id, last_id, id, MF_BYCOMMAND)) + if (STATUSBAR_DOC_TYPE == parts) + { + int ch = 0; + HMENU htype = NULL; + for (int i = IDM_TYPES_0; hmenu == g_menu_type && i <= IDM_TYPES_Z; ++i) + { + CheckMenuItem(hmenu, i, MF_BYCOMMAND | MFS_UNCHECKED); + } + if (IDM_TYPES_0 == id && CheckMenuRadioItem(hmenu, IDM_TYPES_0, IDM_TYPES_0, IDM_TYPES_0, MF_BYCOMMAND)) + { + on_statusbar_set_text(g_statusbar, parts, buf); + } + else if (((ch = towupper(buf[2])) > 0x40 && ch < 0x5B) && (htype = GetSubMenu(hmenu, ch - 0x40))) + { // A_Z, 通过首字母获取父菜单位置索引 + CheckMenuRadioItem(hmenu, IDM_TYPES_A, IDM_TYPES_Z, IDM_TYPES_ZERO + ch - 0x40, MF_BYCOMMAND); + CheckMenuRadioItem(htype, first_id, last_id, id, MF_BYCOMMAND); + on_statusbar_set_text(g_statusbar, parts, buf); + } + } + else if (buf[2] && CheckMenuRadioItem(hmenu, first_id, last_id, id, MF_BYCOMMAND)) { on_statusbar_set_text(g_statusbar, parts, buf); } @@ -487,7 +513,7 @@ on_statusbar_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam, UINT_PT { if (on_view_switch_type(id_menu - IDM_TYPES_0 - 1) == 0) { - on_statusbar_menu_check(g_menu_type, IDM_TYPES_0, IDM_TYPES_0 + VIEW_FILETYPE_MAXCOUNT-1, id_menu, STATUSBAR_DOC_TYPE); + on_statusbar_menu_check(g_menu_type, IDM_TYPES_0, IDM_TYPES_0 + VIEW_FILETYPE_MAXCOUNT-1, id_menu, -1, STATUSBAR_DOC_TYPE); } break; } @@ -511,7 +537,7 @@ on_statusbar_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam, UINT_PT { if (!on_edit_convert_eols(pnode, id_menu-IDM_LBREAK_1)) { - on_statusbar_menu_check(g_menu_break, IDM_LBREAK_1, IDM_LBREAK_3, id_menu, STATUSBAR_DOC_EOLS); + on_statusbar_menu_check(g_menu_break, IDM_LBREAK_1, IDM_LBREAK_3, id_menu, -1, STATUSBAR_DOC_EOLS); } break; } @@ -519,14 +545,14 @@ on_statusbar_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam, UINT_PT pnode->pre_len = 0; memset(pnode->pre_context, 0, sizeof(pnode->pre_context)); on_edit_convert_coding(pnode, IDM_UNI_UTF8); - on_statusbar_menu_check(g_menu_code, IDM_UNI_UTF8, IDM_UNI_UTF32BE, id_menu, STATUSBAR_DOC_ENC); + on_statusbar_menu_check(g_menu_code, IDM_UNI_UTF8, IDM_UNI_UTF32BE, id_menu, 0, STATUSBAR_DOC_ENC); break; case IDM_UNI_UTF8B: pnode->pre_len = 3; memset(pnode->pre_context, 0, sizeof(pnode->pre_context)); memcpy(pnode->pre_context, "\xEF\xBB\xBF", 3); on_edit_convert_coding(pnode, IDM_UNI_UTF8B); - on_statusbar_menu_check(g_menu_code, IDM_UNI_UTF8, IDM_UNI_UTF32BE, id_menu, STATUSBAR_DOC_ENC); + on_statusbar_menu_check(g_menu_code, IDM_UNI_UTF8, IDM_UNI_UTF32BE, id_menu, 0, STATUSBAR_DOC_ENC); break; case IDM_UNI_UTF16LE: case IDM_UNI_UTF16LEB: @@ -535,7 +561,7 @@ on_statusbar_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam, UINT_PT case IDM_UNI_UTF32BE: if (!on_statusbar_convert_coding(pnode, id_menu)) { - on_statusbar_menu_check(g_menu_code, IDM_UNI_UTF8, IDM_UNI_UTF32BE, id_menu, STATUSBAR_DOC_ENC); + on_statusbar_menu_check(g_menu_code, IDM_UNI_UTF8, IDM_UNI_UTF32BE, id_menu, 0, STATUSBAR_DOC_ENC); } break; case IDM_ANSI_1: @@ -554,7 +580,7 @@ on_statusbar_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam, UINT_PT case IDM_ANSI_14: if (!on_statusbar_convert_coding(pnode, id_menu)) { - on_statusbar_menu_check(g_menu_code, IDM_ANSI_1, IDM_ANSI_14, id_menu, STATUSBAR_DOC_ENC); + on_statusbar_menu_check(g_menu_code, IDM_ANSI_1, IDM_ANSI_14, id_menu, 1, STATUSBAR_DOC_ENC); } break; case IDM_ISO_1: @@ -578,7 +604,7 @@ on_statusbar_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam, UINT_PT case IDM_ISO_JP_MS: if (!on_statusbar_convert_coding(pnode, id_menu)) { - on_statusbar_menu_check(g_menu_code, IDM_ISO_1, IDM_ISO_JP_MS, id_menu, STATUSBAR_DOC_ENC); + on_statusbar_menu_check(g_menu_code, IDM_ISO_1, IDM_ISO_JP_MS, id_menu, 2, STATUSBAR_DOC_ENC); } break; case IDM_IBM_1: @@ -586,14 +612,14 @@ on_statusbar_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam, UINT_PT case IDM_IBM_3: if (!on_statusbar_convert_coding(pnode, id_menu)) { - on_statusbar_menu_check(g_menu_code, IDM_IBM_1, IDM_IBM_3, id_menu, STATUSBAR_DOC_ENC); + on_statusbar_menu_check(g_menu_code, IDM_IBM_1, IDM_IBM_3, id_menu, 3, STATUSBAR_DOC_ENC); } break; case IDM_EUC_1: case IDM_EUC_2: if (!on_statusbar_convert_coding(pnode, id_menu)) { - on_statusbar_menu_check(g_menu_code, IDM_EUC_1, IDM_EUC_2, id_menu, STATUSBAR_DOC_ENC); + on_statusbar_menu_check(g_menu_code, IDM_EUC_1, IDM_EUC_2, id_menu, 4, STATUSBAR_DOC_ENC); } break; case IDM_OTHER_HZ: @@ -605,7 +631,7 @@ on_statusbar_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam, UINT_PT case IDM_UNKNOWN: if (!on_statusbar_convert_coding(pnode, id_menu)) { - on_statusbar_menu_check(g_menu_code, IDM_OTHER_HZ, IDM_UNKNOWN, id_menu, STATUSBAR_DOC_ENC); + on_statusbar_menu_check(g_menu_code, IDM_OTHER_HZ, IDM_UNKNOWN, id_menu, 5, STATUSBAR_DOC_ENC); } break; default: @@ -648,14 +674,17 @@ on_statusbar_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam, UINT_PT if (g_menu_break) { DestroyMenu(g_menu_break); + g_menu_break = NULL; } if (g_menu_code) { DestroyMenu(g_menu_code); + g_menu_code = NULL; } if (g_menu_type) { DestroyMenu(g_menu_type); + g_menu_type = NULL; } DestroyWindow(GetDlgItem(hwnd, IDM_BTN_RW)); if (hfont_btn) @@ -795,13 +824,13 @@ on_statusbar_update_eol(eu_tabpage *pnode, const int eol) switch (eol >= 0 ? eol : (pnode->eol >= 0 ? pnode->eol : eu_sci_call(pnode, SCI_GETEOLMODE, 0, 0))) { case SC_EOL_CRLF: - on_statusbar_menu_check(g_menu_break, IDM_LBREAK_1, IDM_LBREAK_3, IDM_LBREAK_1, STATUSBAR_DOC_EOLS); + on_statusbar_menu_check(g_menu_break, IDM_LBREAK_1, IDM_LBREAK_3, IDM_LBREAK_1, -1, STATUSBAR_DOC_EOLS); break; case SC_EOL_CR: - on_statusbar_menu_check(g_menu_break, IDM_LBREAK_1, IDM_LBREAK_3, IDM_LBREAK_2, STATUSBAR_DOC_EOLS); + on_statusbar_menu_check(g_menu_break, IDM_LBREAK_1, IDM_LBREAK_3, IDM_LBREAK_2, -1, STATUSBAR_DOC_EOLS); break; case SC_EOL_LF: - on_statusbar_menu_check(g_menu_break, IDM_LBREAK_1, IDM_LBREAK_3, IDM_LBREAK_3, STATUSBAR_DOC_EOLS); + on_statusbar_menu_check(g_menu_break, IDM_LBREAK_1, IDM_LBREAK_3, IDM_LBREAK_3, -1, STATUSBAR_DOC_EOLS); break; default: break; @@ -824,14 +853,14 @@ on_statusbar_update_filetype_menu(eu_tabpage *pnode) { if (pnode->doc_ptr && (pnode->doc_ptr == doc_ptr)) { - on_statusbar_menu_check(g_menu_type, IDM_TYPES_0, IDM_TYPES_0 + VIEW_FILETYPE_MAXCOUNT-1, IDM_TYPES_0 + index, STATUSBAR_DOC_TYPE); + on_statusbar_menu_check(g_menu_type, IDM_TYPES_0, IDM_TYPES_0 + VIEW_FILETYPE_MAXCOUNT-1, IDM_TYPES_0 + index, -1, STATUSBAR_DOC_TYPE); res = true; } } } if (!(pnode && res)) { - on_statusbar_menu_check(g_menu_type, IDM_TYPES_0, IDM_TYPES_0 + VIEW_FILETYPE_MAXCOUNT-1, IDM_TYPES_0, STATUSBAR_DOC_TYPE); + on_statusbar_menu_check(g_menu_type, IDM_TYPES_0, IDM_TYPES_0 + VIEW_FILETYPE_MAXCOUNT-1, IDM_TYPES_0, -1, STATUSBAR_DOC_TYPE); } } @@ -861,7 +890,7 @@ on_statusbar_update_coding(eu_tabpage *pnode, const int res_id) case IDM_UNI_UTF16BEB: case IDM_UNI_UTF32LE: case IDM_UNI_UTF32BE: - on_statusbar_menu_check(g_menu_code, IDM_UNI_UTF8, IDM_UNI_UTF32BE, type, STATUSBAR_DOC_ENC); + on_statusbar_menu_check(g_menu_code, IDM_UNI_UTF8, IDM_UNI_UTF32BE, type, 0, STATUSBAR_DOC_ENC); break; case IDM_ANSI_1: case IDM_ANSI_2: @@ -877,7 +906,7 @@ on_statusbar_update_coding(eu_tabpage *pnode, const int res_id) case IDM_ANSI_12: case IDM_ANSI_13: case IDM_ANSI_14: - on_statusbar_menu_check(g_menu_code, IDM_ANSI_1, IDM_ANSI_14, type, STATUSBAR_DOC_ENC); + on_statusbar_menu_check(g_menu_code, IDM_ANSI_1, IDM_ANSI_14, type, 1, STATUSBAR_DOC_ENC); break; case IDM_ISO_1: case IDM_ISO_2: @@ -898,16 +927,16 @@ on_statusbar_update_coding(eu_tabpage *pnode, const int res_id) case IDM_ISO_JP_2: case IDM_ISO_JP_2004: case IDM_ISO_JP_MS: - on_statusbar_menu_check(g_menu_code, IDM_ISO_1, IDM_ISO_JP_MS, type, STATUSBAR_DOC_ENC); + on_statusbar_menu_check(g_menu_code, IDM_ISO_1, IDM_ISO_JP_MS, type, 2, STATUSBAR_DOC_ENC); break; case IDM_IBM_1: case IDM_IBM_2: case IDM_IBM_3: - on_statusbar_menu_check(g_menu_code, IDM_IBM_1, IDM_IBM_3, type, STATUSBAR_DOC_ENC); + on_statusbar_menu_check(g_menu_code, IDM_IBM_1, IDM_IBM_3, type, 3, STATUSBAR_DOC_ENC); break; case IDM_EUC_1: case IDM_EUC_2: - on_statusbar_menu_check(g_menu_code, IDM_EUC_1, IDM_EUC_2, type, STATUSBAR_DOC_ENC); + on_statusbar_menu_check(g_menu_code, IDM_EUC_1, IDM_EUC_2, type, 4, STATUSBAR_DOC_ENC); break; case IDM_OTHER_HZ: case IDM_OTHER_1: @@ -916,7 +945,7 @@ on_statusbar_update_coding(eu_tabpage *pnode, const int res_id) case IDM_OTHER_ANSI: case IDM_OTHER_BIN: case IDM_UNKNOWN: - on_statusbar_menu_check(g_menu_code, IDM_OTHER_HZ, IDM_UNKNOWN, type, STATUSBAR_DOC_ENC); + on_statusbar_menu_check(g_menu_code, IDM_OTHER_HZ, IDM_UNKNOWN, type, 5, STATUSBAR_DOC_ENC); break; default: break; @@ -929,13 +958,22 @@ on_statusbar_create_filetype_menu(void) if (g_menu_type) { int index; + int ch = 0; doctype_t *doc_ptr; + TCHAR *desc = NULL; + HMENU htype = NULL; for (index = 1, doc_ptr = eu_doc_get_ptr(); doc_ptr&&doc_ptr->doc_type; index++, doc_ptr++) { - TCHAR *desc = NULL; if ((desc = eu_utf8_utf16(doc_ptr->filedesc, NULL)) != NULL) { - AppendMenu(g_menu_type, MF_POPUP | MF_STRING, IDM_TYPES_0 + index, desc); + if (((ch = towupper(*desc)) > 0x40 && ch < 0x5B) && (htype = GetSubMenu(g_menu_type, ch - 0x40))) + { + if (GetMenuItemID(htype, 0) == IDM_TYPES_ZERO) + { + DeleteMenu(htype, 0, MF_BYPOSITION); + } + AppendMenu(htype, MF_POPUP | MF_STRING, IDM_TYPES_0 + index, desc); + } free(desc); } } diff --git a/src/eu_theme.c b/src/eu_theme.c index 12c8cec6..41b8a0d9 100644 --- a/src/eu_theme.c +++ b/src/eu_theme.c @@ -638,7 +638,7 @@ theme_release_handle(void) } static void -theme_show_balloon_tip(HWND hdlg, const int resid) +theme_show_balloon_tip(const HWND hdlg, const int resid) { TCHAR ptxt[MAX_PATH] = {0}; HWND hwnd_edit = GetDlgItem(hdlg, resid); @@ -669,13 +669,20 @@ theme_show_balloon_tip(HWND hdlg, const int resid) } static void -on_theme_set_tip(HWND hdlg, int res_id) +on_theme_set_tip(const HWND hdlg, const int res_id) { HWND stc = GetDlgItem(hdlg, res_id); - if (on_doc_is_customized(on_tabpage_focus_at(), -1) && stc) + eu_tabpage *pnode = on_tabpage_focus_at(); + bool fn_font = pnode ? eu_doc_special_font(pnode) : false; + if (stc && pnode && (fn_font || on_doc_is_customized(pnode, -1))) { - LOAD_I18N_RESSTR(IDS_THEME_TIPS, str); + HWND btn = NULL; + LOAD_I18N_RESSTR(fn_font ? IDS_THEME_TIPS1 : IDS_THEME_TIPS2, str); Static_SetText(stc, str); + if (fn_font && (btn = GetDlgItem(hdlg, IDC_SETFONT_TEXT_BTN))) + { + Button_Enable(btn, FALSE); + } } } @@ -1027,6 +1034,8 @@ theme_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) dlg_style.caret.color |= value; } memcpy(&(eu_get_theme()->item), &dlg_style, sizeof(struct styletheme)); + // 当前主题可能被修改, 立即保存 + eu_save_theme(); EndDialog(hdlg, LOWORD(wParam)); break; } diff --git a/src/eu_updatechecker.c b/src/eu_updatechecker.c index dd7512b7..c3abbd12 100644 --- a/src/eu_updatechecker.c +++ b/src/eu_updatechecker.c @@ -293,7 +293,7 @@ on_update_send_request(void *lp) { break; } - _InterlockedExchange(&g_interval_count, 602); + on_proc_counter_stop(); on_update_loop(on_update_download(dtag)); } else if (tag > 0) diff --git a/src/eu_util.c b/src/eu_util.c index 3dfc507a..50a0027e 100644 --- a/src/eu_util.c +++ b/src/eu_util.c @@ -3310,3 +3310,32 @@ util_strcat(uint8_t **dst, const char* pstr) } } } + +static int CALLBACK +util_font_fam_callback(const LOGFONT *plf, const TEXTMETRIC *ptm, DWORD ftype, LPARAM lparam) +{ + UNREFERENCED_PARAMETER(plf); + UNREFERENCED_PARAMETER(ptm); + UNREFERENCED_PARAMETER(ftype); + *((bool*)lparam) = true; + // 回调中止 + return 0; +} + +bool +util_font_available(const char *name) +{ + bool found = false; + wchar_t *pname = NULL; + if (STR_NOT_NUL(name) && (pname = eu_utf8_utf16(name, NULL))) + { + HDC hDC = GetDC(NULL); + LOGFONT lf = { 0 }; + lf.lfCharSet = DEFAULT_CHARSET; + wcsncpy(lf.lfFaceName, pname, LF_FACESIZE); + EnumFontFamiliesEx(hDC, &lf, util_font_fam_callback, (LPARAM)&found, 0); + ReleaseDC(NULL, hDC); + } + eu_safe_free(pname); + return found; +} diff --git a/src/eu_util.h b/src/eu_util.h index 139c05d5..66df4f4c 100644 --- a/src/eu_util.h +++ b/src/eu_util.h @@ -172,6 +172,7 @@ void util_update_env(eu_tabpage *pnode); bool util_product_name(LPCWSTR filepath, LPWSTR out_string, size_t len); bool util_file_access(LPCTSTR filename, uint32_t *pgranted); bool util_get_unix_file_name(LPCWSTR path, wchar_t *out, const int len); +bool util_font_available(const char *name); wchar_t* util_get_nt_file_name(LPCWSTR path); const uint32_t util_os_version(void); const TCHAR* util_path_ext(const TCHAR *path); diff --git a/src/targetver.h b/src/targetver.h index 5d142fd1..0a98a34c 100644 --- a/src/targetver.h +++ b/src/targetver.h @@ -30,7 +30,7 @@ // 定义版本信息 #define __EU_INFO_VERSION 4 #define __EU_INFO_VERSION_MINOR 0 -#define __EU_INFO_VERSION_PATCHLEVEL 6 +#define __EU_INFO_VERSION_PATCHLEVEL 7 #define __ORIGINAL_NAME TEXT("skylark.exe") #if !__EU_INFO_VERSION_PATCHLEVEL @@ -300,8 +300,35 @@ #define IDS_TOOLBAR_26 10206 #define IDS_TOOLBAR_27 10207 #define IDS_TOOLBAR_28 10208 -// file type +// language type #define IDM_TYPES_0 10300 +#define IDM_TYPES_ZERO 10409 +#define IDM_TYPES_A 10410 +#define IDM_TYPES_B 10411 +#define IDM_TYPES_C 10412 +#define IDM_TYPES_D 10413 +#define IDM_TYPES_E 10414 +#define IDM_TYPES_F 10415 +#define IDM_TYPES_G 10416 +#define IDM_TYPES_H 10417 +#define IDM_TYPES_I 10418 +#define IDM_TYPES_J 10419 +#define IDM_TYPES_K 10420 +#define IDM_TYPES_L 10421 +#define IDM_TYPES_M 10422 +#define IDM_TYPES_N 10423 +#define IDM_TYPES_O 10424 +#define IDM_TYPES_P 10425 +#define IDM_TYPES_Q 10426 +#define IDM_TYPES_R 10427 +#define IDM_TYPES_S 10428 +#define IDM_TYPES_T 10429 +#define IDM_TYPES_U 10430 +#define IDM_TYPES_V 10431 +#define IDM_TYPES_W 10432 +#define IDM_TYPES_X 10433 +#define IDM_TYPES_Y 10434 +#define IDM_TYPES_Z 10435 #define IDD_DIALOG_FC 20000 #define IDC_FC_STC1 20001 @@ -1066,6 +1093,7 @@ #define IDM_HEXVIEW_INS 42835 #define IDM_HEXVIEW_COPY_ADDR 42836 +#define IDS_THEME_TIPS1 42838 #define IDS_THEME_CARET_TIPS 42839 #define IDC_THEME_CARTETLINE_EDT 42840 #define IDC_THEME_INDICATOR_EDT 42841 @@ -1073,7 +1101,7 @@ #define IDC_THEME_INDICATOR_UDN 42845 #define IDS_THEME_EDIT_TIPS 42846 #define IDC_THEME_TIPS_STC 42847 -#define IDS_THEME_TIPS 42848 +#define IDS_THEME_TIPS2 42848 #define IDS_RE_ERROR 42849 #define IDM_SELECTION_RECTANGLE 42850 diff --git a/src/version_display.txt b/src/version_display.txt index d13e837c..43beb400 100644 --- a/src/version_display.txt +++ b/src/version_display.txt @@ -1 +1 @@ -4.0.6 +4.0.7