Skip to content

Commit

Permalink
Update styling
Browse files Browse the repository at this point in the history
t5mat committed Aug 8, 2022

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent d6d1e5a commit a36c988
Showing 3 changed files with 41 additions and 31 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@ I made this to address some of the workflow limitations I've encountered as I wa

Don't expect this to be very maintained; rather, it is encouraged you modify night yourself if you want something changed. The code is relatively easy to follow, and with a bit of AutoHotkey knowledge, you can tweak it to fit your preferences or add new functionality.

**night was built for and tested on Cubase/Nuendo 12.** However, a lot of this stuff should work in older versions too. If you're feeling adventurous, know that the PLE user presets folder has changed, and some features might not work due to context menu changes/certain key commands or PLE features not being available.
**night was built for and tested on Cubase/Nuendo 12.** However, a lot of this should work in earlier versions too. If you're feeling adventurous, know that the PLE user presets folder has changed, and some features might not work due to context menu changes/certain key commands or PLE features not being available.

</details>

10 changes: 6 additions & 4 deletions generate-colors.py
Original file line number Diff line number Diff line change
@@ -5,8 +5,10 @@
from matplotlib import pyplot as plt


TOTAL = 32
GREYS = 8
TOTAL_COUNT = 32

FIXED_COUNT = 8
FIXED_COLORMAP = 'binary_r'

COLORMAPS = [
'CMRmap',
@@ -25,9 +27,9 @@
def main():
path = Path.cwd()
for colormap in COLORMAPS:
colors = generate_colormap_colors('binary_r', GREYS) + generate_colormap_colors(colormap, TOTAL - GREYS)
colors = generate_colormap_colors(FIXED_COLORMAP, FIXED_COUNT) + generate_colormap_colors(colormap, TOTAL_COUNT - FIXED_COUNT)

filename = f'{TOTAL}-{colormap}.ini'
filename = f'{TOTAL_COUNT}-{colormap}.ini'
data = generate_colors_file_contents(colors)
(path / filename).write_text(data, newline='')

60 changes: 34 additions & 26 deletions night.ahk
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#SingleInstance Force
#MenuMaskKey vkFF
#NoEnv

if (!A_IsUnicode || A_PtrSize != 8) {
@@ -11,17 +13,32 @@ GroupAdd CurrentProcess, % "ahk_pid " DllCall("GetCurrentProcessId")
GroupAdd SystemMenu, % "ahk_class ^#32768$"
GroupAdd SystemDialog, % "ahk_class ^#32770$"

ToolTipTimeout(Text, Timeout)
ReadFileUtf8(Path)
{
ToolTip % Text
SetTimer RemoveToolTip, % -Timeout
FileRead Data, % "*P65001 " Path
return Data
}

ConsumeFileUtf8(Path)
{
Data := ReadFileUtf8(Path)
FileDelete % Path
return Data
}

RemoveToolTip()
{
ToolTip
}

ToolTip(Text, Timeout := 0)
{
ToolTip % Text
if (Timeout) {
SetTimer RemoveToolTip, % -Timeout
}
}

WaitWindowNotActive(WinTitle, SleepAmount, Timeout)
{
Start := A_TickCount
@@ -171,9 +188,7 @@ HashFile(Path, Algorithm)
OutputPath := CreateTempFilePath()
Shell := ComObjCreate("WScript.Shell")
Shell.Run("cmd /c certutil -hashfile """ Path """ " Algorithm " >" OutputPath, 0, true)
FileRead Output, % "*P65001 " OutputPath
FileDelete % OutputPath
return StrSplit(Output, "`n", "`r", 3)[2]
return StrSplit(ConsumeFileUtf8(OutputPath), "`n", "`r", 3)[2]
}

LoadXml(String)
@@ -182,7 +197,7 @@ LoadXml(String)
Xml.setProperty("SelectionLanguage", "XPath")
Xml.async := false
if (!Xml.loadXML(String)) {
return false
return
}
return Xml
}
@@ -351,13 +366,6 @@ ShellOpenFolderAndSelect(Path, Paths, Flags)
global Version := "1.0.2"
global Url := "https://github.com/t5mat/night"

#SingleInstance Force

#MenuMaskKey vkFF

SetWinDelay -1 ; uh oh
SendMode Event

global MacroPrefix := "~ night - "
global PleFolderName := "night"
global HashMacroPrefix := "~ night "
@@ -462,7 +470,7 @@ InstallHashMacro(Hash, KeyCommandsXml)

Uninstall(KeyCommandsPath, PlePath)
{
FileRead KeyCommandsData, % "*P65001 " KeyCommandsPath
KeyCommandsData := ReadFileUtf8(KeyCommandsPath)

if ((KeyCommandsXml := LoadXml(KeyCommandsData))) {
UninstallKeyCommands(KeyCommandsXml)
@@ -660,19 +668,19 @@ global LocateMode

AutoExec()
{
SetWinDelay -1 ; uh oh
SendMode Event

if (!A_IsCompiled) {
XmlPath := A_ScriptDir "\night.xml"

FileRead XmlData, % "*P65001 " XmlPath
XmlHash := HashFile(XmlPath, "MD5")
XmlData := ReadFileUtf8(XmlPath)
} else {
XmlPath := CreateTempFilePath()
FileInstall night.xml, % XmlPath, true
FileInstall night.xml, % (XmlPath := CreateTempFilePath()), true

FileRead XmlData, % "*P65001 " XmlPath
XmlHash := HashFile(XmlPath, "MD5")

FileDelete % XmlPath
XmlData := ConsumeFileUtf8(XmlPath)
}

if (!(Xml := LoadXml(XmlData))) {
@@ -734,7 +742,7 @@ AutoExec()
IniWrite % PlePath, % SettingsPath, % "night", % "PlePath"
}

FileRead KeyCommandsData, % "*P65001 " KeyCommandsPath
KeyCommandsData := ReadFileUtf8(KeyCommandsPath)

if (!(KeyCommandsXml := LoadXml(KeyCommandsData)) || !IsValidKeyCommandsXml(KeyCommandsXml)) {
MsgBox % (0x0 | 0x10 | 0x40000), % "night", % "Could not load key commands file:`n" KeyCommandsPath
@@ -749,7 +757,7 @@ AutoExec()

Uninstall(KeyCommandsPath, PlePath)

FileRead KeyCommandsData, % "*P65001 " KeyCommandsPath
KeyCommandsData := ReadFileUtf8(KeyCommandsPath)
KeyCommandsXml := LoadXml(KeyCommandsData)

InstallKeyCommands(Xml, KeyCommandsXml)
@@ -924,7 +932,7 @@ $^+!WheelUp::Send % MacroKeys["Zoom - Zoom In On Waveform Vertically"]

$^+MButton::
LocateMode := Mod(LocateMode, 3) + 1
ToolTipTimeout("locate mode: " LocateModes[LocateMode], 1250)
ToolTip("locate mode: " LocateModes[LocateMode], 1250)
return

$^+WheelDown::
@@ -1212,8 +1220,8 @@ $f::TrySelectCurrentMenuItem(CurrentMenu, "Move to Pre-Fader") || TrySelectCurre

$q::
CloseCurrentMenuAndSend("{Enter}")
ControlSetText Edit1, % "-oo", A
ControlSend Edit1, % "{Enter}", A
ControlSetText % "Edit1", % "-oo", A
ControlSend % "Edit1", % "{Enter}", A
return

$r::TrySelectCurrentMenuItem(CurrentMenu, "Use Default Send Level")

0 comments on commit a36c988

Please sign in to comment.