Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==PREPROCESSOR==
- // @name "DarkOne4Mod - Control Panel - Left"
- // @version "2.0 build20190905"
- // @author "tedGo"
- // ==/PREPROCESSOR==
- // =========================================================================================================
- // ----- Global Config Script ------------------------------------------------------------------------------
- // =========================================================================================================
- /*
- Config code by tedGo.
- Many thanks to the countless helpers - like super-gau, Br3tt, eXtremeHunter1972, fbuser, grimes and all the
- others - who provided code snippets, samples, examples and hints.
- My specials thanks to T.P. Wang, marc2003 and The Qwertiest for their great components!
- */
- var configName = "darkone4mod";
- var configPath = fb.ProfilePath + "cui-configs\\" + configName + "\\";
- var imgPath = configPath + "images\\";
- var g_signs = gdi.Image(imgPath + "Signs.png");
- var ui_type = window.InstanceType;
- var p_backcol = RGBA(31, 31, 31, 255);
- var ww = 0; wh = 0;
- // ----- CREATE RGB(A) -----
- function RGBA(r, g, b, a) {
- return ((a << 24) | (r << 16) | (g << 8) | (b));
- }
- function RGB(r, g, b) {
- return (0xff000000 | (r << 16) | (g << 8) | (b));
- }
- // ----- CREATE CUSTOM COLOURS -----
- function CustomColour(colour){
- tempc = colour.split("-");
- return ((tempc[3] << 24) | (tempc[0]<<16) | (tempc[1]<<8) | (tempc[2]));
- }
- function setAlpha(colour, a) {
- return ((colour & 0x00ffffff) | (a << 24));
- }
- function toRGB(d){
- var d, r, g, b;
- d = d - 0xff000000; r = d >> 16; g = d >> 8 & 0xFF; b = d & 0xFF;
- return [r,g,b];
- }
- function combColours(c1, c2, f){
- var c1, c2;
- c1 = toRGB(c1); c2 = toRGB(c2);
- var r, g, b;
- r = Math.round(c1[0] + f * (c2[0] - c1[0])); g = Math.round(c1[1] + f * (c2[1] - c1[1])); b = Math.round(c1[2] + f * (c2[2] - c1[2]));
- return (0xff000000 | (r << 16) | (g << 8) | (b));
- }
- // ----- GET UI COLOURS -----
- function get_colours() {
- ui_backcol = ui_type == 0 ? window.GetColourCUI(3) : window.GetColourDUI(1);
- ui_textcol = ui_type == 0 ? window.GetColourCUI(0) : window.GetColourDUI(0);
- ui_btntxtcol = ui_type == 0 ? window.GetColourCUI(2) : window.GetColourDUI(0);
- }
- get_colours();
- function on_colours_changed() {
- get_colours();
- window.Repaint();
- }
- // ----- HELPERS -----
- function repeat(str, num) {
- num = Number(num);
- var result = '';
- while (true) {
- if (num & 1) result += str;
- num >>>= 1;
- if (num <= 0) break;
- str += str;
- }
- return result;
- }
- function capitalize(str) {
- return str.charAt(0).toUpperCase() + str.slice(1);
- }
- // ----- ACTIVE-X-OBJECTS -----
- function actXobj() {
- var fso = new ActiveXObject("Scripting.FileSystemObject");
- var sha = new ActiveXObject("Shell.Application");
- var wsh = new ActiveXObject("WScript.Shell");
- this.fsoCreate = function(path1, path2) {
- return fso.FileExists(path1) || fso.FileExists(path2) ? null : fso.CreateTextFile(path1, true);
- }
- this.fsoSwitch = function(path1, path2) {
- return fso.FileExists(path1) ? fso.MoveFile(path1, path2) : fso.MoveFile(path2, path1);
- }
- this.shaOpen = function(path) {
- return sha.Open(path);
- }
- this.wshPopup = function(text, title, idx) {
- return wsh.Popup(text, 0, title, idx);
- }
- }
- var axo = new actXobj();
- // =========================================================================================================
- // ----- Global Button Script ------------------------------------------------------------------------------
- // =========================================================================================================
- var ButtonStates = {normal: 0, hover: 1, down: 2, hide: 3};
- var Buttons = {};
- var btn_down = false;
- var cur_btn = null;
- var btn_tooltip;
- function buttonsDraw(gr) {
- for (var i in Buttons) Buttons[i].draw(gr);
- }
- function buttonsTraceMouse(x, y) {
- var btn = null;
- for (var i in Buttons) {
- if (Buttons[i].traceMouse(x, y) && !btn)
- btn = Buttons[i];
- }
- return btn;
- }
- function buttonsMouseMove(x, y) {
- var btn = buttonsTraceMouse(x, y);
- if (btn != cur_btn) {
- cur_btn && cur_btn.onMouseOut();
- btn && btn.onMouseIn();
- }
- cur_btn = btn;
- }
- function buttonsMouseLbtnDown(x, y) {
- btn_down = true;
- (btn_down = cur_btn) && cur_btn.changeState(ButtonStates.down);
- }
- function buttonsMouseLbtnUp(x, y) {
- if (cur_btn) {
- cur_btn.changeState(ButtonStates.hover);
- btn_down == cur_btn && cur_btn.onClick(x, y);
- }
- btn_down = false;
- }
- function buttonsMouseLeave() {
- cur_btn && cur_btn.changeState(ButtonStates.normal);
- }
- // =========================================================================================================
- // ----- TextButton Object ---------------------------------------------------------------------------------
- // =========================================================================================================
- function TextButton(text, func, x, y, w, h, size_options, options, colours, tiptext, funcOption) {
- this.text = text;
- this.func = func;
- this.x = x;
- this.y = y;
- this.w = w;
- this.h = h;
- var tmp_size = ["text_x_margin", "text_y_margin", "func_left_pad", "func_top_pad", "func_right_pad", "func_bottom_pad"];
- for (var l = 0; l < 6; l++) this[tmp_size[l]] = size_options && size_options[tmp_size[l]] ? size_options[tmp_size[l]] : 0;
- this.font_size = size_options && size_options.font_size ? size_options.font_size : 12;
- this.left = x + this.func_left_pad;
- this.top = y + this.func_top_pad;
- this.w_ = w - this.func_left_pad - this.func_right_pad;
- this.h_ = h - this.func_top_pad - this.func_bottom_pad;
- this.right = x + w - this.func_right_pad;
- this.bottom = y + h - this.func_bottom_pad;
- var as_tmp = Math.min(this.w_, this.h_) / 2;
- this.arc_size = size_options && size_options.arc_size ? Math.min(as_tmp, size_options.arc_size) : Math.min(as_tmp, Math.min(this.w, this.h) / 6);
- var tmp_opt = ["btn_style", "font_style", "line_width", "text_align_h", "text_align_v", "text_onclick_shift", "text_shadow", "btn_depth"];
- for (var i = 0; i < 8; i++) this[tmp_opt[i]] = options && options[tmp_opt[i]] ? options[tmp_opt[i]] : 0;
- this.font_name = options && options.font_name ? options.font_name : "";
- this.text_shift = 0;
- var tmp_col = ["shadow_colour", "text_normal", "line_normal", "back_normal", "text_hover", "line_hover", "back_hover", "text_down", "line_down", "back_down"];
- for (var j = 0; j < 10; j++) this[tmp_col[j]] = colours && colours[tmp_col[j]] ? colours[tmp_col[j]] : j < 4 ? null : this[tmp_col[j - 3]];
- this.colour_text = this[tmp_col[1]];
- this.colour_line = this[tmp_col[2]];
- this.colour_back = this[tmp_col[3]];
- this.tiptext = tiptext ? tiptext : "";
- this.funcOption = funcOption;
- this.state = ButtonStates.normal;
- this.traceMouse = function(x, y) {
- if (this.state == ButtonStates.hide) return false;
- var b = this.left < x && x < this.right && this.top < y && y < this.bottom;
- if (b) btn_down ? this.changeState(ButtonStates.down) : this.changeState(ButtonStates.hover);
- else this.changeState(ButtonStates.normal);
- return b;
- }
- this.changeState = function(newstate) {
- newstate != this.state && this.repaint();
- this.state = newstate;
- this.text_shift = this.state == ButtonStates.down ? this.text_onclick_shift : 0;
- switch (this.state) {
- case ButtonStates.normal:
- this.colour_text = this.text_normal;
- this.colour_line = this.line_normal;
- this.colour_back = this.back_normal;
- break;
- case ButtonStates.hover:
- this.colour_text = this.text_hover;
- this.colour_line = this.line_hover;
- this.colour_back = this.back_hover;
- break;
- case ButtonStates.down:
- this.colour_text = this.text_down;
- this.colour_line = this.line_down;
- this.colour_back = this.back_down;
- break;
- default:
- this.colour_text = this.colour_line = this.colour_back = null;
- }
- }
- this.draw = function(gr) {
- if (this.btn_style == 1) {
- this.colour_back && gr.FillSolidRect(this.left, this.top, this.w_, this.h_, this.colour_back);
- this.btn_depth > 0 && gr.DrawRect(this.left, this.top + Math.ceil(this.btn_depth / 2), this.w_, this.h_ - Math.ceil(this.btn_depth / 2), this.btn_depth, 0x1FFFFFFF);
- this.btn_depth > 0 && gr.DrawRect(this.left, this.top, this.w_, this.h_ - Math.ceil(this.btn_depth / 2), this.btn_depth, 0x3F000000);
- this.colour_line && this.line_width > 0 && gr.DrawRect(this.left, this.top, this.w_, this.h_, this.line_width, this.colour_line);
- }
- if (this.btn_style == 2) {
- this.colour_back && gr.FillRoundRect(this.left, this.top, this.w_, this.h_, this.arc_size, this.arc_size, this.colour_back);
- this.btn_depth > 0 && gr.DrawRoundRect(this.left, this.top + Math.ceil(this.btn_depth / 2), this.w_, this.h_ - Math.ceil(this.btn_depth / 2), this.arc_size, this.arc_size, this.btn_depth, 0x1FFFFFFF);
- this.btn_depth > 0 && gr.DrawRoundRect(this.left, this.top, this.w_, this.h_ - Math.ceil(this.btn_depth / 2), this.arc_size, this.arc_size, this.btn_depth, 0x3F000000);
- this.colour_line && this.line_width > 0 && gr.DrawRoundRect(this.left, this.top, this.w_, this.h_, this.arc_size, this.arc_size, this.line_width, this.colour_line);
- }
- if (this.btn_style == 3) {
- this.colour_back && gr.FillEllipse(this.left, this.top, this.w_, this.h_, this.colour_back);
- this.btn_depth > 0 && gr.DrawEllipse(this.left, this.top + Math.ceil(this.btn_depth / 2), this.w_, this.h_ - Math.ceil(this.btn_depth / 2), this.btn_depth, 0x1FFFFFFF);
- this.btn_depth > 0 && gr.DrawEllipse(this.left, this.top, this.w_, this.h_ - Math.ceil(this.btn_depth / 2), this.btn_depth, 0x3F000000);
- this.colour_line && this.line_width > 0 && gr.DrawEllipse(this.left, this.top, this.w_, this.h_, this.line_width, this.colour_line);
- }
- var txt_h = this.text != "" ? gr.CalcTextHeight(this.text, gdi.Font(this.font_name, this.font_size, this.font_style)) : 0;
- var txt_y = this.text_align_v == 1 ? this.y + Math.floor((this.h - txt_h) / 2) : this.text_align_v == 2 ? this.y + Math.floor(this.h / 3 * 2) : this.y;
- txt_h > 0 && this.text_shadow > 0 && gr.GdiDrawText(this.text, gdi.Font(this.font_name, this.font_size, this.font_style), this.shadow_colour, this.x + this.text_x_margin + Math.abs(this.text_shift) + this.text_shadow, txt_y + this.text_y_margin + this.text_shift + this.text_shadow, this.w, txt_h, this.text_align_h);
- txt_h > 0 && gr.GdiDrawText(this.text, gdi.Font(this.font_name, this.font_size, this.font_style), this.colour_text, this.x + this.text_x_margin + Math.abs(this.text_shift), txt_y + this.text_y_margin + this.text_shift, this.w, txt_h, this.text_align_h);
- }
- this.repaint = function() {
- window.RepaintRect(this.x, this.y, this.w, this.h);
- }
- this.onClick = function() {
- this.func && this.func();
- }
- this.onMouseIn = function() {
- btn_tooltip = window.CreateTooltip();
- btn_tooltip.Text = this.tiptext;
- btn_tooltip.Activate();
- }
- this.onMouseOut = function() {
- btn_tooltip.Deactivate();
- btn_tooltip.Dispose();
- }
- }
- // =========================================================================================================
- // ----- Get Optional Button Properties --------------------------------------------------------------------
- // =========================================================================================================
- function getButtonProperties(keyIsButton) {
- this.OptButton = function() {
- this.BtnName;
- this.Text;
- this.CmdString;
- this.CmdStyle;
- this.Separator;
- this.Exists = false;
- }
- var btnOn = new OptButton();
- btnOn.BtnName = keyIsButton;
- btnOn.Exists = window.GetProperty(btnOn.BtnName, false);
- btnOn.Separator = window.GetProperty(btnOn.BtnName + " X" + repeat("=", 24), repeat("=", 30));
- if (btnOn.Exists) {
- btnOn.Text = window.GetProperty(btnOn.BtnName + " name (up to 10 letters)", btnOn.BtnName.toUpperCase());
- btnOn.CmdString = window.GetProperty(btnOn.BtnName + " command string", "");
- btnOn.CmdStyle = window.GetProperty(btnOn.BtnName + " command style", 0);
- } else {
- window.SetProperty(btnOn.BtnName + " name (up to 10 letters)", null);
- window.SetProperty(btnOn.BtnName + " command string", null);
- window.SetProperty(btnOn.BtnName + " command style", null);
- }
- return btnOn;
- }
- function OptBtnCmd() {
- var propName = this.funcOption.BtnName + " command style";
- var tmp_style = window.GetProperty(propName);
- var tmp_string = this.funcOption.CmdString;
- var tmp_msg;
- if (tmp_style == 0) {
- if (fb.RunMainMenuCommand(tmp_string)) window.SetProperty(propName, 1);
- else if (fb.RunContextCommandWithMetadb(tmp_string, fb.GetSelections())) window.SetProperty(propName, 2);
- else {
- try {
- eval(tmp_string);
- window.SetProperty(propName, 3);
- } catch(e) {
- tmp_msg = axo.wshPopup("The command \"" + tmp_string + "\" doesn't exist!\n\nMaybe you made a typo, it is a context command and you forgot to select at least one file in the playlist before you hit the button or it is a JScript command and the error is:\n\n" + e + "\n\nPlease hit \"OK\" to correct your command string or hit \"Cancel\", select at least one file in the playlist and hit the button again.", "Optional " + this.funcOption.BtnName + " error!", 49);
- tmp_msg == 1 && window.ShowProperties();
- }
- }
- } else {
- switch (tmp_style) {
- case 1:
- fb.RunMainMenuCommand(tmp_string);
- break;
- case 2:
- fb.RunContextCommandWithMetadb(tmp_string, fb.GetSelections());
- break;
- case 3:
- try {
- eval(tmp_string);
- } catch(e) {
- tmp_msg = axo.wshPopup("The command \"" + tmp_string + "\" is corrupted or obsolete!\n\nJScript error: \"" + e + "\"\n\nPlease hit \"OK\" to correct your command string.", "Optional " + this.funcOption.BtnName + " error!", 48);
- tmp_msg == 1 && window.ShowProperties();
- }
- break;
- }
- }
- }
- // =========================================================================================================
- // ----- Common Button Options -----------------------------------------------------------------------------
- // =========================================================================================================
- var appPreset = window.GetProperty("Buttons appearance preset", 1);
- var depthPreset = window.GetProperty("Buttons depth preset", 0);
- var btn1Opt = {}, btn2Opt = {}, btnsCol = {}, btn1Siz = {}, btn2Siz = {}, vknbOpt = {};
- var area, bxf, bbw, bbh, by1, by2, padX, padY, rbx = 0;
- var btn_panel;
- function buttonsOptions() {
- btn1Opt.btn_depth = Math.max(utils.GetSystemMetrics(0) / 1280, 1) * depthPreset;
- btn1Opt.btn_style = appPreset > 2 ? 3 : appPreset;
- btn1Opt.font_name = "Arial Black";
- //btn1Opt.font_style = 0;
- btn1Opt.line_width = Math.max(utils.GetSystemMetrics(0) / 1280, 1);
- btn1Opt.text_align_h = 1;
- //btn1Opt.text_align_v = 0;
- //btn1Opt.text_onclick_shift = 0;
- //btn1Opt.text_shadow = 0;
- if (btn_panel != 3) {
- btn2Opt.btn_depth = btn1Opt.btn_depth;
- btn2Opt.btn_style = appPreset > 3 ? appPreset - 3 : appPreset;
- //btn2Opt.font_name = btn1Opt.font_name;
- //btn2Opt.font_style = 0;
- btn2Opt.line_width = btn1Opt.line_width;
- //btn2Opt.text_align_h = 1;
- //btn2Opt.text_align_v = 0;
- //btn2Opt.text_onclick_shift = 0;
- //btn2Opt.text_shadow = 0;
- }
- if (btn_panel == 2) {
- vknbOpt.knob_depth = btn1Opt.btn_depth;
- vknbOpt.line_width = btn1Opt.line_width;
- }
- }
- function buttonsColours() {
- btnsCol.back_down = RGBA(255, 255, 255, 8);
- btnsCol.back_hover = RGBA(255, 255, 255, 16);
- //btnsCol.back_normal = RGBA(0, 0, 0, 0);
- //btnsCol.line_down = RGBA(0, 0, 0, 0);
- //btnsCol.line_hover = RGBA(0, 0, 0, 0);
- btnsCol.line_normal = RGBA(0, 0, 0, 255);
- //btnsCol.shadow_colour = RGB(0, 0, 0);
- //btnsCol.text_down = RGB(0, 0, 0);
- //btnsCol.text_hover = RGB(0, 0, 0);
- btnsCol.text_normal = ui_btntxtcol;
- if (btn_panel == 2) {
- vknbOpt.back_hover = RGBA(255, 255, 255, 16);
- //vknbOpt.back_normal = RGBA(0, 0, 0, 0);
- //vknbOpt.line_hover = RGBA(0, 0, 0, 0);
- vknbOpt.line_normal = RGBA(0, 0, 0, 255);
- }
- }
- function buttonsSizes() {
- area = ww / 21 * 20;
- padX = ww / 42;
- padY = btn_panel == 3 ? Math.floor(wh / 3) : Math.floor(ww / 105 * 4);
- bxf = area / 16;
- bbw = btn_panel == 3 ? ww - 8 : Math.floor(area / 8);
- bbh = Math.floor(bbw / 25 * 12);
- by1 = Math.floor(area / 80 * 7) + padY;
- by2 = wh - bbh - padY;
- rbx = (ww - area / 8) - (padX * 2);
- //btn1Siz.arc_size = 0;
- btn1Siz.font_size = bbw * 7 / 50;
- //btn1Siz.func_bottom_pad = 0;
- btn1Siz.func_left_pad = appPreset == 2 ? bbw / 25 : appPreset > 2 ? bbw / 2 - bbh / 4 : 0;
- btn1Siz.func_right_pad = btn1Siz.func_left_pad;
- btn1Siz.func_top_pad = appPreset == 1 ? Math.floor(bbh / 3 * 2) : appPreset == 2 ? Math.ceil(bbh / 2) : appPreset > 2 ? bbh / 2 : 0;
- //btn1Siz.text_x_margin = 0;
- //btn1Siz.text_y_margin = 0;
- if (btn_panel != 3) {
- //btn2Siz.arc_size = 0;
- //btn2Siz.font_size = bbw * 7 / 50;
- //btn2Siz.func_bottom_pad = 0;
- btn2Siz.func_left_pad = appPreset == 2 || appPreset == 5 ? bbw / 25 : appPreset == 3 ? (bbw - bbh) / 2 : 0;
- btn2Siz.func_right_pad = btn2Siz.func_left_pad;
- //btn2Siz.func_top_pad = 0;
- //btn2Siz.text_x_margin = 0;
- //btn2Siz.text_y_margin = 0;
- }
- }
- // =========================================================================================================
- // ----- Main Menu Function --------------------------------------------------------------------------------
- // =========================================================================================================
- function getMainMenu(x, y) {
- x = this.left;
- y = this.top;
- var a = {}, b = {}, c = ["file", "edit", "View", "playback", "library", "help"];
- a[0] = window.CreatePopupMenu();
- for (var i = 1; i < 7; i++) a[i] = fb.CreateMainMenuManager();
- a[7] = fb.CreateContextMenuManager();
- for (var j = 0; j < 7; j++) b[j] = window.CreatePopupMenu();
- for (var k = 0; k < 6; k++) b[k].AppendTo(a[0], 16, capitalize(c[k]));
- for (var l = 1; l < 7; l++) a[l].Init(c[l - 1]);
- for (var m = 1; m < 7; m++) a[m].BuildMenu(b[m - 1], m * 1000);
- if (fb.IsPlaying) {
- a[7].InitNowPlaying();
- a[7].BuildMenu(b[6], 7000);
- a[0].AppendMenuSeparator();
- b[6].AppendTo(a[0], 16, "Now Playing");
- }
- var idx = a[0].TrackPopupMenu(x, y);
- switch (true) {
- case idx == 0:
- break;
- case (idx >= 1000 && idx < 8000):
- var d = Math.floor(idx / 1000);
- a[d].ExecuteByID(idx - d * 1000);
- break;
- }
- for (var n = 0; n < 8; n++) a[n].Dispose();
- }
- // =========================================================================================================
- // ----- Panel: Control Left -------------------------------------------------------------------------------
- // =========================================================================================================
- var presetCount = 5;
- var b_btns = [];
- btn_panel = 1;
- var a_name = ["", "", "CONSOLE", "", "", "TIME"];
- var a_func = [function(){fb.Exit()}, getMainMenu, function(){fb.ShowConsole()}, function(){fb.RunMainMenuCommand("View/Show Status pane")}, function(){fb.RunMainMenuCommand("View/Show Status bar")}, function(){window.SetProperty("Remain Time", t_r ? false : true); TimeOpt()}];
- var b_name = ["Button 01", "Button 02", "Button 03", "Button 04", "Button 05", "Button 06", "Button 07", "Button 08"];
- for (var j_ = 0; j_ < 8; j_++) b_btns.push(getButtonProperties(b_name[j_]));
- // ----- CREATE BUTTONS -----
- buttonsOptions();
- buttonsColours();
- function buttonsRefresh() {
- var qx = [0, rbx, 0, bxf * 3, bxf * 5, rbx];
- for (var i = 0; i < 6; i++) Buttons["a_" + i] = new TextButton(a_name[i], a_func[i], padX + qx[i], i > 1 ? by1 : padY, bbw, bbh, i > 1 ? btn1Siz : btn2Siz, i > 1 ? btn1Opt : btn2Opt, btnsCol);
- for (var j = 0; j < 8; j++) if (b_btns[j].Exists) Buttons["b_" + j] = new TextButton(b_btns[j].Text.toUpperCase(), OptBtnCmd, padX + bxf * (j < 5 ? (j * 2 + 3) : (j * 2 - 3)), j < 5 ? padY : by1, bbw, bbh, btn1Siz, btn1Opt, btnsCol, "", b_btns[j]);
- }
- // ----- CREATE BUTTON MENU -----
- function getButtonMenu(x, y) {
- var a = {}
- for (var i = 0; i < 4; i++) a[i] = window.CreatePopupMenu();
- var idx;
- for (var j = 0; j < 8; j++) a[1].AppendMenuItem(b_btns[j].Exists ? 8 : 0, j + 101, b_btns[j].Text ? b_btns[j].Text : b_name[j]);
- a[1].AppendMenuSeparator();
- a[1].AppendMenuItem(0, 109, "Edit buttons");
- a[1].AppendMenuItem(0, 110, "Configure...");
- for (var k = 1; k >= 1 && k <= presetCount; k++) a[2].AppendMenuItem(0, k + 200, "Preset " + k);
- a[2].CheckMenuRadioItem(201, 200 + presetCount, appPreset + 200);
- var tmp_arr = ["Flat", "Soft", "Medium", "Strong"];
- for (var l = 0; l < 4; l++) a[3].AppendMenuItem(0, l + 301, tmp_arr[l]);
- a[3].CheckMenuRadioItem(301, 304, depthPreset + 301);
- a[1].AppendTo(a[0], 0 | 16, "Optional buttons");
- a[0].AppendMenuSeparator();
- a[2].AppendTo(a[0], 0 | 16, "Button style");
- a[3].AppendTo(a[0], 0 | 16, "Button depth");
- idx = a[0].TrackPopupMenu(x, y);
- switch (true) {
- case (idx >= 101 && idx <= 108):
- window.SetProperty(b_name[idx - 101], b_btns[idx - 101].Exists ? false : true);
- if (b_btns[idx - 101].Exists) {
- window.Reload();
- return true;
- } else {
- try {
- var ob_cmd = utils.InputBox(window.ID, "Enter your main menu, context menu or JScript command here:", "Button command", "", true);
- var ob_name = utils.InputBox(window.ID, "Enter the name for the button here\n(up to 10 letters):", "Button name", "");
- window.SetProperty(b_name[idx - 101] + " command string", ob_cmd);
- ob_name && window.SetProperty(b_name[idx - 101] + " name (up to 10 letters)", ob_name);
- window.Reload();
- return true;
- } catch (e) {
- window.SetProperty(b_name[idx - 101], false);
- }
- }
- break;
- case idx == 109:
- window.ShowProperties();
- break;
- case idx == 110:
- window.ShowConfigure();
- break;
- case (idx >= 201 && idx <= 200 + presetCount):
- window.SetProperty("Buttons appearance preset", idx - 200);
- appPreset = window.GetProperty("Buttons appearance preset");
- window.NotifyOthers("ButtonPreset", appPreset);
- buttonsOptions();
- buttonsSizes();
- buttonsRefresh();
- window.Repaint();
- break;
- case (idx >= 301 && idx <= 304):
- window.SetProperty("Buttons depth preset", idx - 301);
- depthPreset = window.GetProperty("Buttons depth preset");
- window.NotifyOthers("DepthPreset", depthPreset);
- buttonsOptions();
- buttonsRefresh();
- window.Repaint();
- break;
- }
- for (var m = 0; m < 4; m++) a[m].Dispose();
- }
- // ----- CREATE TIMESWITCH OPTION -----
- function TimeOpt() {
- t_r = window.GetProperty("Remain Time", false);
- window.NotifyOthers("remTime", t_r);
- }
- TimeOpt();
- // ----- DRAW -----
- function on_paint(gr) {
- !window.IsTransparent && gr.FillSolidRect(0, 0, ww, wh, p_backcol);
- gr.SetInterpolationMode(7);
- gr.SetSmoothingMode(4);
- g_signs && gr.DrawImage(g_signs, padX, padY, bbw, bbh, 1206, 396, 150, 72);
- g_signs && gr.DrawImage(g_signs, (ww - area / 8) - padX, padY, bbw, bbh, 1674, 396, 150, 72);
- gr.GdiDrawText("PANE --- STATUS --- BAR", gdi.Font(btn1Opt.font_name, btn1Siz.font_size), btnsCol.text_normal, padX + bxf * 3, by1, bbw * 2, Math.ceil(bbh / 3 * 2), 1);
- buttonsDraw(gr);
- }
- // ----- MOUSE ACTIONS -----
- function on_mouse_move(x, y) {
- buttonsMouseMove(x, y);
- }
- function on_mouse_lbtn_down(x, y) {
- buttonsMouseLbtnDown(x, y);
- }
- function on_mouse_lbtn_up(x, y) {
- buttonsMouseLbtnUp(x, y);
- }
- function on_mouse_rbtn_up(x, y) {
- getButtonMenu(x, y);
- return true;
- }
- function on_mouse_leave() {
- buttonsMouseLeave();
- }
- // ----- EVENTS -----
- function on_size() {
- ww = window.Width;
- wh = window.Height;
- buttonsSizes();
- buttonsRefresh();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement