i keep getting
// HistoryLayer.tjs - ƒƒbƒZ[ƒW—š—ðƒŒƒCƒ„
// Copyright (C)2001-2006, W.Dee and contributors ‰ü•ÏE”z•z‚ÍŽ©—R‚Å‚·
class BarControlLayer extends KAGLayer{
var vertical = false;
var pMinPos = 0;
var pMaxPos = 100;
var pMinValue = 0;
var pMaxValue = 100;
var pValue = 0;
var drugFlg = false;
var mouseDownX;
var mouseDownY;
var valueEditLayer;
function BarControlLayer(win, par){
super.KAGLayer(...);
valueEditLayer = new EditLayer(win , this);
valueEditLayer.enabled = false;
valueEditLayer.visible = false;
valueEditLayer.focusable = false;
valueEditLayer.setPos(4,2);
valueEditLayer.width = 20;
valueEditLayer.height = 12;
valueEditLayer.color = 0x444444;
valueEditLayer.opacity = 255;
valueEditLayer.textColor = 0xffffff;
valueEditLayer.font.height = 12;
}
function onMouseDown(x,y,button,shift){
if(button==mbLeft){
mouseDownX = x;
mouseDownY = y;
drugFlg = true;
}
super.onMouseDown(...);
}
function onMouseUp(x,y,button,shift){
if(drugFlg){
drugFlg = false;
var tmp = int(Math.round((pMaxValue - pMinValue) / (pMaxPos - pMinPos) * (left - pMinPos + imageWidth\2)));
// dm("tmp : " + tmp);
pValue = tmp;
setPosition();
valueEditLayer.visible = false;
}
super.onMouseUp(...);
}
function onMouseMove(x,y,shift){
if(drugFlg){
left += x-mouseDownX;
if(left < pMinPos - imageWidth\2) left = pMinPos - imageWidth\2;
if(left > pMaxPos - imageWidth\2) left = pMaxPos - imageWidth\2;
var tmp = int(Math.round((pMaxValue - pMinValue) / (pMaxPos - pMinPos) * (left - pMinPos + imageWidth\2)));
hint = tmp;
pValue = tmp;
// valueEditLayer.visible = true;
valueEditLayer.text = tmp;
}
super.onMouseMove(...);
}
function setPosition(){
if(pValue==pMaxValue){
if(!vertical){
super.setPos(pMaxPos - imageWidth\2 , top);
}
}else{
var tmp = int(Math.round((pMaxPos - pMinPos) / (pMaxValue - pMinValue) * pValue));
if(!vertical){
super.setPos(pMinPos + tmp - imageWidth\2 , top);
}
}
hint = pValue;
}
property minPos{
setter(x){
pMinPos = x;
}
getter{
return pMinPos;
}
}
property maxPos{
setter(x){
pMaxPos = x;
}
getter{
return pMaxPos;
}
}
property minValue{
setter(x){
pMinValue = x;
}
getter{
return pMinValue;
}
}
property maxValue{
setter(x){
pMaxValue = x;
}
getter{
return pMaxValue;
}
}
property value{
setter(x){
pValue = x;
setPosition();
}
getter{
return pValue;
}
}
}
class LButtonLayer extends ButtonLayer
// parent ‚É onClick ƒCƒxƒ“ƒg‚ð‘—‚é‚悤‚É‚µ‚½ƒ{ƒ^ƒ“ƒŒƒCƒ„
{
function LButtonLayer(window, parent)
{
super.ButtonLayer(window, parent);
focusable = false;
}
function finalize()
{
super.finalize(...);
}
function onClick()
{
super.onClick(...);
}
function onMouseUp(x, y, button, shift)
{
if(enabled && button == mbLeft)
parent.onButtonClick(this);
super.onMouseUp(...);
}
}
class LButtonLayer2 extends ButtonLayer
// parent ‚É onClick ƒCƒxƒ“ƒg‚ð‘—‚é‚悤‚É‚µ‚½ƒ{ƒ^ƒ“ƒŒƒCƒ„
{
function LButtonLayer2(window, parent)
{
super.ButtonLayer(window, parent);
focusable = false;
}
function finalize()
{
super.finalize(...);
}
function onClick()
{
super.onClick(...);
}
function onMouseUp(x, y, button, shift)
{
if(enabled && button == mbLeft)
parent.onButtonClick(this);
super.onMouseUp(...);
}
function loadImages(storage,key)
{
global.KAGLayer.loadImages(storage, key);
global.KAGLayer.width = imageWidth \ 4;
global.KAGLayer.height = imageHeight;
callOnPaint = true;
Butt_imageLoaded = true;
}
function drawState(s)
{
// ó‘Ô s ‚ɑΉž‚·‚é‰æ‘œ‚ð•`‰æ
// s : 0 : •’Ê‚Ìó‘Ô
// 1 : ƒ{ƒ^ƒ“‚ª‰Ÿ‚³‚ꂽó‘Ô
// 2 : ƒ{ƒ^ƒ“‚Ìã‚Ƀ}ƒEƒXƒJ[ƒ\ƒ‹‚ª‚ ‚éó‘Ô
// 3 : –³Œø
if(!enabled)
{
s = 3; // –³Œøó‘Ô
}
if(Butt_imageLoaded)
{
// ƒ{ƒ^ƒ“ƒCƒ[ƒW‚ª“Ç‚Ýž‚Ü‚ê‚Ä‚¢‚é
// TODO: keyboard focus
try{
imageLeft = -s * width;
}catch{
return;
}
}
else
{
if(Butt_keyPressed) s = 1; // ‰Ÿ‚³‚ê‚Ä‚¢‚é
// ˜g‚ƃLƒƒƒvƒVƒ‡ƒ“‚ð•`‰æ
// ƒNƒŠƒA
face = dfAlpha;
colorRect(0, 0, width, height, 0, -255);
// ‰º’n‚ð“h‚é
if(Butt_color != clNone)
colorRect(0, 0, width, height, Butt_color, 128);
// •¶Žš‚̃TƒCƒY‚𓾂é
var tw, th;
tw = font.getTextWidth(Butt_caption);
th = font.getTextHeight(Butt_caption);
if(s == 0 || s == 2)
{
// ’Êí‚ ‚é‚¢‚̓}ƒEƒX‚ªã‚É‚ ‚é
colorRect(0, 0, width, 1, 0xffffff, 128);
colorRect(0, 1, 1, height-2, 0xffffff, 128);
colorRect(width-1, 1, 1, height-1, 0x000000, 128);
colorRect(1, height-1, width-2, 1, 0x000000, 128);
drawText((width-tw)>>1, (height-th)>>1,
Butt_caption, Butt_captionColor, nodeEnabled?255:128);
}
else
{
// ‰Ÿ‚³‚ê‚Ä‚¢‚é
colorRect(0, 0, width, 1, 0x000000, 128);
colorRect(0, 1, 1, height-2, 0x000000, 128);
colorRect(width-1, 1, 1, height-1, 0xffffff, 128);
colorRect(1, height-1, width-2, 1, 0xffffff, 128);
drawText(((width-tw)>>1) +1, ((height-th)>>1) +1,
Butt_caption, Butt_captionColor, nodeEnabled?255:128);
}
if(s != 0)
colorRect(2, 2, width-4, height-4, clHighlight, 64); // ƒnƒCƒ‰ƒCƒg‚·‚é
if(focused)
{
// ƒtƒH[ƒJƒX‚ª‚ ‚é‚̂ŃnƒCƒ‰ƒCƒg‚·‚é
colorRect(2, 2, width-4, 1, clHighlight, 128);
colorRect(2, 3, 1, height-5, clHighlight, 128);
colorRect(3, height-3, width-5, 1, clHighlight, 128);
colorRect(width-3, 3, 1, height-6, clHighlight, 128);
}
}
}
}
class HistoryLayer extends Layer
{
var prevPageButton = void;
var nextPageButton = void;
var prevPageButton2 = void;
var nextPageButton2 = void;
var closeButton = void;
var backgroundLayer;
var scrollBar;
var wwStr = '';
var lastIndentPos = 0;
var lastCurrentActionExp = void;
var antialiased = true; // ƒAƒ“ƒ`ƒGƒCƒŠƒAƒX•¶Žš•`‰æ‚ðs‚¤‚©
var verticalView = false; // c‘‚«‚©‚Ç‚¤‚©
var everypage = false; // ƒy[ƒW–ˆ‚Ì—š—ð•\Ž¦‚ðs‚È‚¤‚©
var autoReturn = true; // Ž©“®“I‚ɉüs‚·‚é‚©‚Ç‚¤‚©
var maxLines = 2000; // Å‘å•ÛŽs”
var data = []; // sƒf[ƒ^ ( ƒŠƒ“ƒOƒoƒbƒtƒ@ )
var lineStart = []; // s•\Ž¦ŠJŽnˆÊ’u ( ƒŠƒ“ƒOƒoƒbƒtƒ@ )
var actionInfo = []; // —š—ðƒNƒŠƒbƒNî•ñ ( ƒŠƒ“ƒOƒoƒbƒtƒ@ )
var dataStart = 0; // ƒf[ƒ^‚ÌŠJŽnˆÊ’u
var dataLines = 0; // ƒf[ƒ^’†‚ÉŠÜ‚Ü‚ê‚és” < maxLines -1
var dataPos = 0; // ƒf[ƒ^‘‚«ž‚݈ʒu
// ƒy[ƒW’PˆÊ‚ł̉{——‹@”\‚̃R[ƒh‚Í kiyobee Ž‚©‚ç’¸‚«‚Ü‚µ‚½B
// ‚±‚Ìê‚ðŽØ‚è‚Ä‚¨—ç\‚µã‚°‚Ü‚·B
// "ƒy[ƒW–ˆ"‚ÌŽž‚ÍAdata, lineStart, actionInfo ‚ð2ŽŸŒ³‚ÉŽg‚Á‚Ä‚¢‚éB
var maxPages = 100; // Å‘åƒy[ƒW”
var dataPages = 0; // ƒf[ƒ^’†‚Ì—LŒø‚ȃy[ƒW”
var dataPage = 0;// Œ»Ý‘‚«ž‚ñ‚Å‚¢‚éƒy[ƒW
var marginL = 300;
var marginR = 300;
var marginT = 24;
var marginB = 24;
var fontName = "Molengo";
var fontBold = false;
var fontItalic = true;
var fontHeight = 22;
var lineHeight = 26;
var relinePos_org = 0; // ‰üsˆÊ’u
var limitPos_org = 0; // ‰æ–Ê‚Ì’[‚Á‚±ˆÊ’u
var relinePos = 0; // ‰üsˆÊ’u
var limitPos = 0; // ‰æ–Ê‚Ì’[‚Á‚±ˆÊ’u
var indentPos = 0; // ƒCƒ“ƒfƒ“ƒgˆÊ’u
var repageLine = 0; // ‰üƒy[ƒWs”
var clearLeft = 200; //‰æ–Ê‚Ì‘‚«Š·‚¦”͈Í
var clearTop = 30;
var clearWidth = 966;
var clearHeight = 708;
var historyColor = 0xffffff; // —š—𕶎šF
var historyActionColor = 0xffff00; // —š—𕶎šFiƒAƒNƒVƒ‡ƒ“•t‚«j
var controlHeight = 20;
var dispStart = 0;
var dispLines = 0;
var canScroll = false;
var currentLine = "";
var currentAction = void;
var currentActionExp = void;
var currentActionID = 1;
var lastHighlightedActionID = 0;
var lastWheelTick; // ÅŒã‚ɃzƒC[ƒ‹‚ð‘€ì‚µ‚½ tick count
var storeState = false; // ó‘Ô‚ðžx‚É•Û‘¶‚·‚é‚©
// ‹Ö‘¥•¶Žš
var wwFollowing = "%),:;]}¡£ÞßBCADFGJKRST@UXfhjlnprtvxz‹ŒŽ‘“ñIHô‡@‡A"; // s“ª‹Ö‘¥•¶Žš
var wwFollowingWeak="!.?¤¥§¨©ª«¬®¯°E[„ª\‚Ÿ‚¡‚£‚¥‚§‚Á‚á‚ã‚å‚ìƒ@ƒBƒDƒFƒHƒbƒƒƒ…ƒ‡ƒŽƒ•ƒ–"; // s“ª(Žã)‹Ö‘¥•¶Žš
var wwLeading="\\$([{¢egikmoqsuwy’"; // s––‹Ö‘¥•¶Žš
wwFollowing += wwFollowingWeak;
function HistoryLayer(win, par)
{
super.Layer(...);
(HistoryLayer_config incontextof this)(); // configuration
(HistoryLayer_config_override incontextof this)()
if typeof global.HistoryLayer_config_override != "undefined";
name = "ƒƒbƒZ[ƒW—š—ðƒŒƒCƒ„";
setImageSize(parent.width, parent.height);
setSizeToImageSize();
hitType = htMask;
hitThreshold = 1;
// backgroundLayer = new KAGLayer(window, this);
// backgroundLayer.loadImages("backlog_bg");
// backgroundLayer.setSizeToImageSize();
// backgroundLayer.visible = true;
font.height = fontHeight;
font.bold = fontBold;
font.italic = fontItalic;
if(verticalView)
{
font.angle = 2700;
font.face = '@' + fontName;
}
else
{
font.angle = 0;
font.face = fontName;
}
focusable = true;
cursor = window.cursorDefault;
clear();
}
function finalize()
{
invalidate prevPageButton if prevPageButton !== void;
invalidate nextPageButton if nextPageButton !== void;
invalidate prevPageButton2 if prevPageButton2 !== void;
invalidate nextPageButton2 if nextPageButton2 !== void;
invalidate closeButton if closeButton !== void;
super.finalize(...);
}
function clear()
{
// “à—e‚̃NƒŠƒA
lineStart = [];
actionInfo = [];
dataStart = 0;
dataLines = 0;
dataPos = 0;
dataPages = 0;
dataPage = 0;
if(everypage)
{
data[dataPage] = [];
lineStart[dataPage] = [];
actionInfo[dataPage] = [];
}
else
dataLines = 1;
currentLine = "";
currentAction = void;
currentActionExp = void;
currentActionID = 1;
lastHighlightedActionID = 0;
calcRelinePos();
}
function save() {
// —š—ð‚Ìžx‚Ö‚Ì•Û‘¶‚̃R[ƒh‚Í ‚ä‚ñŽ‚©‚ç‚¢‚½‚¾‚«‚Ü‚µ‚½B
// ‚±‚Ìê‚ðŽØ‚è‚Ä‚¨—ç\‚µã‚°‚Ü‚·B
if(!storeState) return void;
var dic = %[];
if(everypage)
{
dic.lineStart = lineStart;
dic.actionInfo = actionInfo;
dic.data = data;
}
else
{
(dic.lineStart = []).assignStruct(lineStart);
(dic.actionInfo = []).assignStruct(actionInfo);
(dic.data = []).assignStruct(data);
}
dic.dataStart = dataStart;
dic.dataPos = dataPos;
dic.dataPages = dataPages;
dic.dataPage = dataPage;
dic.dataLines = dataLines;
dic.currentLine = dic.currentLine;
dic.currentAction = currentAction;
dic.currentActionExp = currentActionExp;
dic.currentActionID = currentActionID;
dic.lastHighlightedActionID = lastHighlightedActionID;
return dic;
}
function load(dic) {
if(!storeState) return;
if(dic === void) return;
lineStart.assignStruct(dic.lineStart);
actionInfo.assignStruct(dic.actionInfo);
data.assignStruct(dic.data);
dataStart = dic.dataStart;
dataPos = dic.dataPos;
dataPages = dic.dataPages;
dataPage = dic.dataPage;
dataLines = dic.dataLines;
currentLine = dic.currentLine;
currentAction = dic.currentAction;
currentActionExp = dic.currentActionExp;
currentActionID = dic.currentActionID;
lastHighlightedActionID = dic.lastHighlightedActionID;
calcRelinePos();
}
function calcRelinePos()
{
if(verticalView)
{
relinePos = relinePos_org = height - marginT - marginB - controlHeight;
limitPos = limitPos_org = height - marginT - controlHeight;
repageLine = (width - marginL - marginR) \ lineHeight;
}
else
{
relinePos = relinePos_org = width - marginL - marginR;
// ‰üƒy[ƒW‚̊ƂȂés”‚ðŒvŽZ
limitPos = limitPos_org = width - marginL;
repageLine = (height - marginT - marginB - controlHeight) \ lineHeight;
}
}
function setOptions(elm)
{
// ƒIƒvƒVƒ‡ƒ“‚ðÝ’è
if(elm.autoreturn !== void)
autoReturn = +elm.autoreturn;
}
function makeButtons()
{
if(prevPageButton !== void) return; // ‚·‚Å‚É쬂³‚ê‚Ä‚¢‚é
prevPageButton = new LButtonLayer2(window, this);
nextPageButton = new LButtonLayer2(window, this);
prevPageButton2 = new LButtonLayer2(window, this);
nextPageButton2 = new LButtonLayer2(window, this);
closeButton = new LButtonLayer(window, this);
if(verticalView)
{
nextPageButton.left = 0;
nextPageButton.top = 0;
nextPageButton.width = (width-controlHeight) \ 2;
nextPageButton.height = controlHeight-2;
nextPageButton.caption = "á ŽŸƒy[ƒW ";
nextPageButton.color = 0x808080;
nextPageButton.visible = true;
prevPageButton.left = nextPageButton.width;
prevPageButton.top = 0;
prevPageButton.width = nextPageButton.width;
prevPageButton.height = controlHeight-2;
prevPageButton.caption = " ‘Oƒy[ƒW â";
prevPageButton.color = 0x808080;
prevPageButton.visible = true;
}
else
{
prevPageButton.loadImages("backlog_up");
prevPageButton.left = 735;
prevPageButton.top = 31;
prevPageButton.visible = true;
prevPageButton2.loadImages("backlog_up2");
prevPageButton2.left = 735;
prevPageButton2.top = 155;
prevPageButton2.visible = true;
nextPageButton2.loadImages("backlog_down2");
nextPageButton2.left = 735;
nextPageButton2.top = 279;
nextPageButton2.visible = true;
nextPageButton.loadImages("backlog_down");
nextPageButton.left = 735;
nextPageButton.top = 403;
nextPageButton.visible = true;
}
closeButton.loadImages("backlog_return");
closeButton.left = 735;
closeButton.top = 527;
closeButton.visible = true;
scrollBar = new BarControlLayer(window , this);
scrollBar.top = 704;
scrollBar.minPos = 62;
scrollBar.maxPos = 961;
scrollBar.minValue = 0;
scrollBar.maxValue = 20;
scrollBar.loadImages("barControl");
scrollBar.value = 0;
scrollBar.visible = true;
scrollBar.enabled = true;
}
property lastLine
{
getter
{
if(everypage)
return data[dataPage][dataPos];
else
return data[dataPos];
}
setter(line)
{
if(everypage)
data[dataPage][dataPos] = line;
else
data[dataPos] = line;
}
}
property lastAction
{
getter
{
if(everypage)
return actionInfo[dataPage][dataPos];
else
return actionInfo[dataPos];
}
setter
{
if(everypage)
actionInfo[dataPage][dataPos] = n;
else
actionInfo[dataPos] = n;
}
}
function getLine
{
// n ”Ô–Ú‚Ìs‚𓾂é
n += dataStart;
if(n >= maxLines) n -= maxLines;
return data[n];
}
function getPage
{
// n ”Ԗڂ̃y[ƒW‚𓾂é
n += dataStart;
if(n >= maxPages) n -= maxPages;
return data[n];
}
function getLineStart
{
// n ”Ô–Ú‚Ìs‚Ì•\Ž¦ŠJŽnˆÊ’u‚𓾂é
n += dataStart;
if(n >= maxLines) n -= maxLines;
return lineStart[n];
}
function getLineStart2(n, m)
{
// n ƒy[ƒW–Ú‚ÌAm s–Ú‚Ì•\Ž¦ŠJŽnˆÊ’u‚𓾂é
n += dataStart;
if(n >= maxPages) n -= maxPages;
return lineStart[n][m];
}
function getActionInfo
{
// n ”Ԗڂ̃AƒNƒVƒ‡ƒ“î•ñ‚𓾂é
n += dataStart;
if(n >= maxLines) n -= maxLines;
return actionInfo[n];
}
function getActionInfo2(n, m)
{
// n ƒy[ƒW–Ú‚ÌAm s–ڂ̃AƒNƒVƒ‡ƒ“î•ñ‚𓾂é
n += dataStart;
if(n >= maxPages) n -= maxPages;
return actionInfo[n][m];
}
function endAction()
{
if(currentAction !== void)
{
// Œ»Ý‚̃AƒNƒVƒ‡ƒ“‚ª‚·‚Å‚É‚ ‚éê‡
var ca = currentAction;
var last = ca[ca.count - 1];
last.end = font.getTextWidth(currentLine) - font.height;
}
}
function endAction2()
{
if(currentAction !== void)
{
// Œ»Ý‚̃AƒNƒVƒ‡ƒ“‚ª‚·‚Å‚É‚ ‚éê‡
var ca = currentAction;
var last = ca[ca.count - 1];
last.end = font.getTextWidth(currentLine);
}
}
function setNewAction(action)
{
// ƒAƒNƒVƒ‡ƒ“‚ðV‹K‚ÉÝ’è‚·‚é
if(action == "") action = void;
if(action === void) return;
endAction2();
currentActionExp = action;
if(currentAction == void) currentAction = [];
var last = currentAction[currentAction.count] = %[];
last.start = font.getTextWidth(currentLine);
last.action = action;
last.id = ++currentActionID;
lastCurrentActionExp = action;
}
function continueAction()
{
if(currentActionExp === void) return;
if(currentAction == void) currentAction = [];
var last = currentAction[currentAction.count] = %[];
last.start = font.getTextWidth(currentLine);
last.action = currentActionExp;
last.id = currentActionID;
}
function clearAction()
{
endAction();
currentActionExp = void;
}
function store(ch)
{
if(!autoReturn)
{
// Ž©“®‰üs‚ðs‚í‚È‚¢ê‡
currentLine += ch;
}
else
{
// Ž©“®‰üs‚ðs‚¤ê‡
var len;
if((len = font.getTextWidth(currentLine += ch)) >= relinePos)
{
var curlen = currentLine.length;
var lastch = curlen >= 2 ? currentLine[curlen - 2] : '';
if( ((lastch=='' || wwLeading.indexOf(lastch)==-1) && wwFollowing.indexOf(ch)==-1) ||
(lastch!='' && wwFollowingWeak.indexOf(lastch)!=-1 && wwFollowingWeak.indexOf(ch)!=-1) ||
len > limitPos)
{
// ÅŒã‚É•`‰æ‚µ‚½‚Ì‚ªs––‹Ö‘¥•¶Žš‚Å‚È‚¢ê‡@‚µ‚©‚à‚±‚ê‚©‚ç•`‰æ‚·‚é‚Ì‚ªs“ª‹Ö‘¥•¶Žš‚Å‚È‚¢ê‡
// ‚Ü‚½‚ÍŽã‹Ö‘¥•¶Žš‚ª˜A‘±‚µ‚Ä‚¨‚炸‚±‚ê‚©‚ç•`‰æ‚·‚é‚Ì‚ª‹‹Ö‘¥•¶Žš‚Å‚Í‚È‚¢
// ‚Ü‚½‚ÍŠmŽÀ‚É ‰E’[‚ð‰z‚¦‚éê‡
// ( ‚±‚Ìꇂ͗]”’‚Íl‚¦‚È‚¢ )
currentLine=
currentLine.substring(0, currentLine.length - ch.length); // ’ljÁ‚µ‚½•¶Žš‚ðŽæ‚蜂
reline(true);
currentLine = ch;
wwStr = '';
}else{
if(wwStr.length>0 && wwFollowing.indexOf(ch)!=-1){
currentLine = currentLine.substring(0, currentLine.length - wwStr.length - ch.length);
reline(true);
currentLine = wwStr + ch;
wwStr = '';
lineStart[dataPos] = lastIndentPos;
lastIndentPos = 0;
if(lastCurrentActionExp!==void){
if(currentAction == void) currentAction = [];
var last = currentAction[currentAction.count] = %[];
last.start = lastIndentPos;
last.action = lastCurrentActionExp;
last.id = currentActionID;
endAction2();
}
}else{
if(wwStr == ''){
var i = currentLine.length - 2;
while(wwFollowing.indexOf(currentLine
)!=-1){
i--;
lastch = currentLine + lastch;
}
wwStr = lastch + ch;
}else{
wwStr = ch;
}
}
}
}
}
}
function repage()
{
// ‰üƒy[ƒW
if(!everypage) return;
if(dataPos == 0 && currentLine == "") return; // ‰½‚àƒf[ƒ^‚ª“ü‚Á‚Ä‚¢‚È‚¢ê‡A‚È‚É‚à‚µ‚È‚¢
endAction();
lastLine = currentLine;
lastAction = currentAction;
dataPage++;
if(dataPage >= maxPages) dataPage = 0;
dataPos = 0;
data[dataPage] = [];
lineStart[dataPage] = [];
lineStart[dataPage][dataPos] = indentPos;
actionInfo[dataPage] = [];
actionInfo[dataPage][dataPos] = currentAction;
if(dataPage == dataStart) dataStart++;
if(dataStart >= maxPages) dataStart = 0;
if(dataPages < maxPages-1) dataPages++;
currentAction = void;
currentLine = '';
continueAction();
}
//ryo--
function reline(flg=false)
{
// ‰üs
if(everypage)
{
if(dataPos + 1 >= repageLine)
{
// ‰üƒy[ƒW‚·‚ׂ«s”‚É‚È‚Á‚½‚Æ‚«
repage();
}
else
{
endAction();
lastLine = currentLine;
lastAction = currentAction;
dataPos++;
lineStart[dataPage][dataPos] = indentPos;
limitPos = limitPos_org - indentPos;
relinePos = relinePos_org - indentPos;
currentAction = void;
currentLine = '';
continueAction();
}
}
else
{
if(flg){
endAction2();
}else{
endAction();
}
lastLine = currentLine;
lastAction = currentAction;
if(currentLine!==void && currentLine.length==0){
lastIndentPos = 0;
lastCurrentActionExp = void;
}
dataPos++;
if(dataPos >= maxLines) dataPos=0;
data[dataPos] = void;
lineStart[dataPos] = indentPos;
limitPos = limitPos_org - indentPos;
relinePos = relinePos_org - indentPos;
if(dataPos == dataStart) dataStart++;
if(dataStart >= maxLines) dataStart = 0;
if(dataLines < maxLines) dataLines++;
currentAction = void;
currentLine = '';
continueAction();
}
}
//--
function beginIndent()
{
// Œ»ÝˆÊ’u‚ɃCƒ“ƒfƒ“ƒg‚ðÝ’è
indentPos = font.getTextWidth(currentLine);
lastIndentPos = indentPos;
}
function endIndent()
{
// ƒCƒ“ƒfƒ“ƒg‚ð‰ðœ
lastIndentPos = indentPos;
indentPos = 0;
}
function clearBack
{
// ”wŒi‚ð“h‚è‚‚Ԃ·
if(n === void)
{
face = dfAlpha;
// fillRect(0, 0, width, height, 0xb0000000);
loadImages("backlog_bg");
}
else
{
face = dfAlpha;
if(verticalView)
fillRect(width - marginR - (n+1)*lineHeight, controlHeight, lineHeight,
height - controlHeight, 0xc0000000);
else
fillRect(clearLeft, n*lineHeight + controlHeight + marginT, clearWidth, lineHeight, 0xc0000000);
}
}
function dispInit()
{
// ‘S•”Ä•`‰æ‚ƉŠúÝ’è
makeButtons(); // ƒ{ƒ^ƒ“‚ðì¬
lastLine = currentLine;
endAction();
lastAction = currentAction;
antialiased = window.chDefaultAntialiased;
clearBack();
if(everypage)
{
if(dataPages>0)
{
canScroll = true;
dispStart = dataPages - 1;
}
else
{
canScroll = false;
dispStart = 0;
}
drawPage();
}
else
{
if(verticalView)
dispLines = (width - marginR - marginL) \ lineHeight;
else
dispLines = (height - marginT - marginB - controlHeight) \ lineHeight;
if(dataLines <= dispLines)
{
// •\Ž¦‰Â”\”͈͓à‚ÉŽû‚Ü‚é
canScroll = false;
dispStart = 0;
var i;
for(i= 0; i < dataLines; i++)
drawLine(i);
}
else
{
// •\Ž¦‰Â”\”͈͓à‚ÉŽû‚Ü‚ç‚È‚¢
canScroll = true;
dispStart = dataLines - dispLines;
var i;
for(i = 0; i < dispLines; i++)
drawLine(i);
}
}
updateButtonState();
visible = true;
setMode();
focus();
lastWheelTick = 0;
cursor = window.cursorDefault;
}
function dispUninit()
{
// window ‚©‚çŒÄ‚΂ê‚é
removeMode();
visible = false;
}
//ryo--
function drawLine
{
// •\Ž¦s n ‚ð•`‰æ‚·‚é
var line = everypage?getPage(dispStart)[n]:getLine(n + dispStart);
var lastDrawnCh = "";
if(line===void)return;
if(everypage && line=="") return;
var linestart = everypage?getLineStart2(dispStart, n):getLineStart(n + dispStart);
if(verticalView)
{
var x = width - marginR - n*lineHeight;
drawText(x, marginT + controlHeight + linestart, line, historyColor, 255, antialiased, 255, 0x000000, 0, 2, 2);
}
else
{
var tmp = getActionInfo(n + dispStart);
var x = marginL + linestart;
var y = n*lineHeight + controlHeight + marginT;
if(tmp === void){
for(var i=0 ; i<line.length ; i++){
putChar(line, x, y, historyColor, lastDrawnCh);
x += font.getTextWidth(line);
lastDrawnCh = line;
}
}else{
for(var i=0 ; i<line.length ; i++){
putChar(line, x, y, historyActionColor, lastDrawnCh);
x += font.getTextWidth(line);
lastDrawnCh = line;
}
}
}
}
function putChar(ch, dx, dy, col, last)
{
var gaijiflg = false;
for(var j=0 ; j<gaiji.count ; j++){
if(ch==gaiji[j].alt){
putGraph(gaiji[j].storage[antialiased], dx, dy,col);
gaijiflg = true;
}
}
if(gaijiflg==false){
if(ch == "\"){
var cw = font.getTextWidth(ch);
if(last=="\"){
fillRect(dx-1, dy+cw\2 , cw , (antialiased)?2:1, 0xff000000);
fillRect(dx-2, dy+cw\2-1, cw , (antialiased)?2:1, 0xff000000|col);
}else{
fillRect(dx+3, dy+cw\2 , cw-4, (antialiased)?2:1, 0xff000000);
fillRect(dx+2, dy+cw\2-1, cw-4, (antialiased)?2:1, 0xff000000|col);
}
}else{
drawText(dx, dy, ch, col, 255, antialiased, 255, 0x000000, 0, 2, 2);
}
}
}
function putGraph(storage, x, y, color)
{
// ‰æ‘œ storage ‚ð•`‰æ‚·‚é
// ƒeƒ“ƒ|ƒ‰ƒŠ‚̃ŒƒCƒ„‚ð—pˆÓ
var lay = window.temporaryLayer;
lay.type = ltTransparent;
lay.face = dfAuto;
lay.loadImages(storage); // ‰æ‘œ“Ç‚Ýž‚Ý
var lw, lh;
lw = lay.imageWidth;
lh = lay.imageHeight;
lay.face = dfOpaque;
lay.holdAlpha = true;
// ‰e
lay.fillRect(0, 0, lw, lh, 0x000000);
operateRect(x+2, y+2, lay, 0, 0, lw, lh);
// ƒƒCƒ“‚𕶎šF‚Å“h‚è‚‚Ԃ·
lay.fillRect(0, 0, lw, lh, color);
operateRect(x, y, lay, 0, 0, lw, lh); // •`‰æ
}
//--
function drawPage()
{
var page = getPage(dispStart);
var i;
if(verticalView)
{
var x = width - marginR;
for(i = 0; i < repageLine; i++)
{
if(page!="")
drawText(x, marginT + controlHeight + getLineStart2(dispStart, i),
page, historyColor, 255, antialiased, 255, 0x000000, 0, 2, 2);
x -= lineHeight;
}
}
else
{
var y = controlHeight + marginT;
for(i = 0; i < repageLine; i++)
{
if(page!="")
drawText(marginL + getLineStart2(dispStart, i), y, page,
historyColor, 255, antialiased, 255, 0x000000, 0, 2, 2);
y += lineHeight;
}
}
}
function getActionInfoFromPos(x, y)
{
// x,y ˆÊ’u‚̃AƒNƒVƒ‡ƒ“ ID ‚𓾂é
var line;
if(verticalView)
line = -(x - width + marginR) \ lineHeight;
else
line = (y - controlHeight - marginT) \ lineHeight;
if(line < 0) return void;
if(!everypage && dataLines <= dispLines && line >= dataLines) return void; // ‚Í‚Ýo‚Ä‚¢‚é
var ai;
if(everypage)
{
ai = getActionInfo2(dispStart, line);
}
else
{
line += dispStart;
ai = getActionInfo(line);
}
if(ai === void) return void; // î•ñ‚ª‚È‚¢
var p = verticalView ? (y - marginT - controlHeight) : (x - marginL);
p -= everypage ? getLineStart2(dispStart, line) : getLineStart(line);
for(var i = ai.count - 1; i >= 0; i--)
{
var info = ai;
if(info.end !== void && info.start < p && p <= info.end) return info;
}
return void;
}
function highlightAction(id)
{
// ‰æ–Êã‚É‚ ‚é ID ‚ÅŽ¦‚³‚ꂽ ID ‚ð‚·‚×‚Ä ƒnƒCƒ‰ƒCƒg‚·‚é
lastHighlightedActionID = id;
if(id == 0) return;
var max = everypage ? repageLine : ((dataLines <= dispLines) ? dataLines : dispLines);
//ryo--
var tmpx;
var tmpy;
for(var i = 0; i < max; i++)
{
var ai = everypage?getActionInfo2(dispStart, i):getActionInfo(i + dispStart);
if(ai === void) continue;
for(var ii = ai.count - 1; ii >= 0; ii--)
{
var info = ai[ii];
if(info.end !== void && info.id == id)
{
var linestart = everypage?getLineStart2(dispStart, i):getLineStart(i + dispStart);
if(verticalView)
{
var x = width - marginR - (i-1)*lineHeight - 1;
fillRect(x - lineHeight, info.start + marginT + controlHeight + linestart,
1, info.end - info.start, 0xff000000 | historyColor);
}
else
{
var y = i*lineHeight + controlHeight + marginT;
fillRect(marginL + linestart + info.start, y + lineHeight - 7,
info.end - info.start, 1, 0xff000000 | historyColor);
tmpx = marginL + linestart + info.end;
tmpy = y + lineHeight - 1;
}
}
}
}
// fillRect(tmpx - 20, tmpy, 20, 1, 0xb0000000);
//--
}
function clearActionHighlights()
{
// ‰æ–Êã‚É‚ ‚é lastHighlightedActionID ‚ÅŽ¦‚³‚ꂽƒnƒCƒ‰ƒCƒg•\Ž¦‚ð
// ‚·‚ׂÄÁ‚·
if(lastHighlightedActionID == 0) return;
var max = everypage ? repageLine : ((dataLines <= dispLines) ? dataLines : dispLines);
for(var i = 0; i < max; i++)
{
var ai = everypage?getActionInfo2(dispStart, i):getActionInfo(i + dispStart);
if(ai === void) continue;
for(var ii = ai.count - 1; ii >= 0; ii--)
{
var info = ai[ii];
if(info.end !== void && info.id == lastHighlightedActionID)
{
clearBack(i);
drawLine(i); // s‚ð•`‰æ‚µ‚È‚¨‚·
}
}
}
lastHighlightedActionID = 0;
cursor = window.cursorDefault;
}
function updateButtonState()
{
if(!canScroll)
{
prevPageButton.enabled = canScroll;
prevPageButton2.enabled = canScroll;
prevPageButton.captionColor = canScroll?0xff8080:0x808080;
nextPageButton.enabled = canScroll;
nextPageButton2.enabled = canScroll;
nextPageButton.captionColor = canScroll?0xff8080:0x808080;
return;
}
if(dispStart==0)
{
prevPageButton.enabled = false;
prevPageButton2.enabled = false;
prevPageButton.captionColor = 0x808080;
}
else
{
prevPageButton.enabled = true;
prevPageButton2.enabled = true;
prevPageButton.captionColor = 0xff8080;
}
if( (everypage && dispStart >= dataPages-1) ||
(!everypage && dispStart >= dataLines-dispLines))
{
nextPageButton.enabled = false;
nextPageButton2.enabled = false;
nextPageButton.captionColor = 0x808080;
}
else
{
nextPageButton.enabled = true;
nextPageButton2.enabled = true;
nextPageButton.captionColor = 0xff8080;
}
}
function prevPage()
{
// ‘Oƒy[ƒW‚Ɉړ®
if(!canScroll) return;
clearActionHighlights();
if(everypage)
{
if(dispStart<1) return;
dispStart--;
clearBack();
drawPage();
}
else
{
clearBack();
if(dispStart >= dispLines)
dispStart -= dispLines;
else
dispStart = 0;
var i;
for(i = 0 ; i < dispLines; i++)
drawLine(i);
}
updateButtonState();
}
function nextPage()
{
// ŽŸƒy[ƒW‚Ɉړ®
if(!canScroll) return;
clearActionHighlights();
if(everypage)
{
if(dispStart>=dataPages-1) return;
dispStart++;
clearBack();
drawPage();
}
else
{
clearBack();
if(dispStart < dataLines - dispLines)
dispStart += dispLines;
if(dispStart > dataLines - dispLines)
dispStart = dataLines - dispLines;
var i;
for(i = 0 ; i < dispLines; i++)
drawLine(i);
}
updateButtonState();
}
function scrollUp()
{
if(dispStart < dataLines - dispLines)
{
clearActionHighlights();
if(verticalView)
copyRect(width - marginR - lineHeight *(dispLines - 1), controlHeight, this,
width - marginR - lineHeight *(dispLines), controlHeight,
lineHeight * (dispLines-1), height - controlHeight);
else
copyRect(clearLeft, controlHeight + marginT, this, clearLeft, controlHeight + lineHeight + marginT, clearWidth , lineHeight*(dispLines-1));
clearBack(dispLines - 1);
dispStart++;
drawLine(dispLines - 1);
updateButtonState();
}
}
function scrollDown()
{
if(dispStart!=0)
{
clearActionHighlights();
if(verticalView)
copyRect(width - marginR - lineHeight *(dispLines), controlHeight, this,
width - marginR - lineHeight *(dispLines-1),
controlHeight, lineHeight * (dispLines-1), height - controlHeight);
else
copyRect(clearLeft, controlHeight + lineHeight + marginT, this, clearLeft, controlHeight + marginT, clearWidth , lineHeight*(dispLines-1));
clearBack(0);
dispStart--;
drawLine(0);
updateButtonState();
}
}
function hide()
{
window.hideHistory();
}
function onButtonClick(sender)
{
if(sender == prevPageButton)
prevPage();
else if(sender == prevPageButton2)
scrollDown();
else if(sender == nextPageButton)
nextPage();
else if(sender == nextPageButton2)
scrollUp();
else if(sender == closeButton)
hide();
}
function onMouseDown(x, y, button)
{
if(button == mbRight) hide();
else if(button == mbLeft)
{
var n = getActionInfoFromPos(x,y);
if(n !== void)
{
Scripts.eval(n.action);
}
}
super.onMouseDown(...);
}
function onMouseMove(x, y, shift)
{
var n = getActionInfoFromPos(x,y);
n = (n === void) ? 0 : n.id;
if(lastHighlightedActionID != n)
{
clearActionHighlights();
highlightAction;
lastHighlightedActionID = n;
if cursor = window.cursorPointed;
}
super.onMouseMove(...);
}
function onMouseLeave()
{
clearActionHighlights();
super.onMouseLeave(...);
}
function onKeyPress(key)
{
super.onKeyPress(...);
}
function onKeyDown(key)
{
window.hideMouseCursor();
if(canScroll)
{
if(verticalView)
{
if(key == VK_DOWN)
nextPage();
else if(key == VK_UP)
prevPage();
else if(key == VK_LEFT || key == VK_PRIOR)
{
if(everypage)
prevPage();
else
scrollUp();
}
else if(key == VK_RIGHT || key == VK_NEXT)
{
if(everypage)
nextPage();
else
scrollDown();
}
}
else
{
if(key == VK_DOWN)
{
if(everypage)
nextPage();
else
scrollUp();
}
else if(key == VK_UP)
{
if(everypage)
prevPage();
else
scrollDown();
}
else if(key == VK_LEFT || key == VK_PRIOR)
prevPage();
else if(key == VK_RIGHT || key == VK_NEXT)
nextPage();
}
}
//ryo--
if(key == VK_ESCAPE || key == VK_RETURN || key == VK_SPACE || key == VK_NUMPAD0 || key == VK_Z || key == VK_X || key == VK_DELETE)
{
hide();
}
}
function windowMouseWheel(shift, delta, x, y)
{
// ƒEƒBƒ“ƒhƒE‚̃zƒC[ƒ‹‘€ìƒƒbƒZ[ƒW‚ª‚±‚±‚É—¬‚³‚ê‚é
var currenttick = System.getTickCount();
delta = delta \ 120;
if(delta > 0 )
{
// ‰œ
while(delta--)
{
if(everypage)
prevPage();
else
scrollDown();
}
}
else if(delta < 0 )
{
// Žè‘O
if(currenttick - lastWheelTick > 150 &&
((everypage && dispStart >= dataPages-1) ||
(!everypage && dispStart >= dataLines - dispLines)))
{
/* ‚‚é‚‚é‰ñ‚µ‚Ä‚¢‚邤‚¿‚É‚¢‚«‚È‚è—š—ð‚ª•Â‚¶‚½‚肵‚È‚¢‚悤‚ÈŽdŠ|‚¯ */
// Šù‚ÉÅI•”•ª‚ð•\Ž¦‚µ‚Ä‚¢‚é
hide();
}
else
{
delta = -delta;
while(delta--)
{
if(everypage)
nextPage();
else
scrollUp();
}
}
}
lastWheelTick = currenttick;
}
}