Skip to content

Commit

Permalink
Optimization for Slice missing in doxywizard Wizard-Mode page
Browse files Browse the repository at this point in the history
The  Optimization for Slice was missing in the doxywizard "Wizard-Mode" page.
  • Loading branch information
albert-github committed Oct 8, 2020
1 parent 7859a9a commit 7ca670e
Showing 1 changed file with 54 additions and 33 deletions.
87 changes: 54 additions & 33 deletions addon/doxywizard/wizard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
* Copyright (C) 1997-2019 by Dimitri van Heesch.
*
* Permission to use, copy, modify, and distribute this software and its
* documentation under the terms of the GNU General Public License is hereby
* granted. No representations are made about the suitability of this software
* documentation under the terms of the GNU General Public License is hereby
* granted. No representations are made about the suitability of this software
* for any purpose. It is provided "as is" without express or implied warranty.
* See the GNU General Public License for more details.
*
Expand Down Expand Up @@ -47,6 +47,7 @@
#define STR_OPTIMIZE_OUTPUT_JAVA QString::fromLatin1("OPTIMIZE_OUTPUT_JAVA")
#define STR_OPTIMIZE_FOR_FORTRAN QString::fromLatin1("OPTIMIZE_FOR_FORTRAN")
#define STR_OPTIMIZE_OUTPUT_VHDL QString::fromLatin1("OPTIMIZE_OUTPUT_VHDL")
#define STR_OPTIMIZE_OUTPUT_SLICE QString::fromLatin1("OPTIMIZE_OUTPUT_SLICE")
#define STR_CPP_CLI_SUPPORT QString::fromLatin1("CPP_CLI_SUPPORT")
#define STR_HIDE_SCOPE_NAMES QString::fromLatin1("HIDE_SCOPE_NAMES")
#define STR_EXTRACT_ALL QString::fromLatin1("EXTRACT_ALL")
Expand Down Expand Up @@ -74,31 +75,34 @@
#define STR_HTML_COLORSTYLE_SAT QString::fromLatin1("HTML_COLORSTYLE_SAT")
#define STR_HTML_COLORSTYLE_GAMMA QString::fromLatin1("HTML_COLORSTYLE_GAMMA")

static bool g_optimizeMapping[6][6] =
static bool g_optimizeMapping[7][7] =
{
// A: OPTIMIZE_OUTPUT_FOR_C
// B: OPTIMIZE_OUTPUT_JAVA
// C: OPTIMIZE_FOR_FORTRAN
// D: OPTIMIZE_OUTPUT_VHDL
// E: CPP_CLI_SUPPORT
// F: HIDE_SCOPE_NAMES
// A B C D E F
{ false,false,false,false,false,false }, // 0: C++
{ false,false,false,false,true, false }, // 1: C++/CLI
{ false,true, false,false,false,false }, // 2: C#/Java
{ true, false,false,false,false,true }, // 3: C/PHP
{ false,false,true, false,false,false }, // 4: Fortran
{ false,false,false,true, false,false }, // 5: VHDL
// G: OPTIMIZE_OUTPUT_SLICE
// A B C D E F G
{ false,false,false,false,false,false,false }, // 0: C++
{ false,false,false,false,true, false,false }, // 1: C++/CLI
{ false,true, false,false,false,false,false }, // 2: C#/Java
{ true, false,false,false,false,true, false }, // 3: C/PHP
{ false,false,true, false,false,false,false }, // 4: Fortran
{ false,false,false,true, false,false,false }, // 5: VHDL
{ false,false,false,false,false,false,true }, // 6: SLICE
};

static QString g_optimizeOptionNames[6] =
static QString g_optimizeOptionNames[7] =
{
STR_OPTIMIZE_OUTPUT_FOR_C,
STR_OPTIMIZE_OUTPUT_JAVA,
STR_OPTIMIZE_FOR_FORTRAN,
STR_OPTIMIZE_OUTPUT_VHDL,
STR_CPP_CLI_SUPPORT,
STR_HIDE_SCOPE_NAMES
STR_HIDE_SCOPE_NAMES,
STR_OPTIMIZE_OUTPUT_SLICE
};

//==========================================================================
Expand All @@ -107,23 +111,23 @@ static bool stringVariantToBool(const QVariant &v)
{
QString s = v.toString().toLower();
return s==QString::fromLatin1("yes") || s==QString::fromLatin1("true") || s==QString::fromLatin1("1");
}
}

static bool getBoolOption(
const QHash<QString,Input*>&model,const QString &name)
{
Input *option = model[name];
Q_ASSERT(option!=0);
return stringVariantToBool(option->value());
}
}

static int getIntOption(
const QHash<QString,Input*>&model,const QString &name)
{
Input *option = model[name];
Q_ASSERT(option!=0);
return option->value().toInt();
}
}

static QString getStringOption(
const QHash<QString,Input*>&model,const QString &name)
Expand Down Expand Up @@ -343,19 +347,19 @@ void ColorPicker::paintEvent(QPaintEvent*)
QRect r(0, foff, w, height() - 2*foff);
int wi = r.width() - 2;
int hi = r.height() - 2;
if (!m_pix || m_pix->height() != hi || m_pix->width() != wi)
if (!m_pix || m_pix->height() != hi || m_pix->width() != wi)
{
delete m_pix;
QImage img(wi, hi, QImage::Format_RGB32);
int y;
uint *pixel = (uint *) img.scanLine(0);
for (y = 0; y < hi; y++)
for (y = 0; y < hi; y++)
{
const uint *end = pixel + wi;
int yh = y2hue(y+coff);
int ys = y2sat(y+coff);
int yg = y2gam(y+coff);
while (pixel < end)
while (pixel < end)
{
QColor c;
c.setHsv(yh, ys, (int)(255*pow(0.7,yg/100.0)));
Expand All @@ -372,7 +376,7 @@ void ColorPicker::paintEvent(QPaintEvent*)
p.setPen(g.windowText().color());
p.setBrush(g.windowText());
QPolygon a;
int y = m_mode==Hue ? hue2y(m_hue) :
int y = m_mode==Hue ? hue2y(m_hue) :
m_mode==Saturation ? sat2y(m_sat) :
gam2y(m_gam);
a.setPoints(3, w, y, w+5, y+5, w+5, y-5);
Expand All @@ -382,14 +386,14 @@ void ColorPicker::paintEvent(QPaintEvent*)

void ColorPicker::mouseMoveEvent(QMouseEvent *m)
{
if (m_mode==Hue) setHue(y2hue(m->y()));
if (m_mode==Hue) setHue(y2hue(m->y()));
else if (m_mode==Saturation) setSat(y2sat(m->y()));
else setGam(y2gam(m->y()));
}

void ColorPicker::mousePressEvent(QMouseEvent *m)
{
if (m_mode==Hue) setHue(y2hue(m->y()));
if (m_mode==Hue) setHue(y2hue(m->y()));
else if (m_mode==Saturation) setSat(y2sat(m->y()));
else setGam(y2gam(m->y()));
}
Expand Down Expand Up @@ -530,7 +534,7 @@ Step1::Step1(Wizard *wizard,const QHash<QString,Input*> &modelData) : m_wizard(w
QFrame *f = new QFrame( this );
f->setFrameStyle( QFrame::HLine | QFrame::Sunken );
layout->addWidget(f);

l = new QLabel(this);
l->setText(tr("Specify the directory to scan for source code"));
layout->addWidget(l);
Expand Down Expand Up @@ -602,7 +606,7 @@ void Step1::selectProjectIcon()
else
{
QFile Fout(iconName);
if(!Fout.exists())
if(!Fout.exists())
{
m_projIconLab->setText(tr("Sorry, cannot find file(")+iconName+QString::fromLatin1(");"));
}
Expand Down Expand Up @@ -711,7 +715,7 @@ void Step1::init()
if (!iconName.isEmpty())
{
QFile Fout(iconName);
if(!Fout.exists())
if(!Fout.exists())
{
m_projIconLab->setText(tr("Sorry, cannot find file(")+iconName+QString::fromLatin1(");"));
}
Expand Down Expand Up @@ -745,7 +749,7 @@ void Step1::init()

//==========================================================================

Step2::Step2(Wizard *wizard,const QHash<QString,Input*> &modelData)
Step2::Step2(Wizard *wizard,const QHash<QString,Input*> &modelData)
: m_wizard(wizard), m_modelData(modelData)
{
QRadioButton *r;
Expand All @@ -770,7 +774,7 @@ Step2::Step2(Wizard *wizard,const QHash<QString,Input*> &modelData)
// m_crossRef -> SOURCE_BROWSER = YES/NO
gbox->addWidget(m_crossRef,3,0);
layout->addWidget(m_extractMode);

//---------------------------------------------------
QFrame *f = new QFrame( this );
f->setFrameStyle( QFrame::HLine | QFrame::Sunken );
Expand All @@ -779,8 +783,8 @@ Step2::Step2(Wizard *wizard,const QHash<QString,Input*> &modelData)
m_optimizeLangGroup = new QButtonGroup(this);
m_optimizeLang = new QGroupBox(this);
m_optimizeLang->setTitle(tr("Select programming language to optimize the results for"));
gbox = new QGridLayout( m_optimizeLang );
gbox = new QGridLayout( m_optimizeLang );

r = new QRadioButton(m_optimizeLang);
r->setText(tr("Optimize for C++ output"));
r->setChecked(true);
Expand All @@ -791,6 +795,7 @@ Step2::Step2(Wizard *wizard,const QHash<QString,Input*> &modelData)
// OPTIMIZE_OUTPUT_VHDL = NO
// CPP_CLI_SUPPORT = NO
// HIDE_SCOPE_NAMES = NO
// OPTIMIZE_OUTPUT_SLICE = NO
gbox->addWidget(r,0,0);
r = new QRadioButton(tr("Optimize for C++/CLI output"));
gbox->addWidget(r,1,0);
Expand All @@ -801,6 +806,7 @@ Step2::Step2(Wizard *wizard,const QHash<QString,Input*> &modelData)
// OPTIMIZE_OUTPUT_VHDL = NO
// CPP_CLI_SUPPORT = YES
// HIDE_SCOPE_NAMES = NO
// OPTIMIZE_OUTPUT_SLICE = NO
r = new QRadioButton(tr("Optimize for Java or C# output"));
m_optimizeLangGroup->addButton(r, 2);
// 2 -> OPTIMIZE_OUTPUT_FOR_C = NO
Expand All @@ -809,6 +815,7 @@ Step2::Step2(Wizard *wizard,const QHash<QString,Input*> &modelData)
// OPTIMIZE_OUTPUT_VHDL = NO
// CPP_CLI_SUPPORT = NO
// HIDE_SCOPE_NAMES = NO
// OPTIMIZE_OUTPUT_SLICE = NO
gbox->addWidget(r,2,0);
r = new QRadioButton(tr("Optimize for C or PHP output"));
m_optimizeLangGroup->addButton(r, 3);
Expand All @@ -818,6 +825,7 @@ Step2::Step2(Wizard *wizard,const QHash<QString,Input*> &modelData)
// OPTIMIZE_OUTPUT_VHDL = NO
// CPP_CLI_SUPPORT = NO
// HIDE_SCOPE_NAMES = YES
// OPTIMIZE_OUTPUT_SLICE = NO
gbox->addWidget(r,3,0);
r = new QRadioButton(tr("Optimize for Fortran output"));
m_optimizeLangGroup->addButton(r, 4);
Expand All @@ -827,6 +835,7 @@ Step2::Step2(Wizard *wizard,const QHash<QString,Input*> &modelData)
// OPTIMIZE_OUTPUT_VHDL = NO
// CPP_CLI_SUPPORT = NO
// HIDE_SCOPE_NAMES = NO
// OPTIMIZE_OUTPUT_SLICE = NO
gbox->addWidget(r,4,0);
r = new QRadioButton(tr("Optimize for VHDL output"));
m_optimizeLangGroup->addButton(r, 5);
Expand All @@ -836,7 +845,18 @@ Step2::Step2(Wizard *wizard,const QHash<QString,Input*> &modelData)
// OPTIMIZE_OUTPUT_VHDL = YES
// CPP_CLI_SUPPORT = NO
// HIDE_SCOPE_NAMES = NO
// OPTIMIZE_OUTPUT_SLICE = NO
gbox->addWidget(r,5,0);
r = new QRadioButton(tr("Optimize for SLICE output"));
m_optimizeLangGroup->addButton(r, 6);
// 5 -> OPTIMIZE_OUTPUT_FOR_C = NO
// OPTIMIZE_OUTPUT_JAVA = NO
// OPTIMIZE_FOR_FORTRAN = NO
// OPTIMIZE_OUTPUT_VHDL = NO
// CPP_CLI_SUPPORT = NO
// HIDE_SCOPE_NAMES = NO
// OPTIMIZE_OUTPUT_SLICE = YES
gbox->addWidget(r,6,0);

layout->addWidget(m_optimizeLang);
layout->addStretch(1);
Expand All @@ -852,7 +872,7 @@ Step2::Step2(Wizard *wizard,const QHash<QString,Input*> &modelData)

void Step2::optimizeFor(int choice)
{
for (int i=0;i<6;i++)
for (int i=0;i<7;i++)
{
updateBoolOption(m_modelData,
g_optimizeOptionNames[i],
Expand Down Expand Up @@ -882,12 +902,13 @@ void Step2::init()
else if (getBoolOption(m_modelData,STR_OPTIMIZE_OUTPUT_FOR_C)) x=3;
else if (getBoolOption(m_modelData,STR_OPTIMIZE_FOR_FORTRAN)) x=4;
else if (getBoolOption(m_modelData,STR_OPTIMIZE_OUTPUT_VHDL)) x=5;
else if (getBoolOption(m_modelData,STR_OPTIMIZE_OUTPUT_SLICE)) x=6;
m_optimizeLangGroup->button(x)->setChecked(true);
}

//==========================================================================

Step3::Step3(Wizard *wizard,const QHash<QString,Input*> &modelData)
Step3::Step3(Wizard *wizard,const QHash<QString,Input*> &modelData)
: m_wizard(wizard), m_modelData(modelData)
{
QVBoxLayout *vbox = 0;
Expand Down Expand Up @@ -1093,7 +1114,7 @@ void Step3::init()

//==========================================================================

Step4::Step4(Wizard *wizard,const QHash<QString,Input*> &modelData)
Step4::Step4(Wizard *wizard,const QHash<QString,Input*> &modelData)
: m_wizard(wizard), m_modelData(modelData)
{
m_diagramModeGroup = new QButtonGroup(this);
Expand Down Expand Up @@ -1250,7 +1271,7 @@ void Step4::init()

//==========================================================================

Wizard::Wizard(const QHash<QString,Input*> &modelData, QWidget *parent) :
Wizard::Wizard(const QHash<QString,Input*> &modelData, QWidget *parent) :
QSplitter(parent), m_modelData(modelData)
{
m_treeWidget = new QTreeWidget;
Expand Down Expand Up @@ -1303,7 +1324,7 @@ void Wizard::activateTopic(QTreeWidgetItem *item,QTreeWidgetItem *)
{
if (item)
{

QString label = item->text(0);
if (label==tr("Project"))
{
Expand Down

0 comments on commit 7ca670e

Please sign in to comment.