QFEHelpEditorWidget::QFEHelpEditorWidget(QWidget* parent) : QWidget(parent), ui(new Ui::QFEHelpEditorWidget) { modified=false; newScript=true; ui->setupUi(this); ui->edtScript->getEditor()->setWordWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere); ui->edtScript->getEditor()->setLineWrapMode(QTextEdit::WidgetWidth); connect(ui->edtScript->getEditor()->document(), SIGNAL(contentsChanged()), this, SLOT(documentWasModified())); highlighter=new QFHTMLHighlighter("", ui->edtScript->getEditor()->document()); highlighter->setUseSpecial2("$(", ")$"); highlighter->setUseSpecial1("$$", "$$"); completer = new QCompleter(ui->edtScript->getEditor()); completermodel=modelFromFile(ProgramOptions::getInstance()->getAssetsDirectory()+"/qtscript/completer.txt"); completer->setModel(completermodel); completer->setModelSorting(QCompleter::CaseInsensitivelySortedModel); completer->setCaseSensitivity(Qt::CaseInsensitive); completer->setWrapAround(false); ui->edtScript->getEditor()->setCompleter(completer); recentHelpFiles=new QRecentFilesMenu(this); recentHelpFiles->setUseSystemFileIcons(false); recentHelpFiles->setAlwaysEnabled(true); connect(recentHelpFiles, SIGNAL(openRecentFile(QString)), this, SLOT(openScriptNoAsk(QString))); ui->btnOpen->setMenu(recentHelpFiles); connect(ui->edtScript->getEditor(), SIGNAL(cursorPositionChanged()), this, SLOT(edtScript_cursorPositionChanged())); actLoadAutosave=new QFActionWithNoMenuRole(tr("load last autosaved file ..."), this); connect(actLoadAutosave, SIGNAL(triggered()), this, SLOT(reloadLastAutosave())); cutAct = new QFActionWithNoMenuRole(QIcon(":/qfe_helpeditor/script_cut.png"), tr("Cu&t"), this); cutAct->setShortcut(tr("Ctrl+X")); cutAct->setToolTip(tr("Cut the current selection's contents to the " "clipboard")); connect(cutAct, SIGNAL(triggered()), ui->edtScript->getEditor(), SLOT(cut())); copyAct = new QFActionWithNoMenuRole(QIcon(":/qfe_helpeditor/script_copy.png"), tr("&Copy"), this); copyAct->setShortcut(tr("Ctrl+C")); copyAct->setToolTip(tr("Copy the current selection's contents to the " "clipboard")); connect(copyAct, SIGNAL(triggered()), ui->edtScript->getEditor(), SLOT(copy())); pasteAct = new QFActionWithNoMenuRole(QIcon(":/qfe_helpeditor/script_paste.png"), tr("&Paste"), this); pasteAct->setShortcut(tr("Ctrl+V")); pasteAct->setToolTip(tr("Paste the clipboard's contents into the current " "selection")); connect(pasteAct, SIGNAL(triggered()), ui->edtScript->getEditor(), SLOT(paste())); undoAct = new QFActionWithNoMenuRole(QIcon(":/qfe_helpeditor/script_undo.png"), tr("&Undo"), this); undoAct->setShortcut(tr("Ctrl+Z")); undoAct->setToolTip(tr("Undo the last change ")); connect(undoAct, SIGNAL(triggered()), ui->edtScript->getEditor(), SLOT(undo())); redoAct = new QFActionWithNoMenuRole(QIcon(":/qfe_helpeditor/script_redo.png"), tr("&Redo"), this); redoAct->setShortcut(tr("Ctrl+Shift+Z")); redoAct->setToolTip(tr("Redo the last undone change ")); connect(redoAct, SIGNAL(triggered()), ui->edtScript->getEditor(), SLOT(redo())); findAct = new QFActionWithNoMenuRole(QIcon(":/qfe_helpeditor/script_find.png"), tr("&Find ..."), this); findAct->setShortcut(tr("Ctrl+F")); findAct->setToolTip(tr("Find a string in sequence ")); connect(findAct, SIGNAL(triggered()), this, SLOT(findFirst())); findNextAct = new QFActionWithNoMenuRole(QIcon(":/qfe_helpeditor/script_find_next.png"), tr("Find &next"), this); findNextAct->setShortcut(tr("F3")); findNextAct->setToolTip(tr("Find the next occurence ")); connect(findNextAct, SIGNAL(triggered()), this, SLOT(findNext())); findNextAct->setEnabled(false); replaceAct = new QFActionWithNoMenuRole(QIcon(":/qfe_helpeditor/script_find_replace.png"), tr("Find && &replace ..."), this); replaceAct->setShortcut(tr("Ctrl+R")); replaceAct->setToolTip(tr("Find a string in sequence and replace it with another string ")); connect(replaceAct, SIGNAL(triggered()), this, SLOT(replaceFirst())); commentAct = new QFActionWithNoMenuRole(tr("&Comment text"), this); commentAct->setShortcut(tr("Ctrl+B")); commentAct->setToolTip(tr("add (single line) comment at the beginning of each line ")); connect(commentAct, SIGNAL(triggered()), ui->edtScript->getEditor(), SLOT(comment())); unCommentAct = new QFActionWithNoMenuRole(tr("&Uncomment text"), this); unCommentAct->setShortcut(tr("Ctrl+Shift+B")); unCommentAct->setToolTip(tr("remove (single line) comment at the beginning of each line ")); connect(unCommentAct, SIGNAL(triggered()), ui->edtScript->getEditor(), SLOT(uncomment())); indentAct = new QFActionWithNoMenuRole(QIcon(":/qfe_helpeditor/script_indent.png"), tr("&Increase indention"), this); commentAct->setShortcut(tr("Ctrl+I")); indentAct->setToolTip(tr("increase indention ")); connect(indentAct, SIGNAL(triggered()), ui->edtScript->getEditor(), SLOT(indentInc())); unindentAct = new QFActionWithNoMenuRole(QIcon(":/qfe_helpeditor/script_unindent.png"), tr("&Decrease indention"), this); unindentAct->setShortcut(tr("Ctrl+Shift+I")); unindentAct->setToolTip(tr("decrease indention ")); connect(unindentAct, SIGNAL(triggered()), ui->edtScript->getEditor(), SLOT(indentDec())); gotoLineAct = new QFActionWithNoMenuRole(tr("&Goto line ..."), this); gotoLineAct->setShortcut(tr("Alt+G")); gotoLineAct->setToolTip(tr("goto a line in the opened file ")); connect(gotoLineAct, SIGNAL(triggered()), this, SLOT(gotoLine())); printAct = new QFActionWithNoMenuRole(QIcon(":/qfe_helpeditor/script_print.png"), tr("&Print ..."), this); printAct->setToolTip(tr("print the current SDFF file ")); connect(printAct, SIGNAL(triggered()), this, SLOT(print())); actInsertIcon = new QFActionWithNoMenuRole(QIcon(":/qfe_helpeditor/insert_image.png"), tr("&Insert icon ..."), this); actInsertIcon->setToolTip(tr("print the current SDFF file ")); connect(actInsertIcon, SIGNAL(triggered()), this, SLOT(insertIcon())); toEntityAct = new QFActionWithNoMenuRole(QIcon(":/qfe_helpeditor/toentity.png"), tr("&Convert characters to entities ..."), this); toEntityAct->setToolTip(tr("convert characters in the selected text to HTML entities")); connect(toEntityAct, SIGNAL(triggered()), this, SLOT(toEntity())); toCharAct = new QFActionWithNoMenuRole(QIcon(":/qfe_helpeditor/tochars.png"), tr("&Convert entities to characters ..."), this); toCharAct->setToolTip(tr("convert HTML entities in the selected text to characters")); connect(toCharAct, SIGNAL(triggered()), this, SLOT(toChars())); cutAct->setEnabled(false); copyAct->setEnabled(false); undoAct->setEnabled(false); redoAct->setEnabled(false); connect(ui->edtScript->getEditor(), SIGNAL(copyAvailable(bool)), cutAct, SLOT(setEnabled(bool))); connect(ui->edtScript->getEditor(), SIGNAL(copyAvailable(bool)), copyAct, SLOT(setEnabled(bool))); connect(ui->edtScript->getEditor(), SIGNAL(undoAvailable(bool)), undoAct, SLOT(setEnabled(bool))); connect(ui->edtScript->getEditor(), SIGNAL(redoAvailable(bool)), redoAct, SLOT(setEnabled(bool))); connect(ui->edtScript->getEditor(), SIGNAL(findNextAvailable(bool)), findNextAct, SLOT(setEnabled(bool))); QMenu* menuMore=new QMenu(ui->tbMoreOptions); menuMore->addAction(indentAct); menuMore->addAction(unindentAct); menuMore->addAction(commentAct); menuMore->addAction(unCommentAct); menuMore->addSeparator(); menuMore->addAction(toEntityAct); menuMore->addAction(toCharAct); menuMore->addSeparator(); menuMore->addAction(actInsertIcon); menuMore->addSeparator(); menuMore->addAction(gotoLineAct); menuMore->addAction(findAct); menuMore->addAction(replaceAct); menuMore->addAction(findNextAct); menuMore->addSeparator(); menuMore->addAction(actLoadAutosave); ui->tbMoreOptions->setMenu(menuMore); ui->tbFind->setDefaultAction(findAct); ui->tbFindNext->setDefaultAction(findNextAct); ui->tbReplace->setDefaultAction(replaceAct); ui->tbPrint->setDefaultAction(printAct); ui->tbCopy->setDefaultAction(copyAct); ui->tbCut->setDefaultAction(cutAct); ui->tbPaste->setDefaultAction(pasteAct); ui->tbRedo->setDefaultAction(redoAct); ui->tbUndo->setDefaultAction(undoAct); ui->tbEntity->setDefaultAction(toEntityAct); ui->tbChars->setDefaultAction(toCharAct); setScriptFilename(""); QMenu* menu; menu=new QMenu(tr("directories"), this); ui->edtScript->getEditor()->addAction(menu->menuAction()); addInsertAction(menu, "$$mainhelpdir$$"); addInsertAction(menu, "$$mainhelppicdir$$"); addInsertAction(menu, "$$assetsdir$$"); addInsertAction(menu, "$$examplesdir$$"); addInsertAction(menu, "$$configdir$$"); addInsertAction(menu, "$$maindir$$"); addInsertAction(menu, "$$sourcedir$$"); menu=new QMenu(tr("version/copyright info"), this); ui->edtScript->getEditor()->addAction(menu->menuAction()); addInsertAction(menu, "$$version.svnrevision$$"); addInsertAction(menu, "$$version.status$$"); addInsertAction(menu, "$$version.date$$"); addInsertAction(menu, "$$version$$"); addInsertAction(menu, "$$version_full$$"); menu->addSeparator(); addInsertAction(menu, "$$thanksto$$"); addInsertAction(menu, "$$copyright$$"); addInsertAction(menu, "$$author$$"); addInsertAction(menu, "$$weblink$$"); addInsertAction(menu, "$$license$$"); addInsertAction(menu, "$$maillist$$"); addInsertAction(menu, "$$maillistrequest$$"); menu->addSeparator(); addInsertAction(menu, "$$qfcitation$$"); addInsertAction(menu, "$$qfcitation_bibtex$$"); addInsertAction(menu, "$$jankrieger_phdthesis$$"); addInsertAction(menu, "$$jankrieger_phdthesis_ref$$"); menu=new QMenu(tr("general help links"), this); ui->edtScript->getEditor()->addAction(menu->menuAction()); addInsertAction(menu, tr("Link: RDR general help"), "<a href=\"$qf_ui_rdr_helpfile$$\">$$qf_ui_rdr_helpfiletitle$$</a>" ); addInsertAction(menu, tr("Link: Evaluation general help"), "<a href=\"$$qf_ui_eval_helpfile$$\">$$qf_ui_eval_helpfiletitle$$</a>" ); addInsertAction(menu, tr("Link: Plotter Widget general help"), "<a href=\"$$qf_ui_jkqtplotter_helpfile$$\">$$qf_ui_jkqtplotter_helpfiletitle$$</a>" ); addInsertAction(menu, tr("Link: LaTeX parser general help"), "<a href=\"$$qf_ui_latex_helpfile$$\">$$qf_ui_latex_helpfiletitle$$</a>" ); addInsertAction(menu, tr("Link: Expression parser help"), "<a href=\"$$qf_mathparser_helpfile$$\">$$qf_mathparser_helpfiletitle$$</a>" ); //addInsertAction(menu, tr("Link: help"), "<a href=\"$$aa$$\">$$aa$$</a>" ); //addInsertAction(menu, tr("Link: help"), QString("<a href=\"$$mainhelpdir$$aa\">aa</a>") ); addInsertAction(menu, tr("Link: Custom color palettes help"), QString("<a href=\"$$mainhelpdir$$colorpalettes.html\">custom color paletes</a>") ); addInsertAction(menu, tr("Link: Available color palettes"), QString("<a href=\"$$mainhelpdir$$installedcolorpalettes.html\">available color paletes</a>") ); addInsertAction(menu, tr("Link: Regular Expressions"), QString("<a href=\"$$mainhelpdir$$qf3_qtregexp.html\">regular expressions</a>") ); addInsertAction(menu, tr("Link: Fit Functions"), QString("<a href=\"$$mainhelpdir$$qf3_fitfunc.html\">fit functions</a>") ); addInsertAction(menu, tr("Link: Fit Algorithms"), QString("<a href=\"$$mainhelpdir$$qf3_fitalg.html\">fit algorithms</a>") ); addInsertAction(menu, tr("Link: File Formats"), QString("<a href=\"$$mainhelpdir$$qf3_fileformats.html\">file formats</a>") ); addInsertAction(menu, tr("Link: GPL 3.0"), QString("<a href=\"$$mainhelpdir$$gpl3_0.html\">GPL 3.0</a>") ); addInsertAction(menu, tr("Link: FAQs"), QString("<a href=\"$$qf_faqfile$$\">Frequently asked questions</a>") ); menu->addSeparator(); addInsertAction(menu, "$$qf_ui_rdr_helpfile$$"); addInsertAction(menu, "$$qf_ui_rdr_helpfiletitle$$"); addInsertAction(menu, "$$qf_ui_eval_helpfile$$"); addInsertAction(menu, "$$qf_ui_eval_helpfiletitle$$"); addInsertAction(menu, "$$qf_ui_jkqtplotter_helpfile$$"); addInsertAction(menu, "$$qf_ui_jkqtplotter_helpfiletitle$$"); addInsertAction(menu, "$$qf_ui_latex_helpfile$$"); addInsertAction(menu, "$$qf_ui_latex_helpfiletitle$$"); addInsertAction(menu, "$$qf_mathparser_helpfile$$"); addInsertAction(menu, "$$qf_mathparser_helpfiletitle$$"); addInsertAction(menu, "$$qf_faqfile$$"); menu=new QMenu(tr("page header/footer"), this); ui->edtScript->getEditor()->addAction(menu->menuAction()); addInsertAction(menu, "$$qf_commondoc_backtop$$"); menu->addSeparator(); addInsertAction(menu, "$$qf_commondoc_footer.start$$"); addInsertAction(menu, "$$qf_commondoc_footer.end$$"); menu->addSeparator(); addInsertAction(menu, "$$qf_commondoc_header.start$$"); addInsertAction(menu, "$$qf_commondoc_header.end$$"); addInsertAction(menu, "$$qf_commondoc_header.end_notitle$$"); addInsertAction(menu, "$$qf_commondoc_header.rdr$$"); addInsertAction(menu, "$$qf_commondoc_header.eval$$"); addInsertAction(menu, "$$qf_commondoc_header.extension$$"); addInsertAction(menu, "$$qf_commondoc_header.fitfunc$$"); addInsertAction(menu, "$$qf_commondoc_header.fitalg$$"); addInsertAction(menu, "$$qf_commondoc_header.separator$$"); menu=new QMenu(tr("plugin info"), this); ui->edtScript->getEditor()->addAction(menu->menuAction()); addInsertAction(menu, "$$local_plugin_icon$$"); addInsertAction(menu, "$$local_plugin_iconfilename$$"); addInsertAction(menu, "$$local_plugin_name$$"); addInsertAction(menu, "$$local_plugin_author$$"); addInsertAction(menu, "$$local_plugin_copyright$$"); addInsertAction(menu, "$$local_plugin_weblink_url$$"); addInsertAction(menu, "$$local_plugin_weblink$$"); addInsertAction(menu, "$$local_plugin_id$$"); addInsertAction(menu, "$$local_plugin_subid$$"); addInsertAction(menu, "$$local_plugin_subname$$"); addInsertAction(menu, "$$local_plugin_subshortname$$"); addInsertAction(menu, "$$local_plugin_tutorial_file$$"); addInsertAction(menu, "$$local_plugin_tutorial_link$$"); addInsertAction(menu, "$$local_plugin_mainhelp_file$$"); addInsertAction(menu, "$$local_plugin_mainhelp_link$$"); addInsertAction(menu, "$$local_plugin_version$$"); addInsertAction(menu, "$$local_plugin_typehelp_link$$"); addInsertAction(menu, "$$local_plugin_typehelp_file$$"); addInsertAction(menu, "$$local_plugin_assets$$"); addInsertAction(menu, "$$local_plugin_examples$$"); addInsertAction(menu, "$$local_plugin_help$$"); addInsertAction(menu, "$$local_plugin_config$$"); addInsertAction(menu, "$$local_plugin_tutorials$$"); menu->addSeparator(); addInsertAction(menu, "$$plugin_info:help:PLUGINID$$"); addInsertAction(menu, "$$plugin_info:tutorial:PLUGINID$$"); addInsertAction(menu, "$$plugin_info:helpdir:PLUGINID$$"); addInsertAction(menu, "$$plugin_info:assetsdir:PLUGINID$$"); addInsertAction(menu, "$$plugin_info:examplesdir:PLUGINID$$"); addInsertAction(menu, "$$plugin_info:configdir:PLUGINID$$"); menu->addSeparator(); addInsertAction(menu, "$$fitfunction:help:PLUGINID$$"); addInsertAction(menu, "$$fitfunction:name:PLUGINID$$"); addInsertAction(menu, "$$fitfunction:short_name:PLUGINID$$"); menu->addSeparator(); addInsertAction(menu, "$$fitalgorithm:help:PLUGINID$$"); addInsertAction(menu, "$$fitalgorithm:name:PLUGINID$$"); addInsertAction(menu, "$$fitalgorithm:short_name:PLUGINID$$"); menu->addSeparator(); addInsertAction(menu, "$$importer:help:PLUGINID$$"); addInsertAction(menu, "$$importer:name:PLUGINID$$"); addInsertAction(menu, "$$exporter:help:PLUGINID$$"); addInsertAction(menu, "$$exporter:name:PLUGINID$$"); menu=new QMenu(tr("plugin lists"), this); ui->edtScript->getEditor()->addAction(menu->menuAction()); addInsertAction(menu, "$$list:extension:INTERFACENAME$$"); addInsertAction(menu, "$$list:fitfunc:$$"); addInsertAction(menu, "$$list:fitfunc:STARTSWITH$$"); addInsertAction(menu, "$$list:fitfunc_inplugin:PLUGIN_ID|STARTSWITH$$"); addInsertAction(menu, "$$list:fitfunc_inplugin:PLUGIN_ID$$"); addInsertAction(menu, "$$list:fitalg:$$"); addInsertAction(menu, "$$list:fitalg:STARTSWITH$$"); addInsertAction(menu, "$$list:importers:STARTSWITH$$"); addInsertAction(menu, "$$list:exporters:STARTSWITH$$"); addInsertAction(menu, "$$list:plugin_tutorials:PLUGIN_ID$$"); menu=new QMenu(tr("help lists"), this); ui->edtScript->getEditor()->addAction(menu->menuAction()); addInsertAction(menu, "$$tutorials_contents$$"); addInsertAction(menu, "$$help_contents$$"); addInsertAction(menu, "$$settings_contents$$"); menu=new QMenu(tr("insert files"), this); ui->edtScript->getEditor()->addAction(menu->menuAction()); addInsertAction(menu, "$$insert:FILENAME$$"); addInsertAction(menu, "$$insertglobal:FILENAME$$"); menu=new QMenu(tr("insert Equations (LaTeX)"), this); ui->edtScript->getEditor()->addAction(menu->menuAction()); addInsertAction(menu, "$$math:LATEX$$"); addInsertAction(menu, "$(LATEX)$"); addInsertAction(menu, "$$bmath:LATEX$$"); addInsertAction(menu, "$[LATEX]$"); menu=new QMenu(tr("insert Literature References"), this); ui->edtScript->getEditor()->addAction(menu->menuAction()); addInsertAction(menu, "$$ref:<ID>:Text$$"); addInsertAction(menu, "$$ref:<ID>:$$"); addInsertAction(menu, "$$invisibleref:<ID>:Text$$"); addInsertAction(menu, "$$references$$"); menu=new QMenu(tr("insert Figures"), this); ui->edtScript->getEditor()->addAction(menu->menuAction()); addInsertAction(menu, "$$fig:FILENAME:CAPTION$$"); menu=new QMenu(tr("insert Info boxes"), this); ui->edtScript->getEditor()->addAction(menu->menuAction()); addInsertAction(menu, "$$see:Text$$"); addInsertAction(menu, "$$note:Text$$"); addInsertAction(menu, "$$info:Text$$"); addInsertAction(menu, "$$warning:Text$$"); addInsertAction(menu, "$$example:Text$$"); addInsertAction(menu, "$$codeexample:Text$$"); addInsertAction(menu, "$$bqtt:Text$$"); addInsertAction(menu, "$$bqcode:Text$$"); menu->addSeparator(); addInsertAction(menu, "$$startbox$$"); addInsertAction(menu, "$$startbox_info$$"); addInsertAction(menu, "$$startbox_note$$"); addInsertAction(menu, "$$startbox_see$$"); addInsertAction(menu, "$$startbox_warning$$"); addInsertAction(menu, "$$startbox_example$$"); addInsertAction(menu, "$$startbox:backgroundcolor:bordercolor$$"); addInsertAction(menu, "$$startbox:lightgrey:midnightblue$$"); addInsertAction(menu, "$$endbox$$"); menu=new QMenu(tr("insert Tooltips"), this); ui->edtScript->getEditor()->addAction(menu->menuAction()); addInsertAction(menu, "$$tooltip:PHRASE$$"); menu=new QMenu(tr("FAQs"), this); ui->edtScript->getEditor()->addAction(menu->menuAction()); addInsertAction(menu, tr("FAQ entry"), "$$faq_start$$\n <a name=\"FAQ1\"><b>Question?</b>\n$$faq_answer$$\n Answer ...\n$$faq_end$$"); menu->addSeparator(); addInsertAction(menu, "$$faq_start"); addInsertAction(menu, "$$faq_answer"); addInsertAction(menu, "$$faq_end"); menu=new QMenu(tr("Function References"), this); ui->edtScript->getEditor()->addAction(menu->menuAction()); addInsertAction(menu, tr("Function reference entry"), "$$funcref_start$$<a name=\"NAME\"/><!-- func:NAME -->\n <b><tt><!-- template -->NAME<!-- /template --></tt> - <i> DESCRIPTION </i>:</b>\n$$funcref_description$$\n DESCRIPTION\n <!-- /func:NAME -->\n$$funcref_end$$"); menu->addSeparator(); addInsertAction(menu, "$$funcref_start"); addInsertAction(menu, "$$funcref_description"); addInsertAction(menu, "$$funcref_end"); menu=new QMenu(tr("insert other markups"), this); ui->edtScript->getEditor()->addAction(menu->menuAction()); addInsertAction(menu, "$$tt:Text$$"); menu=new QMenu(tr("LaTeX"), this); ui->edtScript->getEditor()->addAction(menu->menuAction()); addInsertAction(menu, "\\left(%1#\\right)"); addInsertAction(menu, "\\left[%1#\\right]"); addInsertAction(menu, "\\left\\{%1#\\right\\}"); addInsertAction(menu, "\\left\\langle%1#\\right\\rangle"); menu->addSeparator(); addInsertAction(menu, "\\sqrt{%1#}"); menu->addSeparator(); addInsertAction(menu, "\\sum_{#}^{}%1"); addInsertAction(menu, "\\prod_{#}^{}%1"); addInsertAction(menu, "\\int_{#}^{}%1\\;\\mathrm{d}x"); addInsertAction(menu, "\\iint_{#}^{}%1\\;\\mathrm{d}^2x"); addInsertAction(menu, "\\iiint_{#}^{}%1\\;\\mathrm{d}^3x"); addInsertAction(menu, "\\oint_{#}^{}%1\\;\\mathrm{d}x"); addInsertAction(menu, "\\lim_{%1#}"); addInsertAction(menu, "\\argmin_{%1#}"); addInsertAction(menu, "\\argmax_{%1#}"); menu->addSeparator(); addInsertAction(menu, "\\vec{%1#}"); addInsertAction(menu, "\\hat{%1#}"); addInsertAction(menu, "\\tilde{%1#}"); addInsertAction(menu, "\\mathbf{%1#}"); addInsertAction(menu, "\\mathrm{%1#}"); addInsertAction(menu, "\\mathit{%1#}"); addInsertAction(menu, "\\mathsf{%1#}"); addInsertAction(menu, "\\mathbb{%1#}"); addInsertAction(menu, "\\mathscript{%1#}"); addInsertAction(menu, "\\underline{%1#}"); //addInsertAction(menu, "$$$$"); menu=new QMenu(tr("Special Characters"), this); ui->edtScript->getEditor()->addAction(menu->menuAction()); addInsertAction(menu, "$" "$"); addInsertAction(menu, "$$" "$$"); QTimer::singleShot(AUTOSAVE_INTERVAL_MSEC, this, SLOT(autosave())); }
// // FUNCTION: gui_SetTrayIcon( PA_PluginParameters params ) // // PURPOSE: Put an icon in system tray // // COMMENTS: Flags and action determine what happens: Add, modify, delete, tool tip etc // Not available for pre-6.7 4D // IMPORTANT NOTE: This and sys_GetPrintJob use the same subclassed window procedure. // You cannot arbitrarily delete the function newProc // without breaking sys_GetPrintJob. // // DATE: dcc 08/04/01 // void gui_SetTrayIcon( PA_PluginParameters params ) { UINT iconHndl = 0; NOTIFYICONDATA nid; PNOTIFYICONDATA pnid; LONG_PTR returnValue = 0, iconID = 0, flags = 0, action = 0; char szTipParam[60], szBalloonInfo[255], szBalloonTitle[60]; char *pBalloonIconFlag; LONG_PTR arraySize = 0, procNbr = 0, storedProcNbr = 0, nbrParams = 0; LONG_PTR index; LONG_PTR errCode = 0; BOOL bFuncReturn = FALSE; BOOL shellOK = FALSE; //HWND hWnd; LONG_PTR count = -10; activeCalls.bTrayIcons = TRUE; pnid = &nid; count = count % 5; if ((sIsPriorTo67)) { // does not work with 6.5 plugin PA_ReturnLong( params, -1 ); return; } //hWnd = (HWND)PA_GetHWND(PA_GetWindowFocused()); // 3/2/04 Unnecessary nbrParams = getTrayIconParams(params, &action, &flags, &iconID, &procNbr, &iconHndl, szTipParam, szBalloonInfo, szBalloonTitle); index = findIconID( &startPtr, iconID, &storedProcNbr ); if (index == 0) { // not found if (isEmpty(startPtr)) { //processHandles.wpFourDOrigProc = (WNDPROC) SetWindowLong(windowHandles.fourDhWnd, GWL_WNDPROC, (LONG) newProc); // MJG 3/26/04 Replaced code above with function call. subclass4DWindowProcess(); } //add element to array bFuncReturn = insertIcon( &startPtr, iconID, procNbr); } else { if ((action == NIM_MODIFY) & (storedProcNbr != procNbr)) { // process nbr changed and modify request has been explicitly made bFuncReturn = updateIconIdProcNbr( &startPtr, iconID, procNbr ); } } //end if (index == 0) // must have version 5 of shell 32 for balloon feature // NOTIFYICONDATA structure is larger for balloon feature // also must be W2K for balloons if(GetDllVersion(TEXT("shell32.dll")) >= PACKVERSION(5,00)) { shellOK = TRUE; } if (shellOK) { if ((action >= 0) & (flags >= 0x010)) { nid.dwInfoFlags = 0; strcpy(nid.szInfo, szBalloonInfo); switch (szBalloonTitle[0]) // leading 1, 2, 0r 3 causes addition of icon { case '1' : pBalloonIconFlag = &szBalloonTitle[1]; if (*pBalloonIconFlag != '\0') { strcpy(nid.szInfoTitle, pBalloonIconFlag); nid.dwInfoFlags = NIIF_INFO; } break; case '2' : pBalloonIconFlag = &szBalloonTitle[1]; if (*pBalloonIconFlag != '\0') { strcpy(nid.szInfoTitle, pBalloonIconFlag); nid.dwInfoFlags = NIIF_WARNING; } break; case '3' : pBalloonIconFlag = &szBalloonTitle[1]; if (*pBalloonIconFlag != '\0') { strcpy(nid.szInfoTitle, pBalloonIconFlag); nid.dwInfoFlags = NIIF_ERROR; } break; default : strcpy(nid.szInfoTitle, szBalloonTitle); } nid.uTimeout = 10; if (flags & NIF_HIDE) { flags = flags & 0x001F; flags = flags | NIF_STATE; nid.dwState = NIS_HIDDEN; nid.dwStateMask = NIS_HIDDEN; } else { if (flags & NIF_SHOW) { flags = flags & 0x001F; flags = flags | NIF_STATE; nid.dwState = 0; nid.dwStateMask = NIS_HIDDEN; } } } } else { flags = (flags & 0xF); // must not send balloon flag when version not Win2K or above } nid.cbSize = sizeof(NOTIFYICONDATA); nid.hWnd = windowHandles.fourDhWnd; nid.uID = iconID; strcpy(nid.szTip, szTipParam); // can use this if balloon feature not available or not wanted nid.uVersion = 0; // REB 3/3/09 #16207 nid.uFlags = flags; // REB 2/18/10 #22656 switch (action) { case NIM_ADD : case NIM_MODIFY : case NIM_SETFOCUS : case NIM_SETVERSION : nid.uFlags = flags; nid.hIcon = (HICON)iconHndl; if (flags & NIF_MESSAGE) { nid.uCallbackMessage = WM_USER + 0x0021; // hex 21 is purely arbitrary } else { nid.uCallbackMessage = WM_NULL; } break; case NIM_DELETE : //if (index != 0) { // MJG 3/2/04 The element will still exist even if index is zero. returnValue = deleteIcon(&startPtr, iconID); //} } //bFuncReturn = Shell_NotifyIcon(NIM_SETVERSION, pnid); // REB 3/3/09 #16207 Force Win95 icon handling. bFuncReturn = Shell_NotifyIcon(action, pnid); //errCode = GetLastError(); //PA_ReturnLong( params, errCode ); PA_ReturnLong( params, (LONG_PTR)bFuncReturn ); }