diff --git a/qt/main.cpp b/qt/main.cpp index e03c777..e4a0b90 100644 --- a/qt/main.cpp +++ b/qt/main.cpp @@ -10,6 +10,7 @@ int main(int argc, char *argv[]) // QCoreApplication::setOrganizationName("Zoltán Kovács"); // QCoreApplication::setOrganizationDomain("kovzol.github.io"); QApplication app(argc, argv); + app.setStyle("fusion"); QString language = QLocale::system().name(); // language = "hu_HU"; diff --git a/qt/statementwindow.cpp b/qt/statementwindow.cpp index f50c998..dd4a26a 100644 --- a/qt/statementwindow.cpp +++ b/qt/statementwindow.cpp @@ -116,6 +116,9 @@ void StatementWindow::parse() details += QString::fromStdString(l); details += "\n"; } + if (l.find("diagram: graphviz: end")!=string::npos) { + dmode = false; + } if (dmode) { graphviz_input += l + "\n"; } @@ -123,16 +126,14 @@ void StatementWindow::parse() dmode = true; diagram_defined = true; } - if (l.find("diagram: graphviz: end")!=string::npos) { - dmode = false; - } } QMessageBox msgBox; msgBox.setWindowTitle(tr("Parse")); msgBox.setText(tr("%1 successful tests, %2 warnings, %3 errors.").arg(infos).arg(warnings).arg(errors)); QPushButton* visualizeButton; - QPushButton* backButton = msgBox.addButton(tr("Back to Editor"), QMessageBox::RejectRole); + QPushButton* visualizeXButton; + QPushButton* backButton = msgBox.addButton(tr("Back to &Editor"), QMessageBox::RejectRole); if (!diagram_defined) { msgBox.setIcon(QMessageBox::Critical); } else { @@ -141,8 +142,10 @@ void StatementWindow::parse() } else { msgBox.setIcon(QMessageBox::Information); } - if (diagram_defined) - visualizeButton = msgBox.addButton(tr("Visualize"), QMessageBox::ActionRole); + if (diagram_defined) { + visualizeButton = msgBox.addButton(tr("&Visualize"), QMessageBox::ActionRole); + visualizeXButton = msgBox.addButton(tr("E&xport"), QMessageBox::ActionRole); + } } msgBox.setDetailedText(details); @@ -156,6 +159,12 @@ void StatementWindow::parse() if (msgBox.clickedButton() == visualizeButton) { showSvg(); } + if (msgBox.clickedButton() == visualizeXButton) { + QString link = "https://dreampuf.github.io/GraphvizOnline/?engine=dot#"; + link += graphviz_input; + QDesktopServices::openUrl(QUrl(link)); + } + #endif } @@ -188,6 +197,6 @@ void StatementWindow::setupHelpMenu() helpMenu->addAction(QIcon::fromTheme("system-help"), tr("&Blog entry"), this, [this]() { - QString link = "https://matek.hu/zoltan/blog-20240805.php"; + QString link = "https://matek.hu/zoltan/blog-20250102.php"; QDesktopServices::openUrl(QUrl(link)); }); } diff --git a/statements/pbrst.y b/statements/pbrst.y index 4b6563c..e3787bc 100644 --- a/statements/pbrst.y +++ b/statements/pbrst.y @@ -905,8 +905,8 @@ void create_diagram() { if (no_evidence) return; strcpy(D, ""); strcat(D, "digraph {\n"); - // strcat(D, " nodesep=0.2;\n"); // a lower number can shorten the edges - strcat(D, " node [shape=rectangle,color=blue,style=filled,height=\"0.6pt\",fontsize=35];\n"); + strcat(D, " nodesep=0.1;\n"); // a lower number can shorten the edges + strcat(D, " node [shape=rectangle,color=blue,style=filled,height=0.4,width=0.4,fontsize=14];\n"); #define MAX_BLOCKS 100 int nt_blocks[MAX_BLOCKS][2]; // copies from the coverings, positions and length are stored int nt_blocks_n = 0; @@ -962,8 +962,7 @@ void create_diagram() { strcat(D, intbuffer); strcat(D, " {\n"); strcat(D, " style=filled; color=transparent; fillcolor=\"#ffff80:white\";\n"); - strcat(D, " edge [arrowhead=none; minlen=0];\n"); - strcat(D, " fontname=\"times-bold\";\n"); + strcat(D, " edge [arrowhead=none, minlen=0];\n"); strcat(D, " otlabel"); strcat(D, intbuffer); // re-use OT headline number to make this node unique strcat(D, " [label=\""); @@ -978,7 +977,7 @@ void create_diagram() { strcat(D, ot_verses[ob]); if (v != NULL) v[0] = ' '; // ...then put back! - strcat(D, "\"; shape=rectangle; fillcolor=transparent; color=transparent];\n"); + strcat(D, "\",color=transparent];\n"); int uid=0; // this is a dummy unique number for unused blocks for (int i=0; iEPS) { // non-verbatim match - strcat(refs, " headlabel=\""); - sprintf(intbuffer, "%d", ((int)(intervals_data[j-1]*100))); + strcat(refs, " [arrowhead=vee,"); + if (intervals_data[j-1]>EPS && !pd_printed[j-1]) { // non-verbatim match; percentual data is printed only once + strcat(refs, "headlabel=\""); + sprintf(intbuffer, "%d", ((int)(round(intervals_data[j-1]*100)))); strcat(refs, intbuffer); // constraint=false: do not count this edge when computing the positions of the edges: - strcat(refs, "%\", fontcolor=red, labeldistance=1,"); + strcat(refs, "%\",fontcolor=red,labeldistance=3,fontsize=12,"); + pd_printed[j-1]=true; } - strcat(refs, " constraint=false, color=green];\n"); + strcat(refs, "constraint=false,color=green];\n"); nodetype = FRAGMENT; } else { // it's an introduction @@ -1159,7 +1161,7 @@ void create_diagram() { strcat(D, " ntlabel->otlabel"); sprintf(intbuffer, "%d", i+1); strcat(D, intbuffer); - strcat(D, " [style=invisible, arrowhead=none];\n"); + strcat(D, " [style=invisible,arrowhead=none];\n"); for (int j=i+1; jotlabel"); sprintf(intbuffer, "%d", i+1); strcat(D, intbuffer); - strcat(D, " [style=invisible, arrowhead=none];\n"); + strcat(D, " [style=invisible,arrowhead=none];\n"); } } diff --git a/statements/statements.brst b/statements/statements.brst index c3ddab1..5aa58dd 120000 --- a/statements/statements.brst +++ b/statements/statements.brst @@ -1 +1 @@ -/home/kovzol/workspace/bibref/docs/common/statements.brst \ No newline at end of file +C:/home/kovzol/workspace/bibref/docs/common/statements.brst \ No newline at end of file