From 736649cb7e3d3183668cc589e61d166ef88c4c67 Mon Sep 17 00:00:00 2001 From: Ed Kashinsky Date: Thu, 25 Jul 2024 14:54:26 +0200 Subject: [PATCH] added light theme --- AI/ek_Generate SFX via ElevenLabs.lua | 56 +-- Core/ek_Core functions GUI.lua | 321 +++++++++++++++--- Core/ek_Core functions v1.lua | 2 +- Core/ek_Core functions.lua | 5 +- Core/ek_Global startup action - settings.lua | 6 +- Core/ek_Global startup action.lua | 4 +- Core/ek_Smart renaming functions.lua | 6 +- ...=> ek_Snap items to markers functions.lua} | 12 +- Items Editing/ek_Edge silence cropper.lua | 6 +- ...selected items at markers started from.lua | 118 ------- .../ek_Smart split items by mouse cursor.lua | 4 +- ...a => ek_Snap items to closest markers.lua} | 10 +- ...a => ek_Snap items to closest regions.lua} | 10 +- .../ek_Snap items to markers or regions.lua | 144 ++++++++ .../ek_Smart renaming depending on focus.lua | 32 +- 15 files changed, 508 insertions(+), 228 deletions(-) rename Core/{ek_Pin selected items functions.lua => ek_Snap items to markers functions.lua} (92%) delete mode 100644 Items Editing/ek_Pin selected items at markers started from.lua rename Items Editing/{ek_Pin selected items to closest regions.lua => ek_Snap items to closest markers.lua} (80%) rename Items Editing/{ek_Pin selected items to closest markers.lua => ek_Snap items to closest regions.lua} (80%) create mode 100644 Items Editing/ek_Snap items to markers or regions.lua diff --git a/AI/ek_Generate SFX via ElevenLabs.lua b/AI/ek_Generate SFX via ElevenLabs.lua index 1c72c8a..3d510d4 100644 --- a/AI/ek_Generate SFX via ElevenLabs.lua +++ b/AI/ek_Generate SFX via ElevenLabs.lua @@ -1,11 +1,11 @@ -- @description ek_Generate SFX via ElevenLabs --- @version 1.1.6 +-- @version 1.1.7 -- @author Ed Kashinsky -- @readme_skip -- @about -- Script uses ElevenLabs API to generate sound effects and inserts them into the project. -- @changelog --- Added small notice on error throw +-- UI updates function CoreFunctionsLoaded(script) local sep = (reaper.GetOS() == "Win64" or reaper.GetOS() == "Win32") and "\\" or "/" @@ -26,7 +26,7 @@ if not loaded then return end -GUI_ShowMainWindow(570, 0) +GUI_ShowMainWindow() local input_callback local settings_key = 'ai_elevenlabs_settings' @@ -129,6 +129,14 @@ local function SaveHistory() settings.history[#settings.history + 1] = data.prompt end +function GUI_DrawMenu(ImGui, ctx) + if ImGui.MenuItem(ctx, 'Settings') then + return function() + ImGui.OpenPopup(ctx, 'Settings') + end + end +end + function frame(ImGui, ctx, is_first_frame) local newVal local is_changed = false @@ -137,12 +145,8 @@ function frame(ImGui, ctx, is_first_frame) ImGui.OpenPopup(ctx, 'Settings') end - local center_x, center_y = ImGui.Viewport_GetCenter(ImGui.GetWindowViewport(ctx)) - ImGui.SetNextWindowSize(ctx, 480, 0) - ImGui.SetNextWindowPos(ctx, center_x, center_y, ImGui.Cond_Appearing(), 0.5, 0.5) - - if ImGui.BeginPopupModal(ctx, 'Settings', nil, ImGui.WindowFlags_NoResize()) then - GUI_DrawText("Script uses ElevenLabs API to generate sound effects and inserts them into the project.", GUI_GetFont(gui_font_types.Bold)) + GUI_DrawModalPopup('Settings', function() + GUI_DrawText("Script uses ElevenLabs API to generate sound effects and inserts them into the project.", gui_fonts.Bold) GUI_DrawLink("https://elevenlabs.io/") GUI_DrawGap(10) GUI_DrawText("Please enter your API-key to start working with the script. Authorize on website and go to Profile + API section") @@ -169,7 +173,7 @@ function frame(ImGui, ctx, is_first_frame) is_changed = true end - if ImGui.Button(ctx, 'Test request') then + GUI_DrawButton('Test request', function() ConsoleLog(EK_CurlRequest(CURL_POST, "https://api.elevenlabs.io/v1/sound-generation", { ["Content-Type"] = "application/json", ["xi-api-key"] = "123" @@ -178,23 +182,21 @@ function frame(ImGui, ctx, is_first_frame) })) ImGui.CloseCurrentPopup(ctx) settings.enable_console = true - end + end, gui_buttons_types.Action, true) GUI_DrawGap(10) - GUI_DrawText("Thanks to Tyoma Makeev in development of Python part and Konstantin Knerik for the script idea and support.", GUI_GetFont(gui_font_types.Italic)) + GUI_DrawText("Thanks to Tyoma Makeev in development of Python part and Konstantin Knerik for the script idea and support.", gui_fonts.Italic) GUI_DrawGap(10) ImGui.BeginDisabled(ctx, string.len(settings.api_key) == 0) - GUI_SetCursorCenter('Close') - if ImGui.Button(ctx, 'Close') then + GUI_SetCursorCenter(' Close ') + GUI_DrawButton('Close', function() ImGui.CloseCurrentPopup(ctx) - end + end, gui_buttons_types.Cancel, true) ImGui.EndDisabled(ctx) - - ImGui.EndPopup(ctx) - end + end) ImGui.BeginDisabled(ctx, data.is_waiting or string.len(settings.api_key) == 0) @@ -234,20 +236,13 @@ function frame(ImGui, ctx, is_first_frame) end GUI_SetFocusOnWidget() - ImGui.SetNextItemWidth(ctx, -58) - + ImGui.SetNextItemWidth(ctx, -FLT_MIN) _, newVal = ImGui.InputTextWithHint(ctx, "###Prompt", "Describe your sound effect and then click generate...", data.prompt, ImGui.InputTextFlags_CallbackHistory(), input_callback) if newVal ~= data.prompt then data.prompt = newVal end - ImGui.SameLine(ctx, nil, 4) - - if ImGui.Button(ctx, "Settings") then - ImGui.OpenPopup(ctx, 'Settings') - end - data.history_pos = ImGui.Function_GetValue(input_callback, 'HistoryPos') newVal = GUI_DrawInput(gui_input_types.NumberSlider, "Amount of variations", settings.amount, { number_min = 1, number_max = 10}) @@ -285,6 +280,8 @@ function frame(ImGui, ctx, is_first_frame) is_changed = true end + GUI_DrawGap(5) + GUI_DrawButton("Generate and import", function() if string.len(data.prompt) == 0 then ConsoleLog("[ERR] Please type some text for prompt.") @@ -317,8 +314,11 @@ function frame(ImGui, ctx, is_first_frame) local _, h = ImGui.Viewport_GetSize(ImGui.GetWindowViewport(ctx)) local is_collapsed = true + GUI_PushColor(ImGui.Col_Text(), gui_cols.Header.Text) + if ImGui.CollapsingHeader(ctx, "Console log") then - ImGui.PushStyleColor(ctx, ImGui.Col_ChildBg(), gui_colors.Input.Background) + ImGui.PopStyleColor(ctx) + GUI_PushColor(ImGui.Col_ChildBg(), gui_cols.Input.Background) if ImGui.BeginChild(ctx, "Console log", 0, h - y > 140 and 0 or 140) then local logMsgs = "" @@ -332,6 +332,8 @@ function frame(ImGui, ctx, is_first_frame) ImGui.PopStyleColor(ctx) is_collapsed = false + else + ImGui.PopStyleColor(ctx) end if settings.console_collapsed ~= is_collapsed then diff --git a/Core/ek_Core functions GUI.lua b/Core/ek_Core functions GUI.lua index fb50215..e045857 100644 --- a/Core/ek_Core functions GUI.lua +++ b/Core/ek_Core functions GUI.lua @@ -4,38 +4,109 @@ local ImGui = {} local ctx +local GUI_THEME_DARK = "Dark" +local GUI_THEME_LIGHT = "Light" +local key_gui_theme = "gui_theme" +local key_gui_font_size = "gui_font_size" local window_visible = false local window_opened = false local window_first_frame_showed = false local window_width = 0 local window_height = 0 -local font_name = 'Helvetica' -local font_size = 13 +local font_name = 'Arial' +local font_size = EK_GetExtState(key_gui_font_size, 14) local default_enter_action = nil local cached_fonts = nil local cached_values = {} -gui_font_types = { +local gui_themes = { GUI_THEME_DARK, GUI_THEME_LIGHT } +local theme = EK_GetExtState(key_gui_theme, GUI_THEME_DARK) + +gui_fonts = { None = 1, Italic = 2, Bold = 3, } -gui_colors = { +gui_cols = { White = 0xffffffff, Green = 0x6CCA3Cff, Red = 0xEB5852ff, - Blue = 0x1f6fcbff, - Background = 0x2c2c2cff, - Text = 0xffffffff, - TextDisabled = 0xbbbbbbff, + Background = { + Dark = 0x202022ff, + Light = 0xccccccff, + }, + ScrollGrab = { + Dark = 0x686868ff, + Light = 0xaaaaaaff, + }, + Text = { + Dark = 0xffffffff, + Light = 0x202022ff, + Disabled = { + Dark = 0xbbbbbbff, + Light = 0xeeeeeeff, + }, + Link = { + Dark = 0x4296FAFF, + Light = 0x1f6fcbff + } + }, + Header = { + Background = 0x5865f2ff, + Text = 0xffffffff, + }, + Menu = { + Background = { + Dark = 0x37373bff, + Light = 0xc4c4c4ff, + }, + Hovered = { + Dark = 0x67676eff, + Light = 0xaaaaaaff, + }, + Active = { + Dark = 0x67676eff, + Light = 0xaaaaaaff, + }, + }, Input = { - Background = 0x686868ff, + Background = { + Dark = 0x686868ff, + Light = 0xaaaaaaff, + }, Hover = 0x686868bb, Text = 0xe9e9e9ff, - Label = 0xffffffff, + Label = { + Dark = 0xffffffff, + Light = 0x202022ff, + }, + CheckMark = 0x7ffffffff, + Grab = 0x707affff, + Combo = { + Background = { + Dark = 0x686868ff, + Light = 0xaaaaaaff, + }, + Hovered = 0x999999ff + } }, Button = { + Basic = { + Background = 0x5865f2ff, + Hovered = 0x4751c4ff, + Active = 0x4751c4ff, + Text = 0xffffffff, + }, + Cancel = { + Background = { + Dark = 0x686868ff, + Light = 0xaaaaaaff, + }, + Hovered = 0x4f4f4fff, + Active = 0x4f4f4fff, + Text = 0xffffffff, + } } } @@ -58,12 +129,15 @@ gui_input_types = { } GUI_OnWindowClose = nil +GUI_DrawMenu = nil FLT_MIN, FLT_MAX = reaper.ImGui_NumericLimits_Float and reaper.ImGui_NumericLimits_Float() or 0, 0 + local function GUI_GetWindowFlags() return reaper.ImGui_WindowFlags_NoCollapse() | reaper.ImGui_WindowFlags_NoResize() | - reaper.ImGui_WindowFlags_TopMost() + reaper.ImGui_WindowFlags_TopMost() | + reaper.ImGui_WindowFlags_MenuBar() end local function GUI_GetInputFlags() @@ -87,9 +161,9 @@ end local function GUI_GetFonts() if not cached_fonts then cached_fonts = {} - cached_fonts[gui_font_types.None] = ImGui.CreateFont(font_name, font_size, ImGui.FontFlags_None()) - cached_fonts[gui_font_types.Italic] = ImGui.CreateFont(font_name, font_size, ImGui.FontFlags_Italic()) - cached_fonts[gui_font_types.Bold] = ImGui.CreateFont(font_name, font_size, ImGui.FontFlags_Bold()) + cached_fonts[gui_fonts.None] = ImGui.CreateFont(font_name, font_size, ImGui.FontFlags_None()) + cached_fonts[gui_fonts.Italic] = ImGui.CreateFont(font_name, font_size, ImGui.FontFlags_Italic()) + cached_fonts[gui_fonts.Bold] = ImGui.CreateFont(font_name, font_size, ImGui.FontFlags_Bold()) end return cached_fonts @@ -100,30 +174,173 @@ function GUI_GetFont(font_type) return fonts[font_type] end +function GUI_GetColor(color) + if not color then return nil end + + if type(color) == 'table' and color.Dark and color.Light then + return theme == GUI_THEME_DARK and color.Dark or color.Light + end + + return color +end + +function GUI_PushColor(reaimgui_col, col) + if type(reaimgui_col) == 'table' then + for key, val in pairs(reaimgui_col) do + ImGui.PushStyleColor(ctx, key, GUI_GetColor(val)) + end + else + ImGui.PushStyleColor(ctx, reaimgui_col, GUI_GetColor(col)) + end +end + +function GUI_DrawModalPopup(title, content) + local center_x, center_y = ImGui.Viewport_GetCenter(ImGui.GetWindowViewport(ctx)) + ImGui.SetNextWindowSize(ctx, 480, 0) + ImGui.SetNextWindowPos(ctx, center_x, center_y, ImGui.Cond_Always(), 0.5, 0.5) + + GUI_PushColor(ImGui.Col_Text(), gui_cols.Header.Text) + if ImGui.BeginPopupModal(ctx, title, nil, ImGui.WindowFlags_NoResize()) then + ImGui.PopStyleColor(ctx) + + content(ImGui, ctx) + + ImGui.EndPopup(ctx) + else + ImGui.PopStyleColor(ctx) + end +end + +local function DrawAboutPopup() + GUI_DrawModalPopup('About', function() + GUI_DrawText("Hello, brave Reaper user! My name is ") + ImGui.SameLine(ctx, 0, 0); + GUI_DrawLink("Ed Kashinsky", "https://soundcloud.com/edkashinsky") + GUI_DrawText("and I'm glad you're using my scripts!") + + GUI_DrawGap(10) + + GUI_DrawText("If you have any ideas for improving scripts or bug reports,") + GUI_DrawText("please create an issue on ") + ImGui.SameLine(ctx, 0, 0); + GUI_DrawLink("Github", "https://github.com/edkashinsky/reaper-reableton-scripts/issues/new") + GUI_DrawText("or just text me on ") + ImGui.SameLine(ctx, 0, 0); + GUI_DrawLink("Facebook", "https://www.facebook.com/edkashinsky.music/") + + GUI_DrawGap(10) + + GUI_DrawText("You can support my work via:") + ImGui.Bullet(ctx) + ImGui.SameLine(ctx, 0, 5); + GUI_DrawLink("PayPal", "https://www.paypal.com/paypalme/kashinsky") + + ImGui.Bullet(ctx) + ImGui.SameLine(ctx, 0, 5); + GUI_DrawLink("BuyMeCoffee", "https://buymeacoffee.com/edkashinsky") + + ImGui.Bullet(ctx) + ImGui.SameLine(ctx, 0, 5); + GUI_DrawLink("Ko-fi", "https://ko-fi.com/edkashinsky") + + ImGui.Bullet(ctx) + ImGui.SameLine(ctx, 0, 5); + GUI_DrawLink("Boosty", "https://boosty.to/edkashinsky/donate") + GUI_DrawGap(10) + + GUI_DrawText("GUI Global Settings", gui_fonts.Bold) + + local newVal + local key = 0 + for i = 1, #gui_themes do + if gui_themes[i] == theme then key = i - 1 end + end + + ImGui.PushItemWidth(ctx, 160) + newVal = GUI_DrawInput(gui_input_types.Combo, "Theme", key, { select_values = gui_themes }) + if newVal ~= key then + theme = gui_themes[newVal + 1] + EK_SetExtState(key_gui_theme, theme) + end + + newVal = GUI_DrawInput(gui_input_types.NumberSlider, "Font size (need to reopen script)", font_size, { number_min = 9, number_max = 20}) + if newVal ~= font_size then + font_size = newVal + EK_SetExtState(key_gui_font_size, font_size) + end + + GUI_DrawGap(10) + GUI_SetCursorCenter(' Close ') + + GUI_DrawButton('Close', function() + ImGui.CloseCurrentPopup(ctx) + end, gui_buttons_types.Cancel, true) + end) +end + -- -- Show main window -- local function main() ImGui.SetNextWindowSize(ctx, window_width, window_height) - ImGui.PushFont(ctx, GUI_GetFont(gui_font_types.None)) - ImGui.PushStyleColor(ctx, ImGui.Col_WindowBg(), gui_colors.Background) - ImGui.PushStyleColor(ctx, ImGui.Col_Separator(), gui_colors.Background) - ImGui.PushStyleColor(ctx, ImGui.Col_FrameBg(), gui_colors.Input.Background) - ImGui.PushStyleColor(ctx, ImGui.Col_FrameBgHovered(), gui_colors.Input.Hover) - ImGui.PushStyleColor(ctx, ImGui.Col_FrameBgActive(), gui_colors.Input.Hover) - ImGui.PushStyleColor(ctx, ImGui.Col_Text(), gui_colors.Text) - ImGui.PushStyleColor(ctx, ImGui.Col_TextDisabled(), gui_colors.TextDisabled) + GUI_PushColor({ + [ImGui.Col_WindowBg()] = gui_cols.Background, + [ImGui.Col_Separator()] = gui_cols.Background, + [ImGui.Col_PopupBg()] = gui_cols.Background, + [ImGui.Col_ScrollbarBg()] = gui_cols.Background, + [ImGui.Col_ScrollbarGrab()] = gui_cols.ScrollGrab, + [ImGui.Col_Text()] = gui_cols.Text, + [ImGui.Col_TextDisabled()] = gui_cols.Text.Disabled, + [ImGui.Col_MenuBarBg()] = gui_cols.Menu.Background, + [ImGui.Col_FrameBg()] = gui_cols.Input.Background, + [ImGui.Col_FrameBgHovered()] = gui_cols.Input.Hover, + [ImGui.Col_FrameBgActive()] = gui_cols.Input.Hover, + [ImGui.Col_Header()] = gui_cols.Header.Background, + [ImGui.Col_HeaderHovered()] = gui_cols.Menu.Hovered, + [ImGui.Col_HeaderActive()] = gui_cols.Menu.Active, + [ImGui.Col_Button()] = gui_cols.Button.Basic.Background, + [ImGui.Col_ButtonHovered()] = gui_cols.Button.Basic.Hovered, + [ImGui.Col_ButtonActive()] = gui_cols.Button.Basic.Active, + [ImGui.Col_TitleBg()] = gui_cols.Header.Background, + [ImGui.Col_TitleBgActive()] = gui_cols.Header.Background, + [ImGui.Col_TitleBgCollapsed()] = gui_cols.Header.Background, + [ImGui.Col_CheckMark()] = gui_cols.Input.CheckMark, + [ImGui.Col_SliderGrab()] = gui_cols.Input.Grab, + }) + + ImGui.PushFont(ctx, GUI_GetFont(gui_fonts.None)) + ImGui.PushStyleVar(ctx, ImGui.StyleVar_FrameRounding(), 2) + ImGui.PushStyleVar(ctx, ImGui.StyleVar_WindowPadding(), 12, 12) + ImGui.PushStyleVar(ctx, ImGui.StyleVar_WindowBorderSize(), 1) window_visible, window_opened = ImGui.Begin(ctx, SCRIPT_NAME, true, GUI_GetWindowFlags()) if window_visible then + local open_about_popup + local menu_action + + if ImGui.BeginMenuBar(ctx) then + if type(GUI_DrawMenu) == 'function' then + menu_action = GUI_DrawMenu(ImGui, ctx) + end + + if ImGui.MenuItem(ctx, 'About') then open_about_popup = true end + ImGui.EndMenuBar(ctx) + end + + if open_about_popup then ImGui.OpenPopup(ctx, 'About') end + if type(menu_action) == 'function' then menu_action() end + + DrawAboutPopup() frame(ImGui, ctx, not window_first_frame_showed) window_first_frame_showed = true ImGui.End(ctx) end - ImGui.PopStyleColor(ctx, 7) + ImGui.PopStyleVar(ctx, 3) + + ImGui.PopStyleColor(ctx, 22) ImGui.PopFont(ctx) if ImGui.IsKeyPressed(ctx, ImGui.Key_Escape()) then @@ -142,6 +359,9 @@ local function main() end function GUI_ShowMainWindow(w, h) + w = w or 0 + h = h or 0 + if reaper.ImGui_GetVersion == nil or not pcall(function() dofile(reaper.GetResourcePath() .. '/Scripts/ReaTeam Extensions/API/imgui.lua') '0.8.5' end) then @@ -174,13 +394,13 @@ function GUI_CloseMainWindow() end function GUI_DrawText(text, font, color) - if not font then font = GUI_GetFont(gui_font_types.None) end + if not font then font = gui_fonts.None end if color ~= nil then - ImGui.PushStyleColor(ctx, ImGui.Col_Text(), color) + GUI_PushColor(ImGui.Col_Text(), color) end - ImGui.PushFont(ctx, font) + ImGui.PushFont(ctx, GUI_GetFont(font)) ImGui.TextWrapped(ctx, text) ImGui.PopFont(ctx) @@ -190,15 +410,14 @@ function GUI_DrawText(text, font, color) end function GUI_DrawLink(text, url) - text = url or text + url = url or text if not reaper.CF_ShellExecute then ImGui.Text(ctx, text) return end - local color = ImGui.GetStyleColor(ctx, ImGui.Col_CheckMark()) - ImGui.TextColored(ctx, color, text) + ImGui.TextColored(ctx, GUI_GetColor(gui_cols.Text.Link), text) if ImGui.IsItemClicked(ctx) then reaper.CF_ShellExecute(url or text) elseif ImGui.IsItemHovered(ctx) then @@ -209,7 +428,12 @@ end function GUI_DrawHint(text, title) if not title then title = "[?]" end - ImGui.TextDisabled(ctx, title) + GUI_PushColor(ImGui.Col_Text(), gui_cols.Button.Basic.Background) + ImGui.PushFont(ctx, GUI_GetFont(gui_fonts.Bold)) + ImGui.Text(ctx, title) + ImGui.PopFont(ctx) + ImGui.PopStyleColor(ctx) + if ImGui.IsItemHovered(ctx, ImGui.HoveredFlags_DelayShort()) and ImGui.BeginTooltip(ctx) then ImGui.PushTextWrapPos(ctx, ImGui.GetFontSize(ctx) * 35.0) ImGui.Text(ctx, text) @@ -243,11 +467,14 @@ function GUI_DrawButton(label, action, btn_type, prevent_close_wnd, keyboard_key width = width + (gui_btn_padding * 2) if btn_type == gui_buttons_types.Action then - + GUI_PushColor(ImGui.Col_Text(), gui_cols.Button.Basic.Text) elseif btn_type == gui_buttons_types.Cancel then - ImGui.PushStyleColor(ctx, ImGui.Col_Button(), 0x545454ff) - ImGui.PushStyleColor(ctx, ImGui.Col_ButtonHovered(), 0x666666ff) - ImGui.PushStyleColor(ctx, ImGui.Col_ButtonActive(), 0x777777ff) + GUI_PushColor({ + [ImGui.Col_Button()] = gui_cols.Button.Cancel.Background, + [ImGui.Col_ButtonHovered()] = gui_cols.Button.Cancel.Hovered, + [ImGui.Col_ButtonActive()] = gui_cols.Button.Cancel.Active, + [ImGui.Col_Text()] = gui_cols.Button.Cancel.Text, + }) end if not default_enter_action and btn_type == gui_buttons_types.Action and type(action) == 'function' then @@ -273,9 +500,9 @@ function GUI_DrawButton(label, action, btn_type, prevent_close_wnd, keyboard_key end if btn_type == gui_buttons_types.Action then - + ImGui.PopStyleColor(ctx, 1) elseif btn_type == gui_buttons_types.Cancel then - ImGui.PopStyleColor(ctx, 3) + ImGui.PopStyleColor(ctx, 4) end end @@ -336,7 +563,7 @@ function GUI_DrawSettingsTable(settingsTable) end if descr ~= nil then - GUI_DrawText(descr, GUI_GetFont(gui_font_types.Italic)) + GUI_DrawText(descr, gui_fonts.Italic) if i < #settingsTable then GUI_DrawGap() end end @@ -355,8 +582,8 @@ function GUI_DrawInput(i_type, i_label, i_value, i_settings) local needLabel = true local inner_spacing_x = ImGui.GetStyleVar(ctx, ImGui.StyleVar_ItemInnerSpacing()) - ImGui.PushFont(ctx, GUI_GetFont(gui_font_types.Bold)) - ImGui.PushStyleColor(ctx, ImGui.Col_Text(), gui_colors.Input.Text) + ImGui.PushFont(ctx, GUI_GetFont(gui_fonts.Bold)) + GUI_PushColor(ImGui.Col_Text(), gui_cols.Input.Text) if i_type == gui_input_types.Text then _, newVal = ImGui.InputText(ctx, '##' .. i_label, i_value, input_flags) @@ -387,6 +614,11 @@ function GUI_DrawInput(i_type, i_label, i_value, i_settings) elseif i_type == gui_input_types.Checkbox then _, newVal = ImGui.Checkbox(ctx, '##' .. i_label, i_value) elseif i_type == gui_input_types.Combo then + GUI_PushColor({ + [ImGui.Col_PopupBg()] = gui_cols.Input.Combo.Background, + [ImGui.Col_ScrollbarBg()] = gui_cols.Input.Combo.Background, + [ImGui.Col_HeaderHovered()] = gui_cols.Input.Combo.Hovered, + }) local select_values if type(i_settings.select_values) == "function" then @@ -396,16 +628,18 @@ function GUI_DrawInput(i_type, i_label, i_value, i_settings) end _, newVal = ImGui.Combo(ctx, '##' .. i_label, i_value, join(i_settings.select_values, "\0") .. "\0") + + ImGui.PopStyleColor(ctx, 3) elseif i_type == gui_input_types.Color then if i_value == 0 then i_value = nil end _, newVal = ImGui.ColorPicker3(ctx, '##' .. i_label, i_value, GUI_GetColorFlags()) elseif i_type == gui_input_types.ColorView then - if i_value == 0 then i_value = tonumber(gui_colors.Input.Background >> 8) end + if i_value == 0 then i_value = tonumber(GUI_GetColor(gui_cols.Input.Background) >> 8) end local flags = i_settings.flags and i_settings.flags or GUI_GetColorFlags() - ImGui.PushStyleColor(ctx, ImGui.Col_FrameBg(), gui_colors.White) + ImGui.PushStyleColor(ctx, ImGui.Col_FrameBg(), GUI_GetColor(gui_cols.White)) if i_settings.selected then newVal = ImGui.ColorButton(ctx, '##' .. i_label, i_value, flags & ~ImGui.ColorEditFlags_NoBorder()) else @@ -424,8 +658,9 @@ function GUI_DrawInput(i_type, i_label, i_value, i_settings) -- if needLabel then ImGui.SameLine(ctx, nil, inner_spacing_x) - ImGui.PushStyleColor(ctx, ImGui.Col_Text(), gui_colors.Input.Label) - if i_settings.label_not_bold ~= true then ImGui.PushFont(ctx, GUI_GetFont(gui_font_types.Bold)) end + GUI_PushColor(ImGui.Col_Text(), gui_cols.Input.Label) + + if i_settings.label_not_bold ~= true then ImGui.PushFont(ctx, GUI_GetFont(gui_fonts.Bold)) end ImGui.Text(ctx, i_label) diff --git a/Core/ek_Core functions v1.lua b/Core/ek_Core functions v1.lua index 7c15366..3faff89 100644 --- a/Core/ek_Core functions v1.lua +++ b/Core/ek_Core functions v1.lua @@ -3,7 +3,7 @@ -- @noindex CONTEXT = ({reaper.get_action_context()}) -SCRIPT_NAME = CONTEXT[2]:match("([^/\\]+)%.lua$") +SCRIPT_NAME = CONTEXT[2]:match("([^/\\]+)%.lua$"):gsub("ek_", "") SCRIPT_PATH = CONTEXT[2]:match("(.*[/\\])") IS_WINDOWS = reaper.GetOS() == "Win64" or reaper.GetOS() == "Win32" diff --git a/Core/ek_Core functions.lua b/Core/ek_Core functions.lua index 6936935..d56db52 100644 --- a/Core/ek_Core functions.lua +++ b/Core/ek_Core functions.lua @@ -1,14 +1,15 @@ -- @description ek_Core functions -- @author Ed Kashinsky -- @about Base functions used by ek-scripts. --- @version 1.0.53 +-- @version 1.0.54 -- @provides -- ek_Core functions v1.lua -- ek_Core functions GUI.lua -- [nomain] curl/* -- -- @changelog --- Bug fix of ColorView in UI +-- Added Light theme for IU scripts +-- Added about window local function CoreLoadFunctions() local info = debug.getinfo(1,'S'); diff --git a/Core/ek_Global startup action - settings.lua b/Core/ek_Global startup action - settings.lua index 4e79578..fe4dd9f 100644 --- a/Core/ek_Global startup action - settings.lua +++ b/Core/ek_Global startup action - settings.lua @@ -23,7 +23,7 @@ end CoreFunctionsLoaded("ek_Core functions startup.lua") -GUI_ShowMainWindow(490, 670) +GUI_ShowMainWindow(0, 670) local ordered_settings = EK_SortTableByKey(ga_settings) @@ -33,11 +33,11 @@ function frame(ImGui, ctx) local isStartupSet = EK_IsGlobalActionEnabledViaStartup() if (isSet and not isStartupSet and not isEnabled and ga_startup_exists) or (not isSet and isStartupSet and isEnabled) then - GUI_DrawText( "Please restart REAPER for changes to take effect...", GUI_GetFont(gui_font_types.Bold), gui_colors.Red) + GUI_DrawText( "Please restart REAPER for changes to take effect...", gui_fonts.Bold, gui_cols.Red) end if not isStartupSet and isEnabled then - GUI_DrawText( "It's enabled by manual setting via SWS Startup actions...", GUI_GetFont(gui_font_types.Bold), gui_colors.Green) + GUI_DrawText( "It's enabled by manual setting via SWS Startup actions...", gui_fonts.Bold, gui_cols.Green) end ImGui.PushItemWidth(ctx, 224) diff --git a/Core/ek_Global startup action.lua b/Core/ek_Global startup action.lua index 2da0c91..5a43e9c 100644 --- a/Core/ek_Global startup action.lua +++ b/Core/ek_Global startup action.lua @@ -1,5 +1,5 @@ -- @description ek_Global startup action --- @version 1.0.42 +-- @version 1.0.43 -- @author Ed Kashinsky -- @about -- This is startup action brings some ableton-like features in realtime. You can control any option by 'ek_Global startup action settings' script. @@ -12,7 +12,7 @@ -- 5. Open 'ek_Global startup action settings' again for customize options -- 6. If you want to use auto-grid for MIDI Editor, install script **ek_Auto grid for MIDI Editor** and set it on zoom shortcut. -- @changelog --- Added helpers for not installed dependencies +-- UI update -- @provides -- ek_Core functions startup.lua -- ek_Adaptive grid functions.lua diff --git a/Core/ek_Smart renaming functions.lua b/Core/ek_Smart renaming functions.lua index dd6aa7c..11eb2a8 100644 --- a/Core/ek_Smart renaming functions.lua +++ b/Core/ek_Smart renaming functions.lua @@ -28,7 +28,7 @@ rename_default_colors_config = { number_max = 1.0, default = 0, number_precision = "%.2f", - callback = function() UpdateDefaultColorsPalette() end + on_change = function() UpdateDefaultColorsPalette() end }, { key = "sr_dc_saturation", @@ -38,7 +38,7 @@ rename_default_colors_config = { number_max = 1, default = 0, number_precision = "%.2f", - callback = function() UpdateDefaultColorsPalette() end + on_change = function() UpdateDefaultColorsPalette() end }, { key = "sr_dc_brightness", @@ -48,7 +48,7 @@ rename_default_colors_config = { number_max = 1, default = 0, number_precision = "%.2f", - callback = function() UpdateDefaultColorsPalette() end + on_change = function() UpdateDefaultColorsPalette() end }, } diff --git a/Core/ek_Pin selected items functions.lua b/Core/ek_Snap items to markers functions.lua similarity index 92% rename from Core/ek_Pin selected items functions.lua rename to Core/ek_Snap items to markers functions.lua index 611bdcf..71b05c4 100644 --- a/Core/ek_Pin selected items functions.lua +++ b/Core/ek_Snap items to markers functions.lua @@ -112,16 +112,24 @@ function FindNearestMarkerNum(is_region, position) end end -function PinItems(to_regions, marker_num, save_relative_position, items_on_track) +function SnapItems(to_regions, marker_num, save_relative_position, items_on_track) local markers = GetMarkersOrRegions(to_regions) - local startIndex = FindIndexByMarkerNumber(markers, marker_num) + if isEmpty(markers) then + EK_ShowTooltip(to_regions and "There is no any region in the project." or "There is no any marker in the project.") + return + end + local startIndex = FindIndexByMarkerNumber(markers, marker_num) if startIndex == nil then EK_ShowTooltip("Please enter correct number of marker.") return end items_map = EK_GetSelectedItemsAsGroupedStems() + if isEmpty(items_map) then + EK_ShowTooltip("There is no any selected item.") + return + end local curIndex = startIndex diff --git a/Items Editing/ek_Edge silence cropper.lua b/Items Editing/ek_Edge silence cropper.lua index cbf6d71..a491973 100644 --- a/Items Editing/ek_Edge silence cropper.lua +++ b/Items Editing/ek_Edge silence cropper.lua @@ -1,5 +1,5 @@ -- @description ek_Edge silence cropper --- @version 1.2.3 +-- @version 1.2.4 -- @author Ed Kashinsky -- @readme_skip -- @about @@ -7,7 +7,7 @@ -- -- Also it provides UI for configuration -- @changelog --- Bug fix with Sliders +-- UI updates -- @provides -- ../Core/ek_Edge silence cropper functions.lua -- [main=main] ek_Edge silence cropper (no prompt).lua @@ -35,7 +35,7 @@ end CoreFunctionsLoaded("ek_Edge silence cropper functions.lua") -GUI_ShowMainWindow(330, 0) +GUI_ShowMainWindow() local min_step = 0.00001 local using_eel = reaper.APIExists("ImGui_CreateFunctionFromEEL") diff --git a/Items Editing/ek_Pin selected items at markers started from.lua b/Items Editing/ek_Pin selected items at markers started from.lua deleted file mode 100644 index 93491ed..0000000 --- a/Items Editing/ek_Pin selected items at markers started from.lua +++ /dev/null @@ -1,118 +0,0 @@ --- @description ek_Pin selected items at markers started from --- @version 1.0.10 --- @author Ed Kashinsky --- @about --- ![Preview](/Assets/images/pin_items_to_markers_preview.gif) --- This script pins selected items to markers started from specified number. It requires ReaImGui extension. --- @changelog --- Added opportunity to pin items to regions --- @provides --- ../Core/ek_Pin selected items functions.lua --- [main=main] ek_Pin selected items to closest markers.lua --- [main=main] ek_Pin selected items to closest regions.lua - -function CoreFunctionsLoaded(script) - local sep = (reaper.GetOS() == "Win64" or reaper.GetOS() == "Win32") and "\\" or "/" - local root_path = debug.getinfo(1, 'S').source:sub(2, -5):match("(.*" .. sep .. ")") - local script_path = root_path .. ".." .. sep .. "Core" .. sep .. script - local file = io.open(script_path, 'r') - - if file then file:close() dofile(script_path) else return nil end - return not not _G["EK_HasExtState"] -end - -local loaded = CoreFunctionsLoaded("ek_Core functions.lua") -if not loaded then - if loaded == nil then reaper.MB('Core functions is missing. Please install "ek_Core functions" it via ReaPack (Action: Browse packages)', '', 0) end - return -end - -CoreFunctionsLoaded("ek_Pin selected items functions.lua") - -local start_marker = nil -local count_on_track = nil -local save_relative_position = true - -local gui_sel_marker = nil -local gui_sel_count = 0 -local gui_pin_to = 0 -local pin_types = { "Markers", "Regions" } -local markers - -function frame(ImGui, ctx) - markers = GetMarkersOrRegions(gui_pin_to == 1) - - local gui_markers_list = {} - local gui_count_list = { "No limit" } - local gui_sel_maker_position = 0 - local gui_count_i = 1 - - for i = 1, #markers do - table.insert(gui_markers_list, markers[i].num) - if markers[i].num == start_marker then - gui_sel_marker = i - 1 - gui_sel_maker_position = markers[i].position - end - end - - for i = 1, #markers do - if markers[i].position > gui_sel_maker_position then - table.insert(gui_count_list, gui_count_i) - gui_count_i = gui_count_i + 1 - end - end - - ImGui.PushItemWidth(ctx, 110) - local value - - _, value = ImGui.Combo(ctx, "Pin to", gui_pin_to, join(pin_types, "\0") .. "\0") - if value ~= gui_pin_to then - gui_pin_to = value - end - - _, value = ImGui.Combo(ctx, gui_pin_to == 1 and "Start region number" or "Start marker number", gui_sel_marker, join(gui_markers_list, "\0") .. "\0") - if value ~= gui_sel_marker then - start_marker = gui_markers_list[value + 1] - gui_sel_marker = value - end - - _, value = ImGui.Combo(ctx, "Count items on track", gui_sel_count, join(gui_count_list, "\0") .. "\0") - if value ~= gui_sel_count then - count_on_track = gui_count_list[value + 1] == "No limit" and nil or gui_count_list[value + 1] - gui_sel_count = value - end - - _, value = ImGui.Checkbox(ctx, 'Group piled items', save_relative_position) - if value ~= save_relative_position then - save_relative_position = value - end - - GUI_DrawGap(7) - - ImGui.Indent(ctx, 45) - - GUI_DrawButton('Pin items', function() - reaper.Undo_BeginBlock() - - PinItems(gui_pin_to == 1, start_marker, save_relative_position, count_on_track) - - GUI_CloseMainWindow() - - reaper.UpdateArrange() - reaper.Undo_EndBlock("Move selected items at markers started from", -1) - end, gui_buttons_types.Action, true) - - ImGui.SameLine(ctx) - - GUI_DrawButton('Cancel', nil, gui_buttons_types.Cancel) -end - -local item = reaper.GetSelectedMediaItem(proj, 0) - -if item then - local position = reaper.GetMediaItemInfo_Value(item, "D_POSITION") - - start_marker = FindNearestMarkerNum(gui_pin_to == 1, position) -end - -GUI_ShowMainWindow(260, 0) diff --git a/Items Editing/ek_Smart split items by mouse cursor.lua b/Items Editing/ek_Smart split items by mouse cursor.lua index 141f7db..2875bf9 100644 --- a/Items Editing/ek_Smart split items by mouse cursor.lua +++ b/Items Editing/ek_Smart split items by mouse cursor.lua @@ -5,7 +5,7 @@ -- Remake of amazing script by AZ and it works a bit different way. You can split by edit cursor if mouse position on it (or in Tolerance range in pixels). -- If you move mouse on transport panel and execute script, you will see settings window -- @changelog --- Updated the minimum version of ReaImGui to version 0.8.5 +-- UI updates -- @provides -- ../Core/ek_Smart split items by mouse cursor functions.lua @@ -38,7 +38,7 @@ if window == "transport" then ImGui.PopItemWidth(ctx) end - GUI_ShowMainWindow(625, 0) + GUI_ShowMainWindow() return end diff --git a/Items Editing/ek_Pin selected items to closest regions.lua b/Items Editing/ek_Snap items to closest markers.lua similarity index 80% rename from Items Editing/ek_Pin selected items to closest regions.lua rename to Items Editing/ek_Snap items to closest markers.lua index c6d32e6..ea27f9c 100644 --- a/Items Editing/ek_Pin selected items to closest regions.lua +++ b/Items Editing/ek_Snap items to closest markers.lua @@ -1,4 +1,4 @@ --- @description ek_Pin selected items to closest regions +-- @description ek_Snap items to closest markers -- @author Ed Kashinsky -- @noindex -- @readme_skip @@ -19,7 +19,7 @@ if not loaded then return end -CoreFunctionsLoaded("ek_Pin selected items functions.lua") +CoreFunctionsLoaded("ek_Snap items to markers functions.lua") local min_position @@ -32,4 +32,8 @@ for i = 0, reaper.CountSelectedMediaItems(proj) - 1 do end end -PinItems(true, FindNearestMarkerNum(true, min_position), true) \ No newline at end of file +reaper.Undo_BeginBlock() + +SnapItems(false, FindNearestMarkerNum(false, min_position), true) + +reaper.Undo_EndBlock(SCRIPT_NAME, -1) \ No newline at end of file diff --git a/Items Editing/ek_Pin selected items to closest markers.lua b/Items Editing/ek_Snap items to closest regions.lua similarity index 80% rename from Items Editing/ek_Pin selected items to closest markers.lua rename to Items Editing/ek_Snap items to closest regions.lua index bedf956..02cc734 100644 --- a/Items Editing/ek_Pin selected items to closest markers.lua +++ b/Items Editing/ek_Snap items to closest regions.lua @@ -1,4 +1,4 @@ --- @description ek_Pin selected items to closest markers +-- @description ek_Snap items to closest regions -- @author Ed Kashinsky -- @noindex -- @readme_skip @@ -19,7 +19,7 @@ if not loaded then return end -CoreFunctionsLoaded("ek_Pin selected items functions.lua") +CoreFunctionsLoaded("ek_Snap items to markers functions.lua") local min_position @@ -32,4 +32,8 @@ for i = 0, reaper.CountSelectedMediaItems(proj) - 1 do end end -PinItems(false, FindNearestMarkerNum(false, min_position), true) \ No newline at end of file +reaper.Undo_BeginBlock() + +SnapItems(true, FindNearestMarkerNum(true, min_position), true) + +reaper.Undo_EndBlock(SCRIPT_NAME, -1) \ No newline at end of file diff --git a/Items Editing/ek_Snap items to markers or regions.lua b/Items Editing/ek_Snap items to markers or regions.lua new file mode 100644 index 0000000..5bd921c --- /dev/null +++ b/Items Editing/ek_Snap items to markers or regions.lua @@ -0,0 +1,144 @@ +-- @description ek_Snap items to markers or regions +-- @version 1.0.0 +-- @author Ed Kashinsky +-- @about +-- ![Preview](/Assets/images/pin_items_to_markers_preview.gif) +-- This script snaps selected items to markers or regions started from specified number. It requires ReaImGui extension. +-- @changelog +-- Added opportunity to snap items to regions +-- UI update +-- @provides +-- ../Core/ek_Snap items to markers functions.lua +-- [main=main] ek_Snap items to closest markers.lua +-- [main=main] ek_Snap items to closest regions.lua + +function CoreFunctionsLoaded(script) + local sep = (reaper.GetOS() == "Win64" or reaper.GetOS() == "Win32") and "\\" or "/" + local root_path = debug.getinfo(1, 'S').source:sub(2, -5):match("(.*" .. sep .. ")") + local script_path = root_path .. ".." .. sep .. "Core" .. sep .. script + local file = io.open(script_path, 'r') + + if file then file:close() dofile(script_path) else return nil end + return not not _G["EK_HasExtState"] +end + +local loaded = CoreFunctionsLoaded("ek_Core functions.lua") +if not loaded then + if loaded == nil then reaper.MB('Core functions is missing. Please install "ek_Core functions" it via ReaPack (Action: Browse packages)', '', 0) end + return +end + +CoreFunctionsLoaded("ek_Snap items to markers functions.lua") + +local start_marker +local count_on_track +local save_relative_position = true +local window_open = true + +local gui_sel_marker +local gui_sel_count = 0 +local gui_snap_to = 0 +local gui_snap_types = { "Markers", "Regions" } +local gui_markers_list = {} +local gui_count_list = {} +local gui_count_i = 0 + +local function UpdateMarkersLis() + local markers = GetMarkersOrRegions(gui_snap_to == 1) + local sel_marker_position = 0 + local marker_is_found = false + + gui_markers_list = {} + gui_count_list = { "No limit" } + gui_count_i = 1 + + for i = 1, #markers do + table.insert(gui_markers_list, markers[i].num) + if markers[i].num == start_marker then + gui_sel_marker = i - 1 + sel_marker_position = markers[i].position + marker_is_found = true + end + end + + if isEmpty(gui_markers_list) then + gui_markers_list = { gui_snap_to == 1 and "No regions" or "No markers" } + gui_sel_marker = 0 + elseif not marker_is_found then + start_marker = markers[1].num + gui_sel_marker = 0 + sel_marker_position = markers[1].position + end + + for i = 1, #markers do + if markers[i].position > sel_marker_position then + table.insert(gui_count_list, gui_count_i) + gui_count_i = gui_count_i + 1 + end + end + + return window_open +end + +function frame(ImGui, ctx) + ImGui.PushItemWidth(ctx, 140) + local value + + value = GUI_DrawInput(gui_input_types.Combo, "Snap to", gui_snap_to, { select_values = gui_snap_types }) + if value ~= gui_snap_to then + gui_snap_to = value + end + + value = GUI_DrawInput(gui_input_types.Combo, gui_snap_to == 1 and "Start region number" or "Start marker number", gui_sel_marker, { select_values = gui_markers_list }) + if value ~= gui_sel_marker then + start_marker = gui_markers_list[value + 1] + gui_sel_marker = value + end + + value = GUI_DrawInput(gui_input_types.Combo, "Count items on track", gui_sel_count, { select_values = gui_count_list }) + if value ~= gui_sel_count then + if gui_count_list[value + 1] == "No limit" then count_on_track = nil + else count_on_track = gui_count_list[value + 1] + end + + gui_sel_count = value + end + + value = GUI_DrawInput(gui_input_types.Checkbox, "Group items on different tracks", save_relative_position) + if value ~= save_relative_position then + save_relative_position = value + end + + GUI_DrawGap(7) + + ImGui.Indent(ctx, 60) + + GUI_DrawButton('Snap items', function() + reaper.Undo_BeginBlock() + + SnapItems(gui_snap_to == 1, start_marker, save_relative_position, count_on_track) + + GUI_CloseMainWindow() + + reaper.Undo_EndBlock(SCRIPT_NAME, -1) + end, gui_buttons_types.Action, true) + + ImGui.SameLine(ctx) + + GUI_DrawButton('Cancel', nil, gui_buttons_types.Cancel) +end + +local item = reaper.GetSelectedMediaItem(proj, 0) + +if item then + local position = reaper.GetMediaItemInfo_Value(item, "D_POSITION") + + start_marker = FindNearestMarkerNum(gui_snap_to == 1, position) +end + +EK_DeferWithCooldown(UpdateMarkersLis, { last_time = 0, cooldown = 0.5 }) +GUI_ShowMainWindow() + +function GUI_OnWindowClose() + window_open = false; +end \ No newline at end of file diff --git a/Tracks Properties/ek_Smart renaming depending on focus.lua b/Tracks Properties/ek_Smart renaming depending on focus.lua index 2f854fa..8ce190f 100644 --- a/Tracks Properties/ek_Smart renaming depending on focus.lua +++ b/Tracks Properties/ek_Smart renaming depending on focus.lua @@ -1,11 +1,11 @@ -- @description ek_Smart renaming depending on focus --- @version 1.0.13 +-- @version 1.0.14 -- @author Ed Kashinsky -- @readme_skip -- @about -- Renaming stuff for takes, items, markers, regions and tracks depending on focus -- @changelog --- Small ui fixes +-- UI update -- @provides -- ../Core/ek_Smart renaming functions.lua @@ -30,7 +30,7 @@ CoreFunctionsLoaded("ek_Smart renaming functions.lua") local defaultPalette = { 0xc93b10, 0xc95a10, 0xc9a510, 0xcaca11, 0x80ca0d, 0x51a31a, 0x5bc910, 0x10c92e, 0x13ca5a, 0x12caa5, 0x0ea5ca, 0x2696cf, 0x3682d4, 0x4644d8, 0x4341b0, 0x5e40d5, 0x7738d3, 0x902ed1, 0xa40fc9, 0xca11c9, } -local wndWidth = 340 +--local wndWidth = 0 local element = GetFocusedElement() local isColorTreeShowed = false local isColorTreeShowedChanged = false @@ -151,12 +151,12 @@ local function drawClearButton(ImGui, ctx) local sz = 19 local offset = 3 - ImGui.DrawList_AddRectFilled(draw_list, x, y, x + sz, y + sz, gui_colors.Background, 0.0); - ImGui.DrawList_AddLine(draw_list, x + offset, y + offset, x + sz - 1 - offset, y + sz - 1 - offset, gui_colors.Red, 1) - ImGui.DrawList_AddLine(draw_list, x + offset, y + sz - 1 - offset, x + sz - 1 - offset, y + offset, gui_colors.Red, 1) + ImGui.DrawList_AddRectFilled(draw_list, x, y, x + sz, y + sz, GUI_GetColor(gui_cols.Background), 0.0); + ImGui.DrawList_AddLine(draw_list, x + offset, y + offset, x + sz - 1 - offset, y + sz - 1 - offset, GUI_GetColor(gui_cols.Red), 1) + ImGui.DrawList_AddLine(draw_list, x + offset, y + sz - 1 - offset, x + sz - 1 - offset, y + offset, GUI_GetColor(gui_cols.Red), 1) if color == 0 then - ImGui.DrawList_AddRect(draw_list, x, y, x + sz, y + sz, gui_colors.White, 0.0); + ImGui.DrawList_AddRect(draw_list, x, y, x + sz, y + sz, GUI_GetColor(gui_cols.White), 0.0); end if ImGui.InvisibleButton(ctx, '##Clear color', sz, sz) then color = 0 @@ -175,9 +175,9 @@ local function drawAddColorButton(ImGui, ctx) local cy = y + (sz / 2) local offset = 3 - ImGui.DrawList_AddRectFilled(draw_list, x, y, x + sz, y + sz, gui_colors.Background, 0.0); - ImGui.DrawList_AddLine(draw_list, cx, y + offset, cx, y + sz - offset, gui_colors.White, 1) - ImGui.DrawList_AddLine(draw_list, x + offset, cy, x + sz - offset, cy, gui_colors.White, 1) + ImGui.DrawList_AddRectFilled(draw_list, x, y, x + sz, y + sz, GUI_GetColor(gui_cols.Background), 0.0); + ImGui.DrawList_AddLine(draw_list, cx, y + offset, cx, y + sz - offset, GUI_GetColor(gui_cols.White), 1) + ImGui.DrawList_AddLine(draw_list, x + offset, cy, x + sz - offset, cy, GUI_GetColor(gui_cols.White), 1) if ImGui.InvisibleButton(ctx, '##Add color', sz, sz) then newColor = nil @@ -206,7 +206,7 @@ local function drawAddColorButton(ImGui, ctx) end, gui_buttons_types.Cancel, true) GUI_DrawText() - GUI_DrawText( 'Default color palette settings', GUI_GetFont(gui_font_types.Bold)) + GUI_DrawText( 'Default color palette settings', gui_fonts.Bold) ImGui.Separator(ctx) GUI_DrawSettingsTable(rename_default_colors_config) @@ -275,7 +275,7 @@ local function frameForAdvancedForm(ImGui, ctx) GUI_DrawText('Example:') ImGui.SameLine(ctx) - ImGui.PushFont(ctx, GUI_GetFont(gui_font_types.Bold)) + ImGui.PushFont(ctx, GUI_GetFont(gui_fonts.Bold)) GUI_DrawText(GetProcessedTitleByAdvanced(element.value, 1)) ImGui.PopFont(ctx) @@ -309,7 +309,7 @@ function frame(ImGui, ctx) -- GUI_DrawText(element.typeTitle .. ":") ImGui.SameLine(ctx) - ImGui.PushFont(ctx, GUI_GetFont(gui_font_types.Bold)) + ImGui.PushFont(ctx, GUI_GetFont(gui_fonts.Bold)) GUI_DrawText(element.title) ImGui.PopFont(ctx) @@ -350,7 +350,7 @@ function frame(ImGui, ctx) end if isColorTreeShowedChanged then - GUI_SetWindowSize(wndWidth, 0) + --GUI_SetWindowSize(wndWidth, 0) isColorTreeShowedChanged = false end @@ -367,7 +367,7 @@ function frame(ImGui, ctx) newVal = GUI_DrawInput(gui_input_types.Checkbox, "Advanced", isAdvanced, { label_not_bold = true }) if newVal ~= isAdvanced then isAdvanced = newVal - GUI_SetWindowSize(wndWidth, 0) + --GUI_SetWindowSize(wndWidth, 0) end if isAdvanced then @@ -403,4 +403,4 @@ function frame(ImGui, ctx) GUI_DrawButton('Cancel', nil, gui_buttons_types.Cancel) end -GUI_ShowMainWindow(wndWidth, 0) +GUI_ShowMainWindow()