From 5aa0b2e55590245ff52d38c04ad1834934dd68c4 Mon Sep 17 00:00:00 2001 From: shmuz Date: Mon, 9 Sep 2024 18:04:10 +0300 Subject: [PATCH] Polygon 1.8.4 --- lua_share/far2/custommenu.lua | 4 ++-- lua_share/far2/simpledialog.lua | 8 ++++++-- plugins/polygon/build/define.lua | 2 +- plugins/polygon/doc/changelog.txt | 3 +++ plugins/polygon/modules/panel.lua | 5 ++++- plugins/polygon/polygon_lang.templ | 8 ++++++++ 6 files changed, 24 insertions(+), 6 deletions(-) diff --git a/lua_share/far2/custommenu.lua b/lua_share/far2/custommenu.lua index 30fdf22..5d333b9 100644 --- a/lua_share/far2/custommenu.lua +++ b/lua_share/far2/custommenu.lua @@ -373,7 +373,7 @@ end function List:MouseEvent (hDlg, Ev, x, y) if osWindows and Ev.EventFlags == F.MOUSE_WHEELED then - self:KeyMsWheel(Ev.ButtonState < 0x80000000 and "down" or "up") + self:KeyMsWheel(Ev.ButtonState < 0x80000000 and "up" or "down") SendRedrawMessage(hDlg) return end @@ -779,7 +779,7 @@ function List:KeyMsWheel (dir) local N = #self.drawitems if N > 0 then for k=1,2 do -- loop to skip a separator - if dir == "down" then + if dir == "up" then if self.sel==1 or self.sel==2 and self.drawitems[1].separator then break end diff --git a/lua_share/far2/simpledialog.lua b/lua_share/far2/simpledialog.lua index 7c30e42..41f2a93 100644 --- a/lua_share/far2/simpledialog.lua +++ b/lua_share/far2/simpledialog.lua @@ -36,14 +36,18 @@ function mod.OpenInEditor(text, ext) if OpSys == "windows" then tempdir = win.GetEnv("TEMP") if not tempdir then - far.Message("Environment variable TEMP is not set", "Error", nil, "w"); return nil + far.Message("Environment variable TEMP is not set", "Error", nil, "w") + return nil end else tempdir = far.InMyTemp() end + if tempdir:sub(-1) ~= DirSep then tempdir = tempdir..DirSep end + ext = type(ext)=="string" and ext or ".tmp" if ext~="" and ext:sub(1,1)~="." then ext = "."..ext; end - local fname = ("%s%sFar-%s%s"):format(tempdir, DirSep, win.Uuid(win.Uuid()):sub(1,8), ext) + + local fname = ("%sFar-%s%s"):format(tempdir, win.Uuid(win.Uuid()):sub(1,8), ext) local fp = io.open(fname, "wb") if fp then fp:write(text or "") diff --git a/plugins/polygon/build/define.lua b/plugins/polygon/build/define.lua index dd3034c..602c103 100644 --- a/plugins/polygon/build/define.lua +++ b/plugins/polygon/build/define.lua @@ -1,7 +1,7 @@ -- Definitions VER_MAJOR = "1" VER_MINOR = "8" -VER_MICRO = "3" +VER_MICRO = "4" -- Far >= 3.0.4364 required if -DRUN_LUAFAR_INIT is used -- Far >= 3.0.4401 required if more than 10 DB table columns must be supported diff --git a/plugins/polygon/doc/changelog.txt b/plugins/polygon/doc/changelog.txt index 0209f10..b0e659b 100644 --- a/plugins/polygon/doc/changelog.txt +++ b/plugins/polygon/doc/changelog.txt @@ -1,3 +1,6 @@ +2024-09-09, v.1.8.4 + 1. Added sort direction indicators (can be edited in LNG files). + 2024-06-09, v.1.8.3 1. Refactor to not depend on bit64 __tostring metamethod. diff --git a/plugins/polygon/modules/panel.lua b/plugins/polygon/modules/panel.lua index 6a2a728..385a7cc 100644 --- a/plugins/polygon/modules/panel.lua +++ b/plugins/polygon/modules/panel.lua @@ -869,6 +869,9 @@ function mypanel:prepare_panel_info(handle) self:FillKeyBar(info.key_bar, "db") ------------------------------------------------------------------------------------------------- else -- self._panel_mode == "table"/"view"/"query" + local pInfo = panel.GetPanelInfo(handle) + local sort_reverse = bit64.band(pInfo.Flags, F.PFLAGS_REVERSESORTORDER) ~= 0 + local sort_char = sort_reverse and M.sort_descend or M.sort_ascend local cur = self._tables[self._objname] local masks = self._col_masks_used[self._objname] and cur and cur.col_masks local show_affinity = self._panel_mode=="table" and self._show_affinity @@ -881,7 +884,7 @@ function mypanel:prepare_panel_info(handle) end col_types = col_types .. "C" .. (i-1) col_widths = col_widths .. width - local head = i == self._sort_col_index and "♦" or "" + local head = i == self._sort_col_index and sort_char or "" local tail = show_affinity and affinity_map[descr.affinity] or "" table.insert(col_titles, head..descr.name..tail) end diff --git a/plugins/polygon/polygon_lang.templ b/plugins/polygon/polygon_lang.templ index ec67cd4..df9244a 100644 --- a/plugins/polygon/polygon_lang.templ +++ b/plugins/polygon/polygon_lang.templ @@ -308,3 +308,11 @@ label_table_name label_column_name "Column" "Колонка" + +sort_ascend +"▲" +"▲" + +sort_descend +"▼" +"▼"