maybe the error is on line 159 on one of your imported scripts?
Except for the flags.txt and helpers.txt that are the same ones that came with version 1.2.1, the only imported script that has that number of lines is inputobjects.js:
function Buttons(h, margin) {
this.type = "eb";
this.x1 = 0;
this.x2 = 0;
this.y = 10;
this.w1 = 0;
this.w2 = 0;
this.h = 0;
this.fh = eval(h);
this.margin = eval(margin);
this.colourkw = RGB(229, 229, 229);
this.colourkwb = RGB(0, 0, 0);
this.colourkwh = RGB(255, 255, 200);
this.colourkwbh = RGB(0, 0, 0);
this.colourkws = RGB(229, 229, 229);
this.colourkwsb = RGB(104, 104, 104);
this.colourkwsh = RGB(255, 255, 200);
this.colourkwsbh = RGB(104, 104, 104);
this.colourd = RGB(255, 255, 255);
this.hover1 = false;
this.hover2 = false;
this.gfont = gdi.Font("Arial Unicode MS", this.fh, 0);
this.resize = function () {
this.fh = eval(h);
this.margin = eval(margin);
}
this.redraw = function () {
window.RepaintRect (this.x1, this.y, this.w1 + this.margin + this.w2, this.h);
}
this.draw = function (gr) {
nfo1 = gr.MeasureString("P", this.gfont, 0, 0, 10000, 100, DT_CALCRECT);
nfo2 = gr.MeasureString("EDIT", this.gfont, 0, 0, 10000, 100, DT_CALCRECT);
this.x1 = window.Width - nfo1.Width - nfo2.Width - 11 - 7 * this.margin;
this.x2 = window.Width - nfo2.Width - 11 - 3 * this.margin;
this.w1 = nfo1.Width + 3 * this.margin;
this.w2 = nfo2.Width + 3 * this.margin;
this.h = nfo1.Height + 2 * this.margin;
if (this.hover1) {
colourback1 = this.colourkwbh;
colour1 = this.colourkwh;
}
else {
colourback1 = this.colourkwb;
colour1 = this.colourkw;
}
if (edit) {
if (this.hover2) {
colourback2 = this.colourkwsbh;
colour2 = this.colourkwsh;
}
else {
colourback2 = this.colourkwsb;
colour2 = this.colourkws;
}
}
else {
if (this.hover2) {
colourback2 = this.colourkwbh;
colour2 = this.colourkwh;
}
else {
colourback2 = this.colourkwb;
colour2 = this.colourkw;
}
}
gr.FillRoundRect(this.x1, this.y, this.w1, this.h, 8, 8, colourback1);
gr.DrawRoundRect(this.x1, this.y, this.w1, this.h, 8, 8, 3, colour1);
gr.DrawString("P", this.gfont, colour1, this.x1, this.y, this.w1, this.h, StringFormat(1, 1));
gr.FillRoundRect(this.x2, this.y, this.w2, this.h, 8, 8, colourback2);
gr.DrawRoundRect(this.x2, this.y, this.w2, this.h, 8, 8, 3, colour2);
gr.DrawString("EDIT", this.gfont, colour2, this.x2, this.y, this.w2, this.h, StringFormat(1, 1));
}
this.onMove = function (x, y) {
hv1 = this.hover1;
hv2 = this.hover2;
if ((this.x1 < x) && (x < (this.x1 + this.w1)) && (this.y < y) && (y < (this.y + this.h))) {
this.hover1 = true;
cursorhover = true
} else
this.hover1 = false;
if ((this.x2 < x) && (x < (this.x2 + this.w2)) && (this.y < y) && (y < (this.y + this.h))) {
this.hover2 = true;
cursorhover = true
} else
this.hover2 = false;
if (hv1 != this.hover1 || hv2 != this.hover2) this.redraw();
}
this.onClick = function (x, y) {
if (this.hover1) fb.RunContextCommandWithMetadb("Properties", g_handle);
if (this.hover2) {
if (edit) {
edit = false;
inputobjectsSave();
}
else {
edit = true;
}
inputobjectsRedraw();
}
}
this.load = function () {
}
this.save = function () {
}
}
function ShowMultiLine(title, tag, x, y, tw, tbw, tbh, h, margin) {
this.type = "sml";
this.title = title;
this.tag = tag;
this.content = "";
this.contentbak = "";
this.contentlines = new Array();
this.nrlines = 1;
this.tleft = eval(x);
this.left = eval(x) + eval(tw);
this.top = eval(y);
this.tw = eval(tw);
this.w = eval(tbw);
this.th = eval(tbh);
this.fh = eval(h);
this.margin = eval(margin);
this.h = 0;
this.scroll = 0;
this.scrollubut = false;
this.scrolldbut = false;
this.colourkw = RGB(229, 229, 229);
this.colourkwh = RGB(255, 255, 200);
this.colourb = RGB(255, 255, 255);
this.colourba = RGB(255, 255, 200);
this.colourd = RGB(255, 255, 255);
this.colourt = RGB(192, 192, 192);
this.colourttb = RGB(0, 0, 0);
this.hover = false;
this.splitagain = false;
this.gfont = gdi.Font("Arial Unicode MS", this.fh, 0);
this.gfontt = gdi.Font("Arial Unicode MS", 2 * this.fh / 4, 0);
this.resize = function () {
this.tleft = eval(x);
this.left = eval(x) + eval(tw);
this.top = eval(y);
this.tw = eval(tw);
this.w = eval(tbw);
this.th = eval(tbh);
this.fh = eval(h);
this.margin = eval(margin);
}
this.redraw = function () {
window.RepaintRect (this.left, this.top, this.w, this.th * this.h);
}
this.draw = function (gr) {
this.h = nfo.Height;
this.splitcontent(gr);
//title
gr.DrawString(this.title, this.gfontt, this.colourt, this.tleft, this.top, this.tw - this.margin, this.h, StringFormat(2, 2));
//content
for (n = this.scroll; n < (this.th + this.scroll); n++) {
if (n >= this.nrlines) break;
gr.GdiDrawText(this.contentlines[n], this.gfont, this.colourd, this.left + this.margin, this.top + (n - this.scroll) * this.h, this.w - this.margin, this.h, DT_NOPREFIX);
}
//scrollbar
if ((this.hover) && ((this.scroll > 0) || (this.scroll < (this.nrlines - this.th)))) {
if (this.scrollubut) colour = this.colourkwh; else colour = this.colourkw;
gr.DrawRect(this.left + this.w - this.h / 2, this.top, this.h / 2 - 1, this.h / 2 - 1, 1, colour);
gr.GdiDrawText("▲", this.gfont, colour, this.left + this.w - this.h / 2, this.top - this.h / 4, this.h / 2, this.h, DT_NOPREFIX | DT_CENTER);
if (this.scrolldbut) colour = this.colourkwh; else colour = this.colourkw;
gr.DrawRect(this.left + this.w - this.h / 2, this.top + (this.th - 0.5) * this.h, this.h / 2 - 1, this.h / 2 - 1, 1, colour);
gr.GdiDrawText("▼", this.gfont, colour, this.left + this.w - this.h / 2, this.top + (this.th - 0.75) * this.h, this.h / 2, this.h, DT_NOPREFIX | DT_CENTER);
gr.DrawLine(this.left + this.w - this.h / 2, this.top + this.h / 2 + this.scroll / (this.nrlines - this.th) * ((this.th - 1) * this.h - 5) + 2, this.left + this.w, this.top + this.h / 2 + this.scroll / (this.nrlines - this.th) * ((this.th - 1) * this.h - 5) + 2, 3, this.colourkw);
}
}
this.onMove = function (x, y) {
hv = this.hover;
hvu = this.scrollubut;
hvd = this.scrolldbut;
if ((this.left < x) && (x < (this.left + this.w)) && (this.top < y) && (y < (this.top + this.th * this.h)))
this.hover = true
else
this.hover = false;
if ((this.left + this.w - this.h / 2 < x) && (x < (this.left + this.w)) && (this.top < y) && (y < (this.top + this.h / 2)) && (this.scroll > 0)) {
this.scrollubut = true;
cursorhover = true
}
else
this.scrollubut = false;
if ((this.left + this.w - this.h / 2 < x) && (x < (this.left + this.w)) && ((this.top + (this.th - 0.5) * this.h) < y) && (y < (this.top + this.th * this.h)) && (this.scroll < (this.nrlines - this.th))) {
this.scrolldbut = true;
cursorhover = true
}
else
this.scrolldbut = false;
if (hv != this.hover || hvu != this.scrollubut || hvd != this.scrolldbut) this.redraw();
}
this.onClick = function (x, y) {
if (this.scrollubut) this.scroll -= 1;
if (this.scrolldbut) this.scroll += 1;
this.redraw;
}
this.splitcontent = function (gr) {
this.contentbak = this.content;
n = 0;
tmpstr = this.content;
while (tmpstr.length > 0) {
oldtmpstr = tmpstr;
tmpinfo = gr.MeasureString(tmpstr, this.gfont, 0, 0, 10000, 100, DT_NOPREFIX | DT_CALCRECT);
while (tmpinfo.width > (this.w - 2 * this.margin)) {
tmpstr = tmpstr.slice(0, -1);
while ((tmpstr.slice(-1) != " ") && (tmpstr.length > 0)) {
tmpstr = tmpstr.slice(0, -1);
}
tmpinfo = gr.MeasureString(tmpstr, this.gfont, 0, 0, 10000, 100, DT_NOPREFIX | DT_CALCRECT);
}
this.contentlines[n] = tmpstr;
tmpstr = oldtmpstr.slice(tmpstr.length);
n++;
}
this.nrlines = n;
}
this.load = function () {
idx = metadata.MetaFind(this.tag);
if (idx > metadata.MetaCount) this.content = ""; else this.content = metadata.MetaValue(idx, 0);
this.splitagain = true;
}
this.save = function () {
}
}
function SplitterInputBox(title, tag, splittertag, x, y, tw, tbw, h, margin) {
this.type = "ib";
this.title = title;
this.tag = tag;
this.splittertag = splittertag;
this.editsep = ";";
this.content = new Array();
this.contentedit = "";
this.contenteditbak = "";
this.nrvalues = 0;
this.tleft = eval(x);
this.left = eval(x) + eval(tw);
this.top = eval(y);
this.tw = eval(tw);
this.w = eval(tbw);
this.fh = eval(h);
this.margin = eval(margin);
this.h = 0;
this.colourb = RGB(255, 255, 255);
this.colourba = RGB(255, 255, 200);
this.colourd = RGB(255, 255, 255);
this.colourt = RGB(192, 192, 192);
this.colourttb = RGB(0, 0, 0);
this.active = false;
this.hover = false;
this.specialchar = "";
this.gfont = gdi.Font("Arial Unicode MS", this.fh, 0);
this.gfontt = gdi.Font("Arial Unicode MS", 2 * this.fh / 4, 0);
this.resize = function () {
this.tleft = eval(x);
this.left = eval(x) + eval(tw);
this.top = eval(y);
this.tw = eval(tw);
this.w = eval(tbw);
this.fh = eval(h);
this.margin = eval(margin);
}
this.redraw = function () {
window.RepaintRect (this.left, this.top, this.w, this.h);
}
this.draw = function (gr) {
sepcolour = RGB(127, 127, 127);
nfo = gr.MeasureString("n", this.gfont, 0, 0, 10000, 100, DT_CALCRECT);
sepinfo = gr.MeasureString(this.editsep, this.gfont, 0, 0, 10000, 100, DT_NOPREFIX | DT_CALCRECT);
this.h = nfo.Height;
//title
gr.DrawString(this.title, this.gfontt, this.colourt, this.tleft, this.top, this.tw - this.margin, this.h, StringFormat(2, 2));
if (!this.active) {
if (this.hover) gr.DrawRect(this.left, this.top, this.w - 1, this.h - 1, 1, this.colourba);
//content not active
pos = 0;
tmpstr = "";
for (n = 0 ; n < this.nrvalues; n++) {
if ((n % 2) == 1) {
if (this.content[n] == "")
sep = this.editsep;
else
sep = this.content[n];
pos += 0.5*nfo.Width;
switch (sep){
case ",": pos -= 0.5*nfo.Width; break;
case ":": pos -= 0.5*nfo.Width; break;
case ";": pos -= 0.5*nfo.Width; break;
}
tmpstr += this.sep;
if (pos < (this.w - 2 * this.margin)) gr.GdiDrawText(sep, this.gfont, sepcolour, this.left + this.margin + pos, this.top, this.w - 2 * this.margin - pos, this.h, DT_NOPREFIX);
info = gr.MeasureString(sep, this.gfont, 0, 0, 10000, 100, DT_NOPREFIX | DT_CALCRECT);
pos += info.Width;
pos += 0.5*nfo.Width;
}
else {
tmpstr += this.content[n];
if (pos < (this.w - 2 * this.margin)) gr.GdiDrawText(this.content[n], this.gfont, this.colourd, this.left + this.margin + pos, this.top, this.w - 2 * this.margin - pos, this.h, DT_NOPREFIX);
info = gr.MeasureString(this.content[n], this.gfont, 0, 0, 10000, 100, DT_NOPREFIX | DT_CALCRECT);
pos += info.Width;
}
}
}
else {
gr.FillSolidRect(this.left, this.top, this.w, this.h - 1, this.colourb);
//content active
info = gr.MeasureString(this.contentedit, this.gfont, 0, 0, 10000, 100, DT_NOPREFIX | DT_CALCRECT);
flg = DT_NOPREFIX;
befcur = this.contentedit.slice(0, this.cursor);
tbw = this.w
cursorinfo = gr.MeasureString(befcur, this.gfont, 0, 0, 10000, 100, DT_NOPREFIX | DT_CALCRECT);
cend = false;
drwtxt = this.contentedit;
if (cursorinfo.Width > (this.w - this.margin - nfo.Width)) {
flg = DT_NOPREFIX | DT_RIGHT;
cend = true;
drwtxt = befcur;
tbw -= 0.5 * nfo.Width;
}
gr.GdiDrawText(drwtxt, this.gfont, this.colourttb, this.left + this.margin, this.top, tbw - 2 * this.margin, this.h, flg);
//cursor
if (cend) {
gr.FillSolidRect(this.left + tbw - this.margin, this.top + 1.1 * this.fh, 0.5 * nfo.Width, 2, this.colourttb);
}
else {
cursorinfo=gr.MeasureString(this.contentedit.slice(0, this.cursor), this.gfont, 0, 0, 10000, 100, DT_NOPREFIX | DT_CALCRECT);
gr.FillSolidRect(this.left + this.margin + cursorinfo.Width, this.top + 1.1 * this.fh, 0.5 * nfo.Width, 2, this.colourttb);
}
}
}
this.onMove = function (x, y) {
hv = this.hover;
if ((this.left < x) && (x < (this.left + this.w)) && (this.top < y) && (y < (this.top + this.h)) && edit) {
this.hover = true;
cursorhover = true;
}
else
this.hover = false;
if (hv != this.hover) this.redraw();
}
this.onClick = function (x, y) {
if (this.hover) {
if (!this.active) {
this.active = true;
this.cursor = this.contentedit.length;
this.special = false;
}
}
else {
this.save();
}
}
this.loadeditstr = function () {
this.contenteditbak = this.contentedit;
this.contentedit = this.content.join(";");
}
this.spliteditstr = function () {
tmparr = new Array ();
tmpstr = this.contentedit;
editseptrim = this.editsep;
if (editseptrim.slice(0, 1) == " ") editseptrim = editsepttrim.slice(1);
if (editseptrim.slice(-1) == " ") editseptrim = editseptrim.slice(0, editseptrim.length - 1);
m = 0;
do {
seppos = tmpstr.indexOf(editseptrim);
if (seppos == -1) {
tmparr[m] = tmpstr;
}
else {
tmparr[m] = tmpstr.slice(0, seppos);
tmpstr = tmpstr.slice(seppos + 1);
if (tmpstr.slice(0, 1) == " ") tmpstr = tmpstr.slice(1);
}
if (tmparr[m].slice(-1) == " ") tmparr[m] = tmparr[m].slice(0, tmparr[m].Length - 1);
m++;
} while (seppos != -1);
this.content = tmparr;
this.nrvalues = m;
}
this.load = function () {
this.content.length = 0;
idx1 = metadata.MetaFind(this.tag);
idx2 = metadata.MetaFind(this.splittertag);
if (idx1 > metadata.MetaCount)
this.nrvalues = 0;
else {
this.nrvalues = metadata.MetaValueCount(idx1);
if (this.nrvalues > 1) this.nrvalues = (2 * this.nrvalues) - 1;
}
if (idx2 > metadata.MetaCount)
splitters = 0;
else {
splitters = metadata.MetaValueCount(idx2);
}
for (n = 0 ; n < this.nrvalues; n++) {
if ((n % 2) == 0)
this.content[n] = metadata.MetaValue(idx1, n / 2);
else
if (n < (splitters * 2))
this.content[n] = metadata.MetaValue(idx2, Math.floor(n / 2));
else
this.content[n] = "";
}
this.active = false;
this.loadeditstr();
}
this.save = function () {
if (this.contentedit != this.contenteditbak && this.active) {
this.spliteditstr();
metadata.MetaRemoveField(this.tag);
metadata.MetaRemoveField(this.splittertag);
idx1 = metadata.MetaAdd(this.tag, this.content[this.nrvalues - 1]);
if (this.nrvalues > 1) idx2 = metadata.MetaAdd(this.splittertag, this.content[this.nrvalues - 2]);
for (n = this.nrvalues - 3 ; n > -1; n--) {
if ((n % 2) == 0)
metadata.MetaInsertValue(idx1, 0, this.content[n]);
else
if (this.nrvalues > 1) metadata.MetaInsertValue(idx2, 0, this.content[n]);
}
g_handle.UpdateFileInfo(metadata);
this.active = false;
this.loadeditstr();
reload = true;
window.Repaint();
}
else
this.active = false;
}
this.escape = function () {
this.contentedit = tb.contenteditbak;
this.cursor = tb.contentedit.length;
}
}
function InputBox(title, tag, multivalue, x, y, tw, tbw, h, margin) {
this.type = "ib";
this.title = title;
this.tag = tag;
this.multivalue = multivalue;
this.editsep = "; ";
this.content = new Array();
this.contentedit = "";
this.contenteditbak = "";
this.nrvalues = 0;
this.tleft = eval(x);
this.left = eval(x) + eval(tw);
this.top = eval(y);
this.tw = eval(tw);
this.w = eval(tbw);
this.fh = eval(h);
this.margin = eval(margin);
this.h = 0;
this.colourb = RGB(255, 255, 255);
this.colourba = RGB(255, 255, 200);
this.colourd = RGB(255, 255, 255);
this.colourt = RGB(192, 192, 192);
this.colourttb = RGB(0, 0, 0);
this.active = false;
this.hover = false;
this.specialchar = "";
this.gfont = gdi.Font("Arial Unicode MS", this.fh, 0);
this.gfontt = gdi.Font("Arial Unicode MS", 2 * this.fh / 4, 0);
this.resize = function () {
this.tleft = eval(x);
this.left = eval(x) + eval(tw);
this.top = eval(y);
this.tw = eval(tw);
this.w = eval(tbw);
this.fh = eval(h);
this.margin = eval(margin);
}
this.redraw = function () {
window.RepaintRect (this.left, this.top, this.w, this.h);
}
this.draw = function (gr) {
this.left = this.tleft + this.tw;
sepcolour = RGB(127, 127, 127);
nfo = gr.MeasureString("n", this.gfont, 0, 0, 10000, 100, DT_CALCRECT);
sepinfo = gr.MeasureString(this.editsep, this.gfont, 0, 0, 10000, 100, DT_NOPREFIX | DT_CALCRECT);
this.h = nfo.Height;
//title
gr.DrawString(this.title, this.gfontt, this.colourt, this.tleft, this.top, this.tw - this.margin, this.h, StringFormat(2, 2));
if (!this.active) {
if (this.hover) gr.DrawRect(this.left, this.top, this.w - 1, this.h - 1, 1, this.colourba);
//content not active
pos = 0;
tmpstr = "";
for (n = 0 ; n < this.nrvalues; n++) {
if (n != 0) {
tmpstr += this.editsep;
if (pos < (this.w - 2 * this.margin)) gr.GdiDrawText(this.editsep, this.gfont, sepcolour, this.left + this.margin + pos, this.top, this.w - 2 * this.margin - pos, this.h, DT_NOPREFIX);
info = gr.MeasureString(this.editsep, this.gfont, 0, 0, 10000, 100, DT_NOPREFIX | DT_CALCRECT);
pos += info.Width;
}
tmpstr += this.content[n];
if (pos < (this.w - 2 * this.margin)) gr.GdiDrawText(this.content[n], this.gfont, this.colourd, this.left + this.margin + pos, this.top, this.w - 2 * this.margin - pos, this.h, DT_NOPREFIX);
info = gr.MeasureString(this.content[n], this.gfont, 0, 0, 10000, 100, DT_NOPREFIX | DT_CALCRECT);
pos += info.Width;
}
}
else {
gr.FillSolidRect(this.left, this.top, this.w, this.h - 1, this.colourb);
//content active
info = gr.MeasureString(this.contentedit, this.gfont, 0, 0, 10000, 100, DT_NOPREFIX | DT_CALCRECT);
flg = DT_NOPREFIX;
befcur = this.contentedit.slice(0, this.cursor);
tbw = this.w
cursorinfo = gr.MeasureString(befcur, this.gfont, 0, 0, 10000, 100, DT_NOPREFIX | DT_CALCRECT);
cend = false;
drwtxt = this.contentedit;
if (cursorinfo.Width > (this.w - this.margin - nfo.Width)) {
flg = DT_NOPREFIX | DT_RIGHT;
cend = true;
drwtxt = befcur;
tbw -= 0.5 * nfo.Width;
}
gr.GdiDrawText(drwtxt, this.gfont, this.colourttb, this.left + this.margin, this.top, tbw - 2 * this.margin, this.h, flg);
//cursor
if (cend) {
gr.FillSolidRect(this.left + tbw - this.margin, this.top + 1.1 * this.fh, 0.5 * nfo.Width, 2, this.colourttb);
}
else {
cursorinfo=gr.MeasureString(this.contentedit.slice(0, this.cursor), this.gfont, 0, 0, 10000, 100, DT_NOPREFIX | DT_CALCRECT);
gr.FillSolidRect(this.left + this.margin + cursorinfo.Width, this.top + 1.1 * this.fh, 0.5 * nfo.Width, 2, this.colourttb);
}
}
}
this.onMove = function (x, y) {
hv = this.hover;
if ((this.left < x) && (x < (this.left + this.w)) && (this.top < y) && (y < (this.top + this.h)) && edit) {
this.hover = true;
cursorhover = true
}
else
this.hover = false;
if (hv != this.hover) this.redraw();
}
this.onClick = function (x, y) {
if (this.hover) {
if (!this.active) {
this.active = true;
this.cursor = this.contentedit.length;
this.special = false;
}
}
else {
this.save();
}
}
this.loadeditstr = function () {
this.contenteditbak = this.contentedit;
this.contentedit = this.content.join(";");
}
this.spliteditstr = function () {
if (this.multivalue) {
tmparr = new Array ();
tmpstr = this.contentedit;
editseptrim = this.editsep;
if (editseptrim.slice(0, 1) == " ") editseptrim = editsepttrim.slice(1);
if (editseptrim.slice(-1) == " ") editseptrim = editseptrim.slice(0, editseptrim.length - 1);
m = 0;
do {
seppos = tmpstr.indexOf(editseptrim);
if (seppos == -1) {
tmparr[m] = tmpstr;
}
else {
tmparr[m] = tmpstr.slice(0, seppos);
tmpstr = tmpstr.slice(seppos + 1);
if (tmpstr.slice(0, 1) == " ") tmpstr = tmpstr.slice(1);
}
if (tmparr[m].slice(-1) == " ") tmparr[m] = tmparr[m].slice(0, tmparr[m].Length - 1);
m++;
} while (seppos != -1);
this.content = tmparr;
this.nrvalues = m;
}
else
this.content[0] = this.contentedit;
}
this.load = function () {
this.content.length = 0;
idx = metadata.MetaFind(this.tag);
if (idx > metadata.MetaCount) this.nrvalues = 0; else this.nrvalues = metadata.MetaValueCount(idx);
for (n = 0 ; n < this.nrvalues; n++) this.content[n] = metadata.MetaValue(idx, n);
this.active = false;
this.loadeditstr();
}
this.save = function () {
if (this.contentedit != this.contenteditbak && this.active) {
this.spliteditstr();
if (this.multivalue) {
metadata.MetaRemoveField(this.tag);
idx = metadata.MetaAdd(this.tag, this.content[this.nrvalues -1]);
for (n = this.nrvalues - 2 ; n > -1; n--) {
metadata.MetaInsertValue(idx, 0, this.content[n]);
}
}
else
metadata.MetaSet (this.tag, this.content[0]);
g_handle.UpdateFileInfo(metadata);
this.active = false;
this.loadeditstr();
reload = true;
window.Repaint();
}
else
this.active = false;
}
this.escape = function () {
this.contentedit = tb.contenteditbak;
this.cursor = tb.contentedit.length;
}
}
function Keywords(title, tag, list, listlong, x, y, tw, kw, h, margin) {
this.type = "kw";
this.title = title;
this.tag = tag;
this.list = list;
this.listlong = listlong;
this.content = new Array();
this.changed = false;
this.errorstr = "";
this.errorcontent = new Array();
this.nrvalues = 0;
this.tleft = eval(x);
this.top = eval(y);
this.tw = eval(tw);
this.kw = eval(kw);
this.fh = eval(h);
this.margin = eval(margin);
this.left = new Array();
this.width = new Array();
this.h = 0;
this.scroll = 0;
this.maxscroll = 0;
this.scrollpbut = false;
this.scrollnbut = false;
this.colourkw = RGB(229, 229, 229);
this.colourkwh = RGB(255, 255, 200);
this.colourd = RGB(255, 255, 255);
this.colourt = RGB(192, 192, 192);
this.hover = -1;
this.hoverbut = -1;
this.emptyhover = false;
this.emptyhoverbut = false;
this.gfont = gdi.Font("Arial Unicode MS", this.fh, 0);
this.gfontt = gdi.Font("Arial Unicode MS", 2 * this.fh / 4, 0);
this.gfontbut = gdi.Font("Arial Unicode MS", this.fh / 1.3, 0);
this.resize = function () {
this.tleft = eval(x);
this.top = eval(y);
this.tw = eval(tw);
this.kw = eval(kw);
this.fh = eval(h);
this.margin = eval(margin);
}
this.redraw = function () {
window.RepaintRect (this.tleft + this.tw, this.top, this.kw, this.h);
}
this.draw = function (gr) {
nfo = gr.MeasureString("n", this.gfont, 0, 0, 10000, 100, DT_CALCRECT);
nfob = gr.MeasureString("◀", this.gfontbut, 0, 0, 10000, 100, DT_CALCRECT);
nfof = gr.MeasureString("▶", this.gfontbut, 0, 0, 10000, 100, DT_CALCRECT);
nfop = gr.MeasureString("+", this.gfontbut, 0, 0, 10000, 100, DT_CALCRECT);
nfom = gr.MeasureString("−", this.gfontbut, 0, 0, 10000, 100, DT_CALCRECT);
this.h = nfo.Height;
//title
gr.DrawString(this.title, this.gfontt, this.colourt, this.tleft, this.top, this.tw - this.margin, this.h, StringFormat(2, 2));
//values
leftstart = this.tleft + this.tw + this.margin;
pos = 0;
for (i = 0 ; i < this.nrvalues; i++) {
this.left[i] = leftstart + pos;
info = gr.MeasureString(this.content[i], this.gfont, 0, 0, 10000, 100, DT_NOPREFIX | DT_CALCRECT);
this.width[i] = info.Width;
if (this.width[i] < (4 * this.h / 3)) this.width[i] = 4* this.h / 3;
pos += this.width[i];
this.maxscroll = pos - this.kw;
if (this.hover == i) colour = this.colourkwh; else colour = this.colourkw;
if (this.errorcontent[i]) colour = RGB(255, 0, 0);
this.left[i] -= this.scroll;
flg = DT_NOPREFIX;
if (this.left[i] < leftstart) {
flg = DT_NOPREFIX | DT_RIGHT;
this.width[i] += this.left[i] - leftstart;
this.left[i] = leftstart;
}
if ((this.left[i] + this.width[i]) > (leftstart + this.kw)) this.width[i] = leftstart + this.kw - this.left[i];
if (this.width[i] >= 0) {
gr.GdiDrawText(this.content[i], this.gfont, colour, this.left[i], this.top, this.width[i], this.h, flg);
}
pos += nfo.Width + this.margin;
}
//menu
if (this.hover != -1 && !this.scrollpbut && !this.scrollnbut) {
gr.DrawLine(this.left[this.hover], this.top, this.left[this.hover] + this.width[this.hover], this.top, 1, this.colourkwh);
if (this.hoverbut == 0) {
gr.DrawRect(this.left[this.hover], this.top, this.h / 3 - 1, this.h / 3 - 1, 1, this.colourkwh);
colour = this.colourkwh;
}
else
colour = this.colourkw;
gr.DrawLine(this.left[this.hover], this.top, this.left[this.hover] + this.h / 3, this.top, 1, this.colourkwh);
gr.DrawString("◀", this.gfontbut, colour, this.left[this.hover] + (this.h / 3 - nfob.width) / 2, this.top - 1, this.h / 3, this.h / 3, StringFormat(1, 1));
if (this.hoverbut == 1) {
gr.DrawRect(this.left[this.hover] + this.h / 3, this.top, this.h / 3 - 1, this.h / 3 - 1, 1, this.colourkwh);
colour = this.colourkwh;
}
else
colour = this.colourkw;
gr.DrawLine(this.left[this.hover] + this.h / 3, this.top, this.left[this.hover] + 2 * this.h / 3, this.top, 1, this.colourkwh);
gr.DrawString("▶", this.gfontbut, colour, this.left[this.hover] + this.h / 3 + (this.h / 3 - nfof.width) / 2, this.top - 1, this.h / 3, this.h / 3, StringFormat(1, 1));
if (this.hoverbut == 2) {
gr.DrawRect(this.left[this.hover] + this.width[this.hover] - 2 * this.h / 3, this.top, this.h / 3 - 1, this.h / 3 - 1, 1, this.colourkwh);
colour = this.colourkwh;
}
else
colour = this.colourkw;
gr.DrawLine(this.left[this.hover] + this.width[this.hover] - 2 * this.h / 3, this.top, this.left[this.hover] + this.width[this.hover] - this.h / 3, this.top, 1, this.colourkwh);
gr.DrawString("+", this.gfontbut, colour, this.left[this.hover] + this.width[this.hover] - 2 * this.h / 3 + (this.h / 3 - nfop.width) / 2, this.top - 1, this.h / 3, this.h / 3, StringFormat(1, 1));
if (this.hoverbut == 3) {
gr.DrawRect(this.left[this.hover] + this.width[this.hover] - this.h / 3, this.top, this.h / 3 - 1, this.h / 3 - 1, 1, this.colourkwh);
colour = this.colourkwh;
}
else
colour = this.colourkw;
gr.DrawLine(this.left[this.hover] + this.width[this.hover] - this.h / 3, this.top, this.left[this.hover] + this.width[this.hover], this.top, 1, this.colourkwh);
gr.DrawString("−", this.gfontbut, colour, this.left[this.hover] + this.width[this.hover] - this.h / 3 + (this.h / 3 - nfom.width) / 2, this.top - 1, this.h / 3, this.h / 3, StringFormat(1, 1));
}
//scroll buttons
if (this.scrollpbut) {
gr.DrawRect(leftstart, this.top + this.h / 4, this.h / 2 - 1, this.h / 2 - 1, 1, this.colourkwh);
gr.GdiDrawText("◀", this.gfont, this.colourkwh, leftstart, this.top, this.h / 2, this.h, DT_NOPREFIX | DT_CENTER);
}
if (this.scrollnbut) {
gr.DrawRect(leftstart + this.kw - this.h / 2, this.top + this.h / 4, this.h / 2 - 1, this.h / 2 - 1, 1, this.colourkwh);
gr.GdiDrawText("▶", this.gfont, this.colourkwh, leftstart + this.kw - this.h / 2, this.top, this.h / 2, this.h, DT_NOPREFIX | DT_CENTER);
}
//empty
if (this.emptyhover) {
gr.DrawLine(leftstart + this.margin, this.top, leftstart + this.kw - this.margin, this.top, 1, this.colourkwh);
if (this.emptyhoverbut == 0)
colour = this.colourkw;
else {
gr.DrawRect(leftstart, this.top, this.h / 3 - 1, this.h / 3 - 1, 1, this.colourkwh);
colour = this.colourkwh;
}
gr.DrawLine(leftstart, this.top, leftstart + this.margin, this.top, 1, this.colourkwh);
gr.DrawString("+", this.gfontbut, colour, leftstart + (this.margin - nfop.width) / 2 + 2, this.top - 1, this.h / 3, this.h / 3, StringFormat(1, 1));
}
}
this.onMove = function (x, y) {
if (edit) {
hv = this.hover;
hvb = this.hoverbut;
hvsp = this.scrollpbut;
hvsn = this.scrollnbut;
hve = this.emptyhover;
hveb = this.emptyhoverbut;
this.hover = -1;
this.hoverbut = -1;
this.emptyhover = false;
this.emptyhoverbut = false;
for (i = 0 ; i < this.nrvalues; i++) {
if (this.width[i] >= 0) {
if ((this.left[i] < x) && (x < (this.left[i] + this.width[i])) && (this.top < y) && (y < (this.top + this.h))) {
this.hover = i;
if ((this.left[i] < x) && (x < (this.left[i] + this.h / 3)) && (this.top < y) && (y < (this.top + this.h / 3))) {
this.hoverbut = 0;
cursorhover = true
}
if (((this.left[i] + this.h / 3) < x) && (x < (this.left[i] + 2* this.h / 3) ) && (this.top < y) && (y < (this.top + this.h / 3))) {
this.hoverbut = 1;
cursorhover = true
}
if (((this.left[i] + this.width[i] - 2* this.h / 3) < x) && (x < (this.left[i] + this.width[i]) ) && (this.top < y) && (y < (this.top + this.h / 3))) {
this.hoverbut = 2;
cursorhover = true
}
if (((this.left[i] + this.width[i] - this.h / 3) < x) && (x < (this.left[i] + this.width[i]) ) && (this.top < y) && (y < (this.top + this.h / 3))) {
this.hoverbut = 3;
cursorhover = true
}
}
}
}
if (((this.tleft + this.tw) < x) && (x < (this.tleft + this.tw + this.h / 2)) && ((this.top + this.h / 4) < y) && (y < (this.top + 3 * this.h / 4)) && (this.scroll > 0)) {
this.scrollpbut = true;
this.hover = -1;
this.hoverbut = -1;
cursorhover = true
}
else
this.scrollpbut = false;
if (((this.tleft + this.tw + this.kw - this.h / 2) < x) && (x < (this.tleft + this.tw + this.kw)) && ((this.top + this.h / 4) < y) && (y < (this.top + 3 * this.h / 4)) && (this.scroll < this.maxscroll)) {
this.scrollnbut = true;
this.hover = -1;
this.hoverbut = -1;
cursorhover = true
}
else
this.scrollnbut = false;
if (((this.tleft + this.tw + margin) < x) && (x < (this.tleft + this.tw + margin + this.kw)) && (this.top < y) && (y < (this.top + this.h)) && (this.nrvalues == 0))
this.emptyhover = true;
if (((this.tleft + this.tw + margin) < x) && (x < (this.tleft + this.tw + margin + this.h / 3)) && (this.top < y) && (y < (this.top + this.h / 3)) && (this.nrvalues == 0)) {
this.emptyhoverbut = true;
cursorhover = true
}
if ((hv != this.hover) || (hvb != this.hoverbut) || (hvsp != this.scrollpbut) || (hvsn != this.scrollnbut) || (hve != this.emptyhover) || (hveb != this.emptyhoverbut)) this.redraw();
}
}
this.onClick = function (x, y) {
if (this.hover > -1) {
tmparr1 = new Array ();
tmparr2 = new Array ();
for (i = 0 ; i < this.nrvalues; i++) {
if (this.hover == i) {
// <
if ((this.hoverbut == 0) && (i != 0)) {
for (j = 0 ; j < this.nrvalues; j++) {
tmparr1[j] = this.content[j];
tmparr2[j] = this.errorcontent[j];
}
tmparr1[i - 1] = this.content[i];
tmparr2[i - 1] = this.errorcontent[i];
tmparr1[i] = this.content[i - 1];
tmparr2[i] = this.errorcontent[i - 1];
for (j = 0 ; j < this.nrvalues; j++) {
this.content[j] = tmparr1[j];
this.errorcontent[j] = tmparr2[j];
}
this.changed = true;
this.save();
}
// >
if ((this.hoverbut == 1) && (i < this.nrvalues - 1)) {
for (j = 0 ; j < this.nrvalues; j++) {
tmparr1[j] = this.content[j];
tmparr2[j] = this.errorcontent[j];
}
tmparr1[i + 1] = this.content[i];
tmparr2[i + 1] = this.errorcontent[i];
tmparr1[i] = this.content[i + 1];
tmparr2[i] = this.errorcontent[i + 1];
for (j = 0 ; j < this.nrvalues; j++) {
this.content[j] = tmparr1[j];
this.errorcontent[j] = tmparr2[j];
}
this.changed = true;
this.save();
}
// +
if (this.hoverbut == 2) {
var popupmenu = window.CreatePopupMenu();
for (j in this.list) {
popupmenu.AppendMenuItem(0, parseInt(j) + 1, this.listlong[j]);
}
menuret = popupmenu.TrackPopupMenu(x, y);
if (menuret != 0) {
this.nrvalues += 1;
for (j = 0 ; j < this.nrvalues; j++) {
if (j <= i) {
tmparr1[j] = this.content[j];
tmparr2[j] = this.errorcontent[j];
}
if (j == (i + 1)) {
tmparr1[j] = this.listlong[menuret - 1];
tmparr2[j] = false;
}
if (j > (i + 1)) {
tmparr1[j] = this.content[j - 1];
tmparr2[j] = this.errorcontent[j - 1];
}
}
for (j = 0 ; j < this.nrvalues; j++) {
this.content[j] = tmparr1[j];
this.errorcontent[j] = tmparr2[j];
}
}
this.changed = true;
this.save();
}
// x
if (this.hoverbut == 3) {
this.nrvalues -= 1;
for (j = 0 ; j < this.nrvalues; j++) {
if (j >= i) tmparr1[j] = this.content[j + 1]; else tmparr1[j] = this.content[j];
if (j >= i) tmparr2[j] = this.errorcontent[j + 1]; else tmparr2[j] = this.errorcontent[j];
}
for (j = 0 ; j < this.nrvalues; j++) {
this.content[j] = tmparr1[j];
this.errorcontent[j] = tmparr2[j];
}
this.changed = true;
this.save();
}
}
}
}
// <<
if (this.scrollpbut) {
this.scroll -= this.h;
if (this.scroll < 0) this.scroll = 0;
this.redraw;
}
// >>
if (this.scrollnbut) {
this.scroll += this.h;
if (this.scroll > this.maxscroll) this.scroll = this.maxscroll;
this.redraw;
}
// +
if (this.emptyhoverbut) {
var popupmenu = window.CreatePopupMenu();
for (j in this.list) {
popupmenu.AppendMenuItem(0, parseInt(j) + 1, this.listlong[j]);
}
menuret = popupmenu.TrackPopupMenu(x, y);
if (menuret != 0) {
this.nrvalues += 1;
this.content[0] = this.listlong[menuret - 1];
this.changed = true;
this.save();
}
}
}
this.loadkeywords = function () {
for (i = 0 ; i < this.nrvalues; i++) {
this.errorcontent[i] = true;
for (j in this.list) {
if (this.content[i] == this.list[j]) {
this.content[i] = this.listlong[j];
this.errorcontent[i] = false;
}
}
}
}
this.load = function () {
this.content.length = 0;
idx = metadata.MetaFind(this.tag);
if (idx > metadata.MetaCount) this.nrvalues = 0; else this.nrvalues = metadata.MetaValueCount(idx);
for (n = 0 ; n < this.nrvalues; n++) this.content[n] = metadata.MetaValue(idx, n);
this.loadkeywords();
this.changed = false;
}
this.save = function () {
if (this.changed) {
this.changed = false;
metadata.MetaRemoveField(this.tag);
writestr = this.content[this.nrvalues - 1];
if (!this.errorcontent[this.nrvalues -1]) {
for (j in this.list) {
if (this.content[this.nrvalues -1] == this.listlong[j]) writestr = this.list[j];
}
}
if (this.nrvalues != 0) idx = metadata.MetaAdd(this.tag, writestr);
for (n = this.nrvalues - 2 ; n > -1; n--) {
writestr = this.content[n];
if (!this.errorcontent[n]) {
for (j in this.list) {
if (this.content[n] == this.listlong[j]) writestr = this.list[j];
}
}
metadata.MetaInsertValue(idx, 0, writestr);
}
g_handle.UpdateFileInfo(metadata);
reload = true;
window.Repaint();
}
}
}
function CheckBox(title, tag, x, y, tw, h, margin) {
this.type = "cb";
this.title = title;
this.tag = tag;
this.content = 0;
this.changed = false;
this.tleft = eval(x);
this.top = eval(y);
this.tw = eval(tw);
this.fh = eval(h);
this.margin = eval(margin);
this.left = 0;
this.h = 0;
this.colourkw = RGB(229, 229, 229);
this.colourkwb = RGB(0, 0, 0);
this.colourkwh = RGB(255, 255, 200);
this.colourkwbh = RGB(0, 0, 0);
this.colourkws = RGB(229, 229, 229);
this.colourkwsb = RGB(104, 104, 104);
this.colourkwsh = RGB(255, 255, 200);
this.colourkwsbh = RGB(104, 104, 104);
this.colourd = RGB(255, 255, 255);
this.colourt = RGB(192, 192, 192);
this.hover = false;
this.gfont = gdi.Font("Arial Unicode MS", this.fh, 0);
this.gfontt = gdi.Font("Arial Unicode MS", 2 * this.fh / 4, 0);
this.resize = function () {
this.tleft = eval(x);
this.top = eval(y);
this.tw = eval(tw);
this.fh = eval(h);
this.margin = eval(margin);
}
this.redraw = function () {
window.RepaintRect (this.left, this.top, this.h, this.h);
}
this.draw = function (gr) {
this.left = this.tleft + this.tw + this.margin;
nfo = gr.MeasureString("n", this.gfont, 0, 0, 10000, 100, DT_CALCRECT);
this.h = nfo.Height;
//title
gr.DrawString(this.title, this.gfontt, this.colourt, this.tleft, this.top, this.tw - this.margin, this.h, StringFormat(2, 2));
//checkbox
if (this.hover) {
colourback = RGB(255, 0, 0);
colour = this.colourkwh;
txt = "";
if (this.content == 0) {
colourback = this.colourkwbh;
colour = this.colourkwh;
txt = "";
}
if (this.content == 1) {
colourback = this.colourkwsbh;
colour = this.colourkwsh;
txt = "✕";
}
}
else {
colourback = RGB(255, 0, 0);
colour = this.colourkw;
txt = "";
if (this.content == 0) {
colourback = this.colourkwb;
colour = this.colourkw;
txt = "";
}
if (this.content == 1) {
colourback = this.colourkwsb;
colour = this.colourkws;
txt = "✕";
}
}
gr.FillEllipse(this.left, this.top, this.h - 1, this.h - 1, colourback);
gr.DrawEllipse(this.left, this.top, this.h - 1, this.h - 1, 1, colour);
gr.DrawString(txt, this.gfont, colour, this.left, this.top, this.h, this.h, StringFormat(1, 1));
}
this.onMove = function (x, y) {
hv = this.hover;
if ((this.left < x) && (x < (this.left + this.h)) && (this.top < y) && (y < (this.top + this.h)) && edit) {
this.hover = true;
cursorhover = true
}
else
this.hover = false;
if (hv != this.hover) this.redraw();
}
this.onClick = function (x, y) {
if (this.hover) {
if (this.content == 0)
this.content = 1;
else if (this.content == 1)
this.content = 0;
else
this.content = 1;
this.changed = true;
this.save();
}
}
this.load = function () {
idx = metadata.MetaFind(this.tag);
if (idx > metadata.MetaCount) this.content = 0; else this.content = metadata.MetaValue(idx, 0);
this.changed = false;
}
this.save = function () {
if (this.changed) {
this.changed = false;
metadata.MetaSet (this.tag, this.content);
g_handle.UpdateFileInfo(metadata);
reload = true;
window.Repaint();
}
}
}
function RadioBox(title, tag, list, listlong, x, y, tw, rw, h, margin, showall) {
this.type = "rb";
this.title = title;
this.tag = tag;
this.list = list;
this.listlong = listlong;
this.content = 0;
this.contenterror = false;
this.changed = false;
this.tleft = eval(x);
this.top = eval(y);
this.tw = eval(tw);
this.rw = eval(rw);
this.fh = eval(h);
this.margin = eval(margin);
this.left = new Array ();
this.width = new Array();
this.h = 0;
this.colourkw = RGB(229, 229, 229);
this.colourkwb = RGB(0, 0, 0);
this.colourkwh = RGB(255, 255, 200);
this.colourkwbh = RGB(0, 0, 0);
this.colourkws = RGB(229, 229, 229);
this.colourkwsb = RGB(104, 104, 104);
this.colourkwsh = RGB(255, 255, 200);
this.colourkwsbh = RGB(104, 104, 104);
this.colourd = RGB(255, 255, 255);
this.colourt = RGB(192, 192, 192);
this.showall = showall;
this.hover = -1;
this.gfont = gdi.Font("Arial Unicode MS", this.fh, 0);
this.gfontt = gdi.Font("Arial Unicode MS", 2 * this.fh / 4, 0);
this.gfontbut = gdi.Font("Arial Unicode MS", this.fh / 1.3, 0);
this.resize = function () {
this.tleft = eval(x);
this.top = eval(y);
this.tw = eval(tw);
this.rw = eval(rw);
this.fh = eval(h);
this.margin = eval(margin);
}
this.redraw = function () {
window.RepaintRect (this.tleft + this.tw, this.top, this.rw, this.h);
}
this.draw = function (gr) {
nfo = gr.MeasureString("n", this.gfont, 0, 0, 10000, 100, DT_CALCRECT);
nfod = gr.MeasureString("▾", this.gfontbut, 0, 0, 10000, 100, DT_CALCRECT);
this.h = nfo.Height;
//title
gr.DrawString(this.title, this.gfontt, this.colourt, this.tleft, this.top, this.tw - this.margin, this.h, StringFormat(2, 2));
leftstart = this.tleft + this.tw + this.margin;
if (showall) {
//values
pos = 0;
for (i in this.list) {
this.left[i] = leftstart + pos;
info = gr.MeasureString(this.listlong[i], this.gfont, 0, 0, 10000, 100, DT_NOPREFIX | DT_CALCRECT);
this.width[i] = info.Width;
pos += this.width[i];
if (this.hover == i) {
if (this.content == this.listlong[i]) {
colourback = this.colourkwsbh;
colourl = this.colourkwsh;
colour = this.colourkwsh;
tstsel = true
}
else {
colourback = this.colourkwbh;
colourl = this.colourkwbh;
colour = this.colourkwh;
tstsel = false;
}
}
else {
if (this.content == this.listlong[i]) {
colourback = this.colourkwsb;
colourl = this.colourkws;
colour = this.colourkws;
tstsel = true;
}
else {
colourback = this.colourkwb;
colourl = this.colourkwb;
colour = this.colourkw;
tstsel = false;
}
}
// if (tstsel) {
// this.left[i] += this.margin;
// pos += this.margin;
// }
if (this.contenterror) colour = RGB(255, 0, 0);
if (tstsel) {
gr.FillSolidRect(this.left[i] - this.margin, this.top, this.width[i] + 2 * this.margin, this.h, colourback);
gr.DrawRect(this.left[i] - this.margin, this.top, this.width[i] + 2 * this.margin - 1, this.h - 1, 1, colourl);
}
gr.GdiDrawText(this.listlong[i], this.gfont, colour, this.left[i], this.top, this.width[i], this.h, DT_NOPREFIX);
pos += nfo.Width + this.margin;
}
this.rw = this.left[i] + this.width[i];
if (tstsel) this.rw += this.margin;
}
else {
//value
if (this.hover == -1) colour = this.colourkw; else colour = this.colourkwh;
if (this.contenterror) colour = RGB(255, 0, 0);
if (this.content == "") {
str = "[none]";
colour = RGB(127, 127, 127);
}
else
str = this.content;
gr.GdiDrawText(str, this.gfont, colour, leftstart, this.top, this.rw, this.h, DT_NOPREFIX);
//menu
if (this.hover != -1) {
gr.DrawLine(leftstart, this.top, leftstart + this.rw, this.top, 1, this.colourkwh);
gr.DrawString("▾", this.gfontbut, this.colourkwh, leftstart + this.rw - this.h / 3 + (this.h / 3 - nfom.width) / 2, this.top - 1, this.h / 3, this.h / 1, StringFormat(1, 1));
}
}
}
this.onMove = function (x, y) {
if (edit) {
hv = this.hover;
if (showall) {
this.hover = -1;
for (i in this.list) {
if ((this.left[i] < x) && (x < (this.left[i] + this.width[i])) && (this.top < y) && (y < (this.top + this.h))) {
this.hover = i;
cursorhover = true
}
}
}
else {
if (((this.tleft + this.tw) < x) && (x < (this.tleft + this.tw + this. rw)) && (this.top < y) && (y < (this.top + this.h))) {
this.hover = 0;
cursorhover = true
}
else
this.hover = -1;
}
if (hv != this.hover) this.redraw();
}
}
this.onClick = function (x, y) {
if (this.hover != -1) {
if (showall) {
if (this.content == this.listlong[this.hover])
this.content = "";
else
this.content = this.listlong[this.hover];
this.contenterror = false;
this.changed = true;
this.save();
}
else {
var popupmenu = window.CreatePopupMenu();
popupmenu.AppendMenuItem(0, 1, "[none]");
for (j in this.list) {
popupmenu.AppendMenuItem(0, parseInt(j) + 2, this.listlong[j]);
}
menuret = popupmenu.TrackPopupMenu(x, y);
if (menuret != 0) {
this.content = this.listlong[menuret - 2];
this.contenterror = false;
this.changed = true;
this.save();
}
}
}
}
this.load = function () {
idx = metadata.MetaFind(this.tag);
if (idx > metadata.MetaCount) {
this.content = "";
this.contenterror = false;
}
else {
str = metadata.MetaValue(idx, 0);
this.contenterror = true;
for (i in this.list) {
if (str == this.list[i]) {
this.content = this.listlong[i];
this.contenterror = false;
}
}
if (this.contenterror) this.content = str;
if (str == "") this.contenterror = false;
}
this.changed = false;
}
this.save = function () {
if (this.changed) {
this.changed = false;
for (i in this.list) {
if (this.content == this.listlong[i]) this.content = this.list[i];
}
metadata.MetaSet (this.tag, this.content);
g_handle.UpdateFileInfo(metadata);
reload = true;
window.Repaint();
}
}
}
function InputRating(title, tag, max, x, y, tw, h, margin) {
this.type = "ra";
this.title = title;
this.tag = tag;
this.max = max;
this.content = 0;
this.contenterror = false;
this.changed = false;
this.tleft = eval(x);
this.top = eval(y);
this.tw = eval(tw);
this.fh = eval(h);
this.margin = eval(margin);
this.left = 0;
this.h = 0;
this.colourkw = RGB(229, 229, 229);
this.colourkwh = RGB(255, 255, 200);
this.colourd = RGB(255, 255, 255);
this.colourt = RGB(192, 192, 192);
this.hover = -1;
this.gfont = gdi.Font("Arial Unicode MS", this.fh, 0);
this.gfontt = gdi.Font("Arial Unicode MS", 2 * this.fh / 4, 0);
this.gfontbut = gdi.Font("Arial Unicode MS", this.fh / 1.3, 0);
this.resize = function () {
this.tleft = eval(x);
this.top = eval(y);
this.tw = eval(tw);
this.fh = eval(h);
this.margin = eval(margin);
}
this.redraw = function () {
window.RepaintRect (this.tleft, this.top, this.max * this.h + this.tw + this.margin, this.h);
}
this.draw = function (gr) {
this.left = this.tleft + this.tw + this.margin;
nfo = gr.MeasureString("n", this.gfont, 0, 0, 10000, 100, DT_CALCRECT);
nfom = gr.MeasureString("−", this.gfontbut, 0, 0, 10000, 100, DT_CALCRECT);
this.h = nfo.Height;
//title
gr.DrawString(this.title, this.gfontt, this.colourt, this.tleft, this.top, this.tw - this.margin, this.h, StringFormat(2, 2));
//rating
for (i = 1; i <= this.max; i++) {
if (i <= this.content) {
str = "★";
if (this.hover == i) colour = this.colourkwh; else colour = this.colourkw;
}
else {
str = "☆"
if (this.hover == i) colour = this.colourkwh; else colour = RGB(127, 127, 127);
}
if (this.contenterror) colour = RGB(255, 0, 0);
gr.GdiDrawText(str, this.gfont, colour, this.left + (i - 1) * this.h, this.top, this.h, this.h, DT_NOPREFIX);
}
//menu
if (this.hover != -1) {
gr.DrawLine(this.left, this.top, this.left + this.max * this.h - 1, this.top, 1, this.colourkwh);
if (this.hover == 0) {
gr.DrawRect(this.left + this.max * this.h - this.h / 3, this.top, this.h / 3 - 1, this.h / 3 - 1, 1, this.colourkwh);
colour = this.colourkwh;
}
else
colour = this.colourkw;
gr.DrawString("−", this.gfontbut, colour, this.left + this.max * this.h - this.h / 3 + (this.h / 3 - nfom.width) / 2, this.top - 1, this.h / 3, this.h / 3, StringFormat(1,1));
}
}
this.onMove = function (x, y) {
if (edit) {
hv = this.hover;
this.hover = -1;
for (i = 0; i < this.max; i++) {
if (((this.left + i * this.h) < x) && (x < (this.left + (i + 1) * this.h)) && (this.top < y) && (y < (this.top + this.h))) {
this.hover = i + 1;
cursorhover = true
}
}
if (((this.left + this.max * this.h - this.h / 3) < x) && (x < (this.left + this.max * this.h)) && (this.top < y) && (y < (this.top + this.h))) {
this.hover = 0;
cursorhover = true
}
if (hv != this.hover) this.redraw();
}
}
this.onClick = function (x, y) {
if (this.hover >= 0) {
this.content = this.hover;
this.contenterror = false;
this.changed = true;
this.save();
}
}
this.load = function () {
idx = metadata.MetaFind(this.tag);
if (idx > metadata.MetaCount)
this.content = 0;
else {
str = metadata.MetaValue(idx, 0);
this.contenterror = true;
for (i = 0; i <= this.max; i ++) {
if (str == i) {
this.content = i;
this.contenterror = false;
}
if (this.contenterror) this.content = 0;
}
}
this.changed = false;
}
this.save = function () {
if (this.changed) {
this.changed = false;
metadata.MetaSet (this.tag, this.content);
g_handle.UpdateFileInfo(metadata);
reload = true;
window.Repaint();
}
}
}
Here line 159 is a window.RepaintRect(...) function call. The change log doesn't say anything about a changed behaviour of that function...