
function WizOnOutlineButtonClicked() {
    var pluginPath = objApp.GetPluginPathByScriptFileName("WizOutline.js");
    var bookmarksListHtmlFileName = pluginPath + "Outline.htm";
    //
	var objDatabase = objApp.PersonalDatabase;
	var showInNoteWindow = objDatabase.GetMeta("Outline", "ShowInNoteWindow");
	if("1" === showInNoteWindow){
		objWindow.ShowOutlineInNoteWindow(false, true);
	}
	else{	
		var rect = objWindow.GetToolButtonRect("document", "OutlineButton");
		var arr = rect.split(',');
		objWindow.ShowSelectorWindow(bookmarksListHtmlFileName, (parseInt(arr[0]) + parseInt(arr[2])) / 2, arr[3], 300, 500, "");
	}
}
function WizInitOutlineButton() {
    var pluginPath = objApp.GetPluginPathByScriptFileName("WizOutline.js");
    var languangeFileName = pluginPath + "plugin.ini";
    var buttonText = objApp.LoadStringFromFile(languangeFileName, "strOutline");
	var iconFileName = pluginPath + "outline.ico";
	if(objApp.ExecuteCommand("IsNightModeOn", null, null)){
		iconFileName = pluginPath + "outline-night.ico";
	}
    objWindow.AddToolButton("document", "OutlineButton", buttonText, iconFileName, "WizOnOutlineButtonClicked");
}

WizInitOutlineButton();
