[!--sizeo:3--][span style=\"font-size:12pt;line-height:100%\"][!--/sizeo--]— WSH TextFile Viewer —[/size]
A script for displaying a text file in a WSH panel
View a screenshot of my own foobar2000 rendering the script (upper right side):
!!Read this before using the script...
+ "WSH TextFile Viewer"
+
+ Displays a specified text file found in the same folder as the playing track in a foobar2000 panel.
+ When a track is played and the text file is not found, rather than display nothing, your panel will display:
+
+ _____________________________________________________
+ folder.txt
+
+
+ - To create the panel in your foobar2000 layout, use "WSH Panel Mod" component, and import this script.
+ It works with "Default User Interface" (DUI) or "Columns UI" (CUI).
+
+ - To display a text file with EVERY album one needs a very disciplined attitude to the presentation of his music collection;
+ it is time consuming, and essentially you are training yourself to be a professional librarian.
+ Personally, I find it highly educational and constructive.
+
+ - It is a good idea to create a standard name for your text file and stick to it;
+ My standard name for the text file is "folder.txt", which matches well with my standard name for all coverart "folder.jpg".
+ Also, for consistent display in foobar2000, try to create a standard template for your text file and stick to it;
+ To get you started, I have included a few sample templates further down this page.
+
+ Furthermore: If you discipline yourself to keep a TXT file in every album folder, it will be useful if
+ one day, filenames and tags are somehow all screwed up ...you have lost track of something,
+ you need to find where it is buried in your music collection...
+
+ So you fire up the Windows Command Prompt and type (example):
+ FINDSTR /I /S /P /M /C:"some string" "F:\my music" folder.txt
+ or for multiple items (example):
+ FINDSTR /I /S /P /M /C:"the beatles" "vinyl" "F:\my music" *.txt *.cue
+ and you have found your lost item(s) !!
+
+ - ALL text files MUST be saved with ANSI encoding (ie. not Unicode etc).
+ If you see wierd characters being rendered in your Panel, open the text file in "Notepad" and go to the menu:
+ File -> Save As... -> and choose "ANSI" from the Encoding drop-down.
+
+ - If your panel continues to show wierd characters instead of rendering the text file,
+ there may be more than one text file in the containing folder. Remove the other text files.
+
+ - You MUST use a Monospace Font if you want correct text indenting.
+ I chose "Arial monospace" as my personal favourite. Therefore, the default font in this script is set to "Arial monospace - size 10".
+ If it is not found, your Panel will default to your system font. To edit, go to the code section named "FONT SETTINGS".
+
+ - You can tweak text margins and alignments, if you wish. To edit, go to the code section named "DISPLAY PARAMETERS".
+
+ - I have edited this script to ONLY display text files named "folder.txt" ...ALL OTHER TEXT FILES WILL BE IGNORED !!!
+ If you prefer to change this to reading of ANY text file, then go to the code section named "TEXT FILE PARAMETERS"
WSH_TextFile_Viewer.txt — Note: I have made this really easy and user friendly; guided comments and explanations are placed all through the script.
/* :::::::::::::::::::::: Script Engine: JScript :::::::::::::::::::::::::::::::
================================================================================
================================================================================
================================================================================
================================================================================
+
+ "WSH TextFile Viewer"
+
+ Displays a specified text file found in the same folder as the playing track in a foobar2000 panel.
+ When a track is played and the text file is not found, rather than display nothing, your panel will display:
+
+ _____________________________________________________
+ folder.txt
+
+
+ - To create the panel in your foobar2000 layout, use "WSH Panel Mod" component, and import this script.
+ It works with "Default User Interface" (DUI) or "Columns UI" (CUI).
+
+ - To display a text file with EVERY album one needs a very disciplined attitude to the presentation of his music collection;
+ it is time consuming, and essentially you are training yourself to be a professional librarian.
+ Personally, I find it highly educational and constructive.
+
+ - It is a good idea to create a standard name for your text file and stick to it;
+ My standard name for the text file is "folder.txt", which matches well with my standard name for all coverart "folder.jpg".
+ Also, for consistent display in foobar2000, try to create a standard template for your text file and stick to it;
+ To get you started, I have included a few sample templates further down this page.
+
+ Furthermore: If you discipline yourself to keep a TXT file in every album folder, it will be useful if
+ one day, filenames and tags are somehow all screwed up ...you have lost track of something,
+ you need to find where it is buried in your music collection...
+
+ So you fire up the Windows Command Prompt and type (example):
+ FINDSTR /I /S /P /M /C:"some string" "F:\my music" folder.txt
+ or for multiple items (example):
+ FINDSTR /I /S /P /M /C:"the beatles" "vinyl" "F:\my music" *.txt *.cue
+ and you have found your lost item(s) !!
+
+ - ALL text files MUST be saved with ANSI encoding (ie. not Unicode etc).
+ If you see wierd characters being rendered in your Panel, open the text file in "Notepad" and go to the menu:
+ File -> Save As... -> and choose "ANSI" from the Encoding drop-down.
+
+ - If your panel continues to show wierd characters instead of rendering the text file,
+ there may be more than one text file in the containing folder. Remove the other text files.
+
+ - You MUST use a Monospace Font if you want correct text indenting.
+ I chose "Arial monospace" as my personal favourite. Therefore, the default font in this script is set to "Arial monospace - size 10".
+ If it is not found, your Panel will default to your system font. To edit, go to the code section named "FONT SETTINGS".
+
+ - You can tweak text margins and alignments, if you wish. To edit, go to the code section named "DISPLAY PARAMETERS".
+
+ - I have edited this script to ONLY display text files named "folder.txt" ...ALL OTHER TEXT FILES WILL BE IGNORED !!!
+ If you prefer to change this to reading of ANY text file, then go to the code section named "TEXT FILE PARAMETERS"
+
+
+ -- Enjoy ~derty2
+
+ -- This script is a modification of (".nfoo Viewer 1.1" ©2010 by Matthijs Brobbel). All credits go to him.
+ [http://code.google.com/p/foobar-silk/][http://matthijsb.deviantart.com/art/nfoo-Viewer-1-1-170638369]
+
================================================================================
================================================================================
// ------------------------------------------------------------------------
// --- Useful Characters For Composing Your Text File (Keyboard Mappings)
// ------------------------------------------------------------------------
— Em Dash Alt+0151
• Bullet Alt+0149
© Copyright Sign Alt+0169
================================================================================
================================================================================
// ---------------------------------------------------------------------
// --- Useful Template for a Classical Music album - START TEXT FILE
// ---------------------------------------------------------------------
Chicago Symphony Orchestra - Fritz Reiner, conductor
SERGEI PROKOFIEV (1891-1953): Lieutenant Kije, film score and symphonic suite for orchestra, Op.60 (1957)
IGOR STRAVINSKY (1882-1971): Song Of The Nightingale, symphonic poem for orchestra (1956)
• Composed, Classical, 20th Century, Orchestral Suite, Folk Tune, Tone Poem
• Most older listeners agree that Prokofiev's "Lieutenant Kije" suite was ideal repertoire for Fritz Reiner and the Chicago Symphony Orchestra. In this superb recording, Reiner and the Chicago were at the top of their form and their Kiji is witty, sassy, brave, ironic, and altogether hilarious. It was originally written for a movie. Contrastingly, Reiner and the Chicago were seemingly out of their element with Stravinsky's tone poem "Song of the Nightingale". With its spiky motifs, its primary colors, its hard harmonies, and its relentless rhythms, the repetoire did not seem a correct fit. But although their approach is essentially Straussian, Reiner and the Chicago still excel at Stravinsky's Nightingale. It was written as a tribute to Hans Christian Anderson.
____________________________________________________________________________________________________
_____
Vinyl LP 180g, RCA/Chesky #RC10, USA, Reissue from original 3-track master tape ~ Rip by NETTZ (Nov 2011)
———————— TRACKS ———————
Side 1
01. Prokofiev — Lieutenant Kije, Op.60
: The Birth of Kije
: Romance
: Kije's Wedding
: Troika
: The Burial of Kije
• Recorded: 1957
• Written: 1934; Paris, France
Side 2
02. Stravinsky — Song Of The Nightingale
: Presto
: Chinese March
: Song of The Nightingale
: The Mechanical Nightingale
: The Emperor's Displeasure at the departure of the real nightingale
: The Emperor's sickroom
: The real nightingale returns to thwart Death
: Funeral march and Finale
• Recorded: 1956
• Written: 1917; Switzerland
———————— CREDITS ———————
**Composed By – Igor Stravinsky, Sergei Prokofiev **Conductor – Fritz Reiner **Orchestra – Chicago Symphony Orchestra **Produced by - Richard Mohr **Recording Engineer - Lewis Layton ||| **Mastering Engineer – Jack Adelman **Executive Producers - David and Norman Chesky **Design [Photo] – Ben Rose **Liner Notes – Irving Kolodin
———————— NOTES ———————
Premium Vinyl Pressing HQ-180 (180 gram vinyl)
Audiophile re-issue of RCA LSC-2150
"Master Recordings Owned Exclusively by RCA Records, a label of BMG Music"
Prokofiev has alternative spelling of "Prokofieff" on this album.
This record was reproduced from the original three-track master session tape. The playback machine was an Ampex 300 series three track tape recorder totally retubed and rebuilt to the highest standards available today. The three tracks were mixed to two, using a modified Perfectionist Audio Components Pro Reference Tube Preamp. The signal was fed from the preamp directly into the lathe, bypassing the mixing console and all equalizers, thus eliminating one more set of electronic coloration.
———————— COMMENTS ———————
"..This (RC10) is one of Chesky’s best efforts, I like it better than the newer Classic Records version, and it's the LP that got me interested in RCA Living Stereo! Bravo Chesky.." ---vinylfanatics.com/analoglovers/page26.html
———————— RIP LOG ———————
Ripped by NETTZ | Nov 2011
Technical Info:
• Turntable: Roksan Radius III
• Tonearm: Audioquest PT-9
• Cartridge: Ortofon X5-MC (Moving Coil)
• Phono Cable: Van den Hul D-502 Hybrid
• Pre-amplifier: Counterpoint SA 5.1 (vacuum tube Sovtek 6922)
• Interconnect: balanced, Belden 1813A cable with Neutrik XLR connectors
• Analog to Digital Converter: EMU 1212M (configured for balanced input +4dBu, 0 dB Gain)
• Capture software: Goldwave 5.58
• Post processing: ClickRepair, setting: 20, reverse, wavelet x2
// -------------------------------------------------------------------
// --- Useful Template for a Classical Music album - END TEXT FILE
// -------------------------------------------------------------------
================================================================================
================================================================================
// -------------------------------------------------------------------
// --- Useful Template for a Popular Music album - START TEXT FILE
// -------------------------------------------------------------------
The Romantics — The Romantics (1980)
• Popular, Pop Rock, Power Pop, USA
• The Romantics didn't exactly reinvent the wheel with this album, but they sure knew how to make it roll, and for sheer party enhancing energy, this album is hard to beat. The songs are a glorious pastiche of period pop styles (think the Kinks and the Easybeats with a bit of the Hollies thrown in for melodic appeal) played with a hard-stomping energy and a genuine love for the vintage style that doesn't reek of nostalgia. The production is simple but smart enough to put the hooks at the energy end up front where they belong, and the Romantics never had a set of tunes this strong again.
____________________________________________________________________________
CD Album, Nemperor/Epic(Sony) #ZK 36273, USA, ©1993 ~ Exact Audio Copy 1.0b2
———————— TRACKS ————————
01. When I Look In Your Eyes
02. Tell It To Carrie
03. First In Line
04. Keep In Touch
05. Girl Next Door
06. What I Like About You
07. She's Got Everything
08. Till I See You Again
09. Hung On You
10. Little White Lies
11. Gimme One More Chance
———————— CREDITS ————————
**Bass, Vocals – Rich Cole **Drums, Vocals – Jimmy Marinos **Lead Guitar, Vocals – Mike Skill **Rhythm Guitar, Vocals – Wally Palmar **Producer – Peter Solley **Engineer – Steve Brown **Mastered By – Greg Calbi
———————— RIP LOG ————————
*** CD Rip by "JOHN CITIZEN" | Nov 2011 ***
Exact Audio Copy V1.0 beta 2 from 29. April 2011
EAC extraction logfile from 15. July 2011, 20:20
Used drive : TDK CDRW4800B Adapter: 2 ID: 1
Read mode : Secure
Utilize accurate stream : Yes
Defeat audio cache : Yes
Make use of C2 pointers : No
Read offset correction : 6
Overread into Lead-In and Lead-Out : No
Fill up missing offset samples with silence : Yes
Delete leading and trailing silent blocks : No
Null samples used in CRC calculations : Yes
Used interface : Native Win32 interface for Win NT & 2000
Used output format : Internal WAV Routines
Sample format : 44.100 Hz; 16 Bit; Stereo
TOC of the extracted CD
Track | Start | Length | Start sector | End sector
---------------------------------------------------------
1 | 0:00.00 | 3:01.10 | 0 | 13584
2 | 3:01.10 | 3:23.55 | 13585 | 28864
3 | 6:24.65 | 2:38.00 | 28865 | 40714
4 | 9:02.65 | 3:42.02 | 40715 | 57366
5 | 12:44.67 | 4:41.65 | 57367 | 78506
6 | 17:26.57 | 2:55.30 | 78507 | 91661
7 | 20:22.12 | 2:35.40 | 91662 | 103326
8 | 22:57.52 | 3:53.70 | 103327 | 120871
9 | 26:51.47 | 3:25.50 | 120872 | 136296
10 | 30:17.22 | 2:39.65 | 136297 | 148286
11 | 32:57.12 | 4:28.08 | 148287 | 168394
// -----------------------------------------------------------------
// --- Useful Template for a Popular Music album - END TEXT FILE
// -----------------------------------------------------------------
================================================================================
================================================================================
================================================================================
================================================================================
*/
function readTXT(){
displaytext = "";
txt = "————————————————————————————————————————————————————————\nfolder.txt";
if (! fb.IsPlaying) return;
try{
var xpath = fb.TitleFormat("%path%").EvalWithMetadb(fb.GetNowPlaying());
var path = xpath.substring(0, xpath.lastIndexOf("\\")) + "\\";
var Folder = fso.GetFolder(path);
var filelist = new Enumerator(Folder.Files);
for (i=0;!filelist.atEnd();filelist.moveNext()) {
if (filelist.item().name.match(/.*\.txt$/)) {
// ================================================================================================= TEXT FILE PARAMETERS - START
//txtfile = fso.OpenTextFile(path + filelist.item().name, 1, -1); // <---------- THIS IS THE ORIGINAL CODE --- Enables reading of ANY text file found in folder of playing track --- !!KNOWN PROBLEM: it opens text files from wrong location in some instances, such as when opening URL STREAMS from a playlist ------------>
//txtfile = fso.OpenTextFile(path + "folder.txt", 1, -1); <---------- "-1" PARAMETER --- Always auto-creates a blank specified text file (if not exist) in the same folder as the track being played ------------>
// --- MY PREFERENCE: If specified text file (folder.txt) exists in folder of playing track, display it, ELSE show specified characters (at line 273).
txtfile = fso.OpenTextFile(path + "folder.txt", 1, 1);
// ================================================================================================= TEXT FILE PARAMETERS - END
txt = txtfile.ReadALL() + "\n\n";
txtfile.Close();
//displaytext = displaytext + txt;
}
displaytext = txt;
}
}
catch(e){
try {
txtfile.Close();
}
catch(f) {
}
}
calc();
window.Repaint();
}
// ================================================================================================= DISPLAY PARAMETERS - START
// <---------- You can tweak the text margins and alignments in the panel by adjusting the parameters here ---------->
// <---------- FYI: Centering text can be done with DT_CENTER . add it to the line like this: "gr.GdiDrawText(displaytext ... DT_NOPREFIX | DT_CENTER);" ---------->
function on_paint(gr){
gr.FillGradRect( 0, 0, ww, wh, 90, backcolor, backcolor);
gr.GdiDrawText(displaytext, gfont, txtcolor, 5, offset + 10, ww-10, 60*wh,DT_WORDBREAK | DT_CALCRECT | DT_NOPREFIX);
}
// <------------------------------------- Backup of Original Script -------------------------------------------------------->
// function on_paint(gr){
// gr.FillGradRect( 0, 0, ww, wh, 90, backcolor, backcolor);
// gr.GdiDrawText(displaytext, gfont, txtcolor, 10, offset + 10, ww-20, 50*wh,DT_WORDBREAK | DT_CALCRECT | DT_NOPREFIX);
// }
// <------------------------------------------------------------------------------------------------------------------------->
// ================================================================================================= DISPLAY PARAMETERS - END
function on_mouse_rbtn_up(x, y){
var _backgroundcolor = window.CreatePopupMenu();
var _textcolor = window.CreatePopupMenu();
var _menu = window.CreatePopupMenu();
var idx;
_menu.AppendMenuItem(MF_STRING, 1, "Update");
_menu.AppendMenuItem(MF_SEPARATOR, 0, 0);
_menu.AppendMenuItem(MF_STRING | MF_POPUP, _textcolor.ID, "Text Color");
_textcolor.AppendMenuItem(MF_STRING, 98, "Foobar Text");
_textcolor.AppendMenuItem(MF_STRING, 99, "Foobar Highlight");
_textcolor.AppendMenuItem(MF_STRING, 101, "White");
_textcolor.AppendMenuItem(MF_STRING, 102, "Red");
_textcolor.AppendMenuItem(MF_STRING, 103, "Green");
_textcolor.AppendMenuItem(MF_STRING, 104, "Blue");
_textcolor.AppendMenuItem(MF_STRING, 105, "Yellow");
_textcolor.AppendMenuItem(MF_STRING, 106, "Black");
_menu.AppendMenuItem(MF_STRING | MF_POPUP, _backgroundcolor.ID, "Background Color");
_backgroundcolor.AppendMenuItem(MF_STRING, 210, "Foobar Background");
_backgroundcolor.AppendMenuItem(MF_STRING, 211, "White");
_backgroundcolor.AppendMenuItem(MF_STRING, 212, "Red");
_backgroundcolor.AppendMenuItem(MF_STRING, 213, "Green");
_backgroundcolor.AppendMenuItem(MF_STRING, 214, "Blue");
_backgroundcolor.AppendMenuItem(MF_STRING, 215, "Brown-Black");
_backgroundcolor.AppendMenuItem(MF_STRING, 216, "Black");
if(window.GetProperty("textcolor")==101){
_textcolor.CheckMenuItem(101, window.GetProperty("textcolor"));}
else if (window.GetProperty("textcolor")==102)
{_textcolor.CheckMenuItem(102, window.GetProperty("textcolor"));}
else if (window.GetProperty("textcolor")==103)
{_textcolor.CheckMenuItem(103, window.GetProperty("textcolor"));}
else if (window.GetProperty("textcolor")==104)
{_textcolor.CheckMenuItem(104, window.GetProperty("textcolor"));}
else if (window.GetProperty("textcolor")==105)
{_textcolor.CheckMenuItem(105, window.GetProperty("textcolor"));}
else if (window.GetProperty("textcolor")==106)
{_textcolor.CheckMenuItem(106, window.GetProperty("textcolor"));}
else if (window.GetProperty("textcolor")==98)
{_textcolor.CheckMenuItem(98, window.GetProperty("textcolor"));}
else if (window.GetProperty("textcolor")==99)
{_textcolor.CheckMenuItem(99, window.GetProperty("textcolor"));}
if(window.GetProperty("backgroundcolor")==211){
_backgroundcolor.CheckMenuItem(211, window.GetProperty("backgroundcolor"));}
else if (window.GetProperty("backgroundcolor")==212)
{_backgroundcolor.CheckMenuItem(212, window.GetProperty("backgroundcolor"));}
else if (window.GetProperty("backgroundcolor")==213)
{_backgroundcolor.CheckMenuItem(213, window.GetProperty("backgroundcolor"));}
else if (window.GetProperty("backgroundcolor")==214)
{_backgroundcolor.CheckMenuItem(214, window.GetProperty("backgroundcolor"));}
else if (window.GetProperty("backgroundcolor")==215)
{_backgroundcolor.CheckMenuItem(215, window.GetProperty("backgroundcolor"));}
else if (window.GetProperty("backgroundcolor")==216)
{_backgroundcolor.CheckMenuItem(216, window.GetProperty("backgroundcolor"));}
else if (window.GetProperty("backgroundcolor")==210)
{_backgroundcolor.CheckMenuItem(210, window.GetProperty("backgroundcolor"));}
_menu.AppendMenuItem(MF_STRING, 8, "Configure");
idx = _menu.TrackPopupMenu(x, y);
switch(idx) {
case 1:readTXT();calc();window.Repaint();break;
case 8:window.ShowConfigure();break;
case 98:window.SetProperty("textcolor", 98);txtcolor = g_textcolor;window.Repaint();break;
case 99:window.SetProperty("textcolor", 99);txtcolor = g_textcolor_hl;window.Repaint();break;
case 101:window.SetProperty("textcolor", 101);txtcolor = RGB(255,255,255);window.Repaint();break;
case 102:window.SetProperty("textcolor", 102);txtcolor = RGB(255,50,50);window.Repaint();break;
case 103:window.SetProperty("textcolor", 103);txtcolor = RGB(50,255,50);window.Repaint();break;
case 104:window.SetProperty("textcolor", 104);txtcolor = RGB(150,150,250);window.Repaint();break;
case 105:window.SetProperty("textcolor", 105);txtcolor = RGB(255,255,50);window.Repaint();break;
case 106:window.SetProperty("textcolor", 105);txtcolor = RGB(10,10,10);window.Repaint();break;
case 210:window.SetProperty("backgroundcolor", 210);backcolor= g_backcolor;window.Repaint();break;
case 211:window.SetProperty("backgroundcolor", 211);backcolor= RGB(255,255,255);window.Repaint();break;
case 212:window.SetProperty("backgroundcolor", 212);backcolor= RGB(255,50,50);window.Repaint();break;
case 213:window.SetProperty("backgroundcolor", 213);backcolor= RGB(50,255,50);window.Repaint();break;
case 214:window.SetProperty("backgroundcolor", 214);backcolor= RGB(10,36,106);window.Repaint();break;
case 215:window.SetProperty("backgroundcolor", 215);backcolor= RGB(28,28,28);window.Repaint();break;
case 216:window.SetProperty("backgroundcolor", 216);backcolor= RGB(0,0,0);window.Repaint();break;}
_menu.Dispose();_textcolor.Dispose();_backgroundcolor.Dispose();return true;
}
DT_CENTER = 0x00000001;
DT_VCENTER = 0x00000004;
DT_WORDBREAK = 0x00000010;
DT_CALCRECT = 0x00000400;
DT_NOPREFIX = 0x00000800;
MF_SEPARATOR = 0x00000800;
MF_ENABLED = 0x00000000;
MF_UNCHECKED = 0x00000000;
MF_CHECKED = 0x00000008;
MF_STRING = 0x00000000;
MF_POPUP = 0x00000010;
var fso = new ActiveXObject("Scripting.FileSystemObject");
var dui = window.InstanceType;
var displaytext = "";
// ================================================================================================= FONT SETTINGS - START
// <---------- gdi.Font is changed, the last paramter is style flags ---------->
// <---------- Style Flags Reference: FontStyleRegular = 0 | FontStyleBold = 1 | FontStyleItalic = 2 | FontStyleBoldItalic = 3 | FontStyleUnderline = 4 | FontStyleStrikeout = 8 ---------->
// <---------- Choose Font: Un-comment the font you want to use !! Make sure the target font exists !! You MUST use a monospace font if you want correct text indenting ---------->
// --- MY PREFERENCE: Arial monospace has a good overall feature set. It renders a large set of characters, It displays well at small sizes, is easy to read, and has a dotted zero.
var gfont =gdi.Font("Arial monospaced for SAP", 10, 0);
// --- MY SECOND PREFERENCE: They are nearly identical. Have unembelished zero (No slashes or dots) which is quite nice.
// var gfont =gdi.Font("OCRBLetM", 10, 0);
// var gfont =gdi.Font("OCR-BczykNorm", 11, 0);
// ================================================================================================= FONT SETTINGS - END
var offset =0;
var ColorTypeDUI = {text: 0,background: 1,highlight: 2,selection: 3};
var ColorTypeCUI = {text: 0,selection_text: 1,inactive_selection_text: 2,background: 3,selection_background: 4,inactive_selection_background: 5,active_item_frame: 6};
String.prototype.count=function(s1){return (this.length - this.replace(new RegExp(s1,"g"), '').length) / s1.length;}
function RGB(r,g,b) {
return (0xff000000|(r<<16)|(g<<8)|(b));
}
function get_colors() {
if (dui) {
g_textcolor = window.GetColorDUI(ColorTypeDUI.text);
g_textcolor_hl = window.GetColorDUI(ColorTypeDUI.highlight);
g_backcolor = window.GetColorDUI(ColorTypeDUI.background);
} else {
g_textcolor = window.GetColorCUI(ColorTypeCUI.text);
g_textcolor_hl = window.GetColorCUI(ColorTypeCUI.text);
g_backcolor = window.GetColorCUI(ColorTypeCUI.background);
}
}
function on_size(){
ww = window.Width;
wh = window.Height;
calc();
window.Repaint();
}
function calc(){
temp_bmp = gdi.CreateImage(1, 1);
temp_gr = temp_bmp.GetGraphics();
arr = temp_gr.GdiDrawText(displaytext, gfont, g_textcolor, 0, 0, ww, wh-40,DT_CENTER| DT_WORDBREAK | DT_VCENTER | DT_CALCRECT | DT_NOPREFIX).toArray();
textheight = arr[3] - arr[1] + (wh) + (displaytext.count("\n") * 3);
temp_bmp.ReleaseGraphics(temp_gr);
temp_bmp.Dispose();
temp_gr = null;
temp_bmp = null;offset = 0;
}
function on_mouse_wheel(delta){
step = gfont.height * 5;
offset += (delta * step);
if(offset > 0 || textheight < wh) {
offset = 0;}
else {
temp = -textheight + wh;
if(offset < temp) offset = Math.round(temp / step) * step;
}
window.Repaint();
}
function on_playback_new_track(){
readTXT();calc();
window.Repaint();
}
get_colors();
on_size();
tc = window.GetProperty("textcolor",98);
if(tc==98){txtcolor = g_textcolor}else if(tc==99){txtcolor=g_textcolor_hl}else if(tc ==101){txtcolor = RGB(255,255,255);}else if(tc==102){txtcolor=RGB(255,50,50)}else if(tc==103){txtcolor=RGB(50,255,50)}else if(tc==104){txtcolor=RGB(150,150,250)}else if(tc==105){txtcolor=RGB(255,255,50)}else if(tc==106){txtcolor=RGB(10,10,10)};
bc = window.GetProperty("backgroundcolor",210);
if(bc==210){backcolor = g_backcolor}else if(bc ==211){backcolor = RGB(255,255,255);}else if(bc==212){backcolor=RGB(255,50,50)}else if(bc==213){backcolor=RGB(50,255,50)}else if(bc==214){backcolor=RGB(10,36,106)}else if(bc==215){backcolor=RGB(28,28,28)}else if(bc==216){backcolor=RGB(0,0,0)};
readTXT();
window.Repaint();