Commit dc8266d5 authored by Christoffer Ackelman's avatar Christoffer Ackelman

QT: Ge: Fixed DropDown boxes in toolbar.

parent ba96fda8
...@@ -227,14 +227,11 @@ QAction* addCheckableToolItem(QObject* parent, QToolBar* tools, ...@@ -227,14 +227,11 @@ QAction* addCheckableToolItem(QObject* parent, QToolBar* tools,
return action; return action;
} }
QMenu* addToolMenu(QWidget* parent, QToolBar* tools, const char* text) QComboBox* addToolMenu(QWidget* parent, QToolBar* tools, const char* callback)
{ {
QToolButton* button = new QToolButton(parent); QComboBox* menu = new QComboBox(parent);
button->setText(translate_utf8(text)); QObject::connect(menu, SIGNAL(activated(int)), parent, callback);
button->setPopupMode(QToolButton::InstantPopup); tools->addWidget(menu);
QMenu* menu = new QMenu(button);
button->setMenu(menu);
tools->addWidget(button);
return menu; return menu;
} }
......
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
#define QT_HELPERS_H #define QT_HELPERS_H
#include <QAction> #include <QAction>
#include <QComboBox>
#include <QLabel> #include <QLabel>
#include <QSplitter> #include <QSplitter>
#include <QStatusBar> #include <QStatusBar>
...@@ -89,7 +90,7 @@ QAction* addToolItem(QObject* parent, QToolBar* tools, const char* text, ...@@ -89,7 +90,7 @@ QAction* addToolItem(QObject* parent, QToolBar* tools, const char* text,
const char* callback, const char* iconName); const char* callback, const char* iconName);
QAction* addCheckableToolItem(QObject* parent, QToolBar* tools, QAction* addCheckableToolItem(QObject* parent, QToolBar* tools,
const char* text, const char* callback, const char* iconName); const char* text, const char* callback, const char* iconName);
QMenu* addToolMenu(QWidget* parent, QToolBar* tools, const char* text); QComboBox* addToolMenu(QWidget* parent, QToolBar* tools, const char* callback);
QWidget* layout_to_widget(QLayout* layout); QWidget* layout_to_widget(QLayout* layout);
void set_pane_position(QSplitter* pane, int right); void set_pane_position(QSplitter* pane, int right);
QFrame* separator(QFrame::Shape shape); QFrame* separator(QFrame::Shape shape);
......
...@@ -63,12 +63,64 @@ ...@@ -63,12 +63,64 @@
#include "wb_wnav_selformat.h" #include "wb_wnav_selformat.h"
#include <QApplication> #include <QApplication>
#include <QFontDatabase>
#include <QHBoxLayout> #include <QHBoxLayout>
#include <QInputDialog> #include <QInputDialog>
#include <QMenuBar> #include <QMenuBar>
#include <QMessageBox> #include <QMessageBox>
#include <QPainter>
#include <QPushButton> #include <QPushButton>
// For some reason the QFontComboBox in QT is broken and do not support fonts
// such as "Helvetica" despite QFont supporting them.
// So we implement our own QFontComboBox using a standard QComboBox,
// and let this QFontDelegate class do the rendering.
// This QFontDelegate is more or less a copy of the one in QFontComboBox.
class QFontDelegate : public QAbstractItemDelegate
{
public:
explicit QFontDelegate(QObject *parent) : QAbstractItemDelegate(parent) {}
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const;
};
void QFontDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const {
QString text = index.data(Qt::DisplayRole).toString();
QFont font(text);
QRect r = option.rect;
if (option.state & QStyle::State_Selected) {
painter->save();
painter->setBrush(option.palette.highlight());
painter->setPen(Qt::NoPen);
painter->drawRect(option.rect);
painter->setPen(QPen(option.palette.highlightedText(), 0));
}
if (option.direction == Qt::RightToLeft)
r.setRight(r.right() - 4);
else
r.setLeft(r.left() + 4);
QFont old = painter->font();
painter->setFont(font);
painter->drawText(r, Qt::AlignVCenter|Qt::AlignLeading|Qt::TextSingleLine, text);
painter->setFont(old);
if (option.state & QStyle::State_Selected)
painter->restore();
}
QSize QFontDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
{
QString text = index.data(Qt::DisplayRole).toString();
QFont font(option.font);
QFontMetrics fontMetrics(font);
return QSize(fontMetrics.width(text), 22);
}
int GeQt::create_modal_dialog(const char* title, const char* text, int GeQt::create_modal_dialog(const char* title, const char* text,
const char* button1, const char* button2, const char* button3, const char* button1, const char* button2, const char* button3,
const char* image) const char* image)
...@@ -893,10 +945,17 @@ void GeQtWidget::activate_decr_shift() ...@@ -893,10 +945,17 @@ void GeQtWidget::activate_decr_shift()
ge->activate_decr_shift(); ge->activate_decr_shift();
} }
void GeQtWidget::activate_gradient(int idx)
{
int data = ((QComboBox*)sender())->itemData(idx).toInt();
ge->activate_gradient(static_cast<glow_eGradient>(data));
}
void GeQtWidget::activate_gradient() void GeQtWidget::activate_gradient()
{ {
QAction* a = ((QAction*)sender()); int data = ((QAction*)sender())->data().toInt();
ge->activate_gradient(static_cast<glow_eGradient>(a->data().toInt())); ge->tools_gradient->setCurrentIndex(ge->tools_gradient->findData(data));
ge->activate_gradient(static_cast<glow_eGradient>(data));
} }
void GeQtWidget::activate_reset_mode() void GeQtWidget::activate_reset_mode()
...@@ -924,36 +983,36 @@ void GeQtWidget::activate_grid(bool set) ...@@ -924,36 +983,36 @@ void GeQtWidget::activate_grid(bool set)
ge->activate_grid(set); ge->activate_grid(set);
} }
void GeQtWidget::activate_linewidth() void GeQtWidget::activate_linewidth(int idx)
{ {
QAction* a = ((QAction*)sender()); int data = ((QComboBox*)sender())->itemData(idx).toInt();
ge->activate_linewidth(a->data().toInt()); ge->activate_linewidth(data);
} }
void GeQtWidget::activate_linetype() void GeQtWidget::activate_linetype(int idx)
{ {
QAction* a = ((QAction*)sender()); int data = ((QComboBox*)sender())->itemData(idx).toInt();
ge->graph->set_linetype(static_cast<glow_eLineType>(a->data().toInt())); ge->graph->set_linetype(static_cast<glow_eLineType>(data));
ge->graph->set_select_linetype( ge->graph->set_select_linetype(static_cast<glow_eLineType>(data));
static_cast<glow_eLineType>(a->data().toInt()));
} }
void GeQtWidget::activate_gridsize() void GeQtWidget::activate_gridsize(int idx)
{ {
QAction* a = ((QAction*)sender()); double data = ((QComboBox*)sender())->itemData(idx).toDouble();
ge->activate_gridsize(a->data().toDouble()); ge->activate_gridsize(data);
} }
void GeQtWidget::activate_textsize() void GeQtWidget::activate_textsize(int idx)
{ {
QAction* a = ((QAction*)sender()); int data = ((QComboBox*)sender())->itemData(idx).toInt();
ge->activate_textsize(a->data().toInt()); ge->activate_textsize(data);
} }
void GeQtWidget::activate_textfont() void GeQtWidget::activate_textfont(int idx)
{ {
QAction* a = ((QAction*)sender()); int data = ((QComboBox*)sender())->itemData(idx).toInt();
ge->activate_textfont(static_cast<glow_eFont>(a->data().toInt())); ge->activate_textfont(static_cast<glow_eFont>(data));
ge->tools_textfont->setFont(QFont(ge->tools_textfont->itemText(idx)));
} }
void GeQtWidget::activate_textbold(bool set) void GeQtWidget::activate_textbold(bool set)
...@@ -1143,13 +1202,16 @@ void GeQtWidget::activate_help_subgraph() ...@@ -1143,13 +1202,16 @@ void GeQtWidget::activate_help_subgraph()
void GeQtWidget::valchanged_cmd_entry() void GeQtWidget::valchanged_cmd_entry()
{ {
if (ge->text_input_open) { if (ge->text_input_open) {
ge->graph->change_text(ge->current_text_object, qPrintableLatin1(ge->recall_entry->text())); ge->graph->change_text(
ge->current_text_object, qPrintableLatin1(ge->recall_entry->text()));
ge->text_input_open = 0; ge->text_input_open = 0;
} else if (ge->name_input_open) { } else if (ge->name_input_open) {
ge->graph->change_name(ge->current_text_object, qPrintableLatin1(ge->recall_entry->text())); ge->graph->change_name(
ge->current_text_object, qPrintableLatin1(ge->recall_entry->text()));
ge->name_input_open = 0; ge->name_input_open = 0;
} else if (ge->value_input_open) { } else if (ge->value_input_open) {
ge->graph->change_value(ge->current_value_object, qPrintableLatin1(ge->recall_entry->text())); ge->graph->change_value(
ge->current_value_object, qPrintableLatin1(ge->recall_entry->text()));
ge->value_input_open = 0; ge->value_input_open = 0;
} else if (ge->objectnav_input_open) { } else if (ge->objectnav_input_open) {
ge->objectnav->set_attr_value(qPrintableLatin1(ge->recall_entry->text())); ge->objectnav->set_attr_value(qPrintableLatin1(ge->recall_entry->text()));
...@@ -1171,13 +1233,13 @@ void GeQt::update() ...@@ -1171,13 +1233,13 @@ void GeQt::update()
show_grid_w->setChecked(graph->get_show_grid() ? true : false); show_grid_w->setChecked(graph->get_show_grid() ? true : false);
if (fabs(graph->grid_size_x - 0.1) < DBL_EPSILON) { if (fabs(graph->grid_size_x - 0.1) < DBL_EPSILON) {
grid_sizes[3]->setChecked(true); tools_gridsize->setCurrentIndex(3);
} else if (fabs(graph->grid_size_x - 0.2) < DBL_EPSILON) { } else if (fabs(graph->grid_size_x - 0.2) < DBL_EPSILON) {
grid_sizes[2]->setChecked(true); tools_gridsize->setCurrentIndex(2);
} else if (fabs(graph->grid_size_x - 0.5) < DBL_EPSILON) { } else if (fabs(graph->grid_size_x - 0.5) < DBL_EPSILON) {
grid_sizes[1]->setChecked(true); tools_gridsize->setCurrentIndex(1);
} else { } else {
grid_sizes[0]->setChecked(true); tools_gridsize->setCurrentIndex(0);
} }
} }
...@@ -1662,69 +1724,51 @@ GeQt::GeQt(void* x_parent_ctx, QWidget* x_parent_widget, ...@@ -1662,69 +1724,51 @@ GeQt::GeQt(void* x_parent_ctx, QWidget* x_parent_widget,
toplevel, tools3, "Redo", SLOT(activate_redo()), "$pwr_exe/ge_redo.png"); toplevel, tools3, "Redo", SLOT(activate_redo()), "$pwr_exe/ge_redo.png");
// Line width option menu // Line width option menu
QMenu* tools_linewidth = addToolMenu(toplevel, tools3, "Line Width"); QComboBox* tools_linewidth
= addToolMenu(toplevel, tools3, SLOT(activate_linewidth(int)));
for (int i = 1; i <= 8; i++) { for (int i = 1; i <= 8; i++) {
std::ostringstream txt; std::ostringstream txt;
txt << "Linewidth " << i; txt << "Linewidth " << i;
std::ostringstream fname; std::ostringstream fname;
fname << "$pwr_exe/ge_linewidth_" << i << ".png"; fname << "$pwr_exe/ge_linewidth_" << i << ".png";
QAction* action = addMenuItem(toplevel, tools_linewidth, txt.str().c_str(), tools_linewidth->addItem(
SLOT(activate_linewidth()), "", fname.str().c_str()); get_icon(fname.str().c_str()), txt.str().c_str(), i);
action->setData(i);
} }
// Line type option menu // Line type option menu
QMenu* tools_linetype = addToolMenu(toplevel, tools3, "Line Type"); QComboBox* tools_linetype
= addToolMenu(toplevel, tools3, SLOT(activate_linetype(int)));
for (int i = 1; i <= 7; i++) { for (int i = 1; i <= 7; i++) {
std::ostringstream txt; std::ostringstream txt;
txt << "Linetype " << i; txt << "Linetype " << i;
std::ostringstream fname; std::ostringstream fname;
fname << "$pwr_exe/ge_linetype_" << i << ".png"; fname << "$pwr_exe/ge_linetype_" << i << ".png";
QAction* action = addMenuItem(toplevel, tools_linetype, txt.str().c_str(), tools_linetype->addItem(
SLOT(activate_linetype()), "", fname.str().c_str()); get_icon(fname.str().c_str()), txt.str().c_str(), i);
action->setData(i);
} }
// Text size options menu // Text size options menu
QMenu* tools_textsize = addToolMenu(toplevel, tools3, "Text Size"); QComboBox* tools_textsize
= addToolMenu(toplevel, tools3, SLOT(activate_textsize(int)));
int sizes[] = { 8, 10, 12, 14, 18, 24 }; int sizes[] = { 8, 10, 12, 14, 18, 24 };
for (int i = 0; i <= 5; i++) { for (int i = 0; i <= 5; i++) {
std::ostringstream txt; std::ostringstream txt;
txt << "Textsize " << sizes[i]; txt << "Textsize " << sizes[i];
std::ostringstream fname; std::ostringstream fname;
fname << "$pwr_exe/ge_textsize_" << sizes[i] << ".png"; fname << "$pwr_exe/ge_textsize_" << sizes[i] << ".png";
QAction* action = addMenuItem(toplevel, tools_textsize, txt.str().c_str(), tools_textsize->addItem(
SLOT(activate_textsize()), "", fname.str().c_str()); get_icon(fname.str().c_str()), txt.str().c_str(), i);
action->setData(i);
} }
// Text font options menu // Text font options menu
QMenu* tools_textfont = addToolMenu(toplevel, tools3, "Font"); tools_textfont = addToolMenu(toplevel, tools3, SLOT(activate_textfont(int)));
tools_textfont->setItemDelegate(new QFontDelegate(tools_textfont));
QAction* tools_textfont_1 = addMenuItem( tools_textfont->addItem("Helvetica", glow_eFont_Helvetica);
toplevel, tools_textfont, "Helvetica", SLOT(activate_textfont())); tools_textfont->addItem("Times", glow_eFont_Times);
tools_textfont_1->setFont(QFont(fl("Helvetica"))); tools_textfont->addItem("New Century Schoolbook", glow_eFont_NewCenturySchoolbook);
tools_textfont_1->setData(glow_eFont_Helvetica); tools_textfont->addItem("Courier", glow_eFont_Courier);
tools_textfont->addItem("Lucida Sans", glow_eFont_LucidaSans);
QAction* tools_textfont_2 = addMenuItem( tools_textfont->setFont(QFont("Courier"));
toplevel, tools_textfont, "Times", SLOT(activate_textfont()));
tools_textfont_2->setFont(QFont(fl("Times")));
tools_textfont_2->setData(glow_eFont_Times);
QAction* tools_textfont_3 = addMenuItem(toplevel, tools_textfont,
"New Century Schoolbook", SLOT(activate_textfont()));
tools_textfont_3->setFont(QFont(fl("New Century Schoolbook")));
tools_textfont_3->setData(glow_eFont_NewCenturySchoolbook);
QAction* tools_textfont_4 = addMenuItem(
toplevel, tools_textfont, "Courier", SLOT(activate_textfont()));
tools_textfont_4->setFont(QFont(fl("Courier")));
tools_textfont_4->setData(glow_eFont_Courier);
QAction* tools_textfont_5 = addMenuItem(
toplevel, tools_textfont, "Lucida Sans", SLOT(activate_textfont()));
tools_textfont_5->setFont(QFont(fl("Lucida Sans")));
tools_textfont_5->setData(glow_eFont_LucidaSans);
// Bold checkbutton // Bold checkbutton
addCheckableToolItem(toplevel, tools3, addCheckableToolItem(toplevel, tools3,
...@@ -1734,14 +1778,12 @@ GeQt::GeQt(void* x_parent_ctx, QWidget* x_parent_widget, ...@@ -1734,14 +1778,12 @@ GeQt::GeQt(void* x_parent_ctx, QWidget* x_parent_widget,
// Toolbar 2 (again) // Toolbar 2 (again)
// Grid size options menu // Grid size options menu
QMenu* tools_gridsize = addToolMenu(toplevel, tools2, "Grid Size"); tools_gridsize = addToolMenu(toplevel, tools2, SLOT(activate_gridsize(int)));
double sizes2[] = { 1.0, 0.5, 0.25, 0.1 }; double sizes2[] = { 1.0, 0.5, 0.25, 0.1 };
for (int i = 0; i < 4; i++) { for (int i = 0; i < 4; i++) {
std::ostringstream txt; std::ostringstream txt;
txt << "Gridsize " << sizes2[i]; txt << "Gridsize " << sizes2[i];
grid_sizes[i] = addMenuItem( tools_gridsize->addItem(txt.str().c_str(), sizes2[i]);
toplevel, tools_gridsize, txt.str().c_str(), SLOT(activate_gridsize()));
grid_sizes[i]->setData(sizes2[i]);
} }
// Show grid checkbutton // Show grid checkbutton
...@@ -1777,111 +1819,49 @@ GeQt::GeQt(void* x_parent_ctx, QWidget* x_parent_widget, ...@@ -1777,111 +1819,49 @@ GeQt::GeQt(void* x_parent_ctx, QWidget* x_parent_widget,
"$pwr_exe/ge_arrowright.png"); "$pwr_exe/ge_arrowright.png");
// Gradient option menu // Gradient option menu
QMenu* tools_gradient = addToolMenu(toplevel, tools2, "Gradient"); tools_gradient = addToolMenu(toplevel, tools2, SLOT(activate_gradient(int)));
QAction* tools_gradient_no tools_gradient->addItem(get_icon("$pwr_exe/ge_gradient_no.png"),
= addMenuItem(toplevel, tools_gradient, "Gradient No", "Gradient No", glow_eGradient_No);
SLOT(activate_gradient()), "", "$pwr_exe/ge_gradient_no.png"); tools_gradient->addItem(get_icon("$pwr_exe/ge_gradient_horizup.png"),
tools_gradient_no->setData(glow_eGradient_No); "Gradient HorizontalUp", glow_eGradient_HorizontalUp);
tools_gradient->addItem(get_icon("$pwr_exe/ge_gradient_horizdown.png"),
QAction* tools_gradient_horizup "Gradient HorizontalDown", glow_eGradient_HorizontalDown);
= addMenuItem(toplevel, tools_gradient, "Gradient HorizontalUp", tools_gradient->addItem(get_icon("$pwr_exe/ge_gradient_horiztube1.png"),
SLOT(activate_gradient()), "", "$pwr_exe/ge_gradient_horizup.png"); "Gradient HorizontalTube1", glow_eGradient_HorizontalTube1);
tools_gradient_horizup->setData(glow_eGradient_HorizontalUp); tools_gradient->addItem(get_icon("$pwr_exe/ge_gradient_horiztube2.png"),
"Gradient HorizontalTube2", glow_eGradient_HorizontalTube2);
QAction* tools_gradient_horizdown tools_gradient->addItem(get_icon("$pwr_exe/ge_gradient_vertleft.png"),
= addMenuItem(toplevel, tools_gradient, "Gradient HorizontalDown", "Gradient VerticalLeft", glow_eGradient_VerticalLeft);
SLOT(activate_gradient()), "", "$pwr_exe/ge_gradient_horizdown.png"); tools_gradient->addItem(get_icon("$pwr_exe/ge_gradient_vertright.png"),
tools_gradient_horizdown->setData(glow_eGradient_HorizontalDown); "Gradient VerticalRight", glow_eGradient_VerticalRight);
tools_gradient->addItem(get_icon("$pwr_exe/ge_gradient_verttube1.png"),
QAction* tools_gradient_horiztube1 "Gradient VerticalTube1", glow_eGradient_VerticalTube1);
= addMenuItem(toplevel, tools_gradient, "Gradient HorizontalTube1", tools_gradient->addItem(get_icon("$pwr_exe/ge_gradient_verttube2.png"),
SLOT(activate_gradient()), "", "$pwr_exe/ge_gradient_horiztube1.png"); "Gradient VerticalTube2", glow_eGradient_VerticalTube2);
tools_gradient_horiztube1->setData(glow_eGradient_HorizontalTube1); tools_gradient->addItem(get_icon("$pwr_exe/ge_gradient_diagupperleft.png"),
"Gradient DiagonalUpperLeft", glow_eGradient_DiagonalUpperLeft);
QAction* tools_gradient_horiztube2 tools_gradient->addItem(get_icon("$pwr_exe/ge_gradient_diaglowerleft.png"),
= addMenuItem(toplevel, tools_gradient, "Gradient HorizontalTube2", "Gradient DiagonalLowerLeft", glow_eGradient_DiagonalLowerLeft);
SLOT(activate_gradient()), "", "$pwr_exe/ge_gradient_horiztube2.png"); tools_gradient->addItem(get_icon("$pwr_exe/ge_gradient_diagupperright.png"),
tools_gradient_horiztube2->setData(glow_eGradient_HorizontalTube2); "Gradient DiagonalUpperRight", glow_eGradient_DiagonalUpperRight);
tools_gradient->addItem(get_icon("$pwr_exe/ge_gradient_diaglowerright.png"),
QAction* tools_gradient_vertleft "Gradient DiagonalLowerRight", glow_eGradient_DiagonalLowerRight);
= addMenuItem(toplevel, tools_gradient, "Gradient VerticalLeft", tools_gradient->addItem(get_icon("$pwr_exe/ge_gradient_diaguptube.png"),
SLOT(activate_gradient()), "", "$pwr_exe/ge_gradient_vertleft.png"); "Gradient DiagonalUpTube", glow_eGradient_DiagonalUpTube);
tools_gradient_vertleft->setData(glow_eGradient_VerticalLeft); tools_gradient->addItem(get_icon("$pwr_exe/ge_gradient_diagdowntube.png"),
"Gradient DiagonalDownTube", glow_eGradient_DiagonalDownTube);
QAction* tools_gradient_vertright tools_gradient->addItem(get_icon("$pwr_exe/ge_gradient_globe.png"),
= addMenuItem(toplevel, tools_gradient, "Gradient VerticalRight", "Gradient Globe", glow_eGradient_Globe);
SLOT(activate_gradient()), "", "$pwr_exe/ge_gradient_vertright.png"); tools_gradient->addItem(get_icon("$pwr_exe/ge_gradient_radcenter.png"),
tools_gradient_vertright->setData(glow_eGradient_VerticalRight); "Gradient RadialCenter", glow_eGradient_RadialCenter);
tools_gradient->addItem(get_icon("$pwr_exe/ge_gradient_radupperleft.png"),
QAction* tools_gradient_verttube1 "Gradient RadialUpperLeft", glow_eGradient_RadialUpperLeft);
= addMenuItem(toplevel, tools_gradient, "Gradient VerticalTube1", tools_gradient->addItem(get_icon("$pwr_exe/ge_gradient_radlowerleft.png"),
SLOT(activate_gradient()), "", "$pwr_exe/ge_gradient_verttube1.png"); "Gradient RadialLowerLeft", glow_eGradient_RadialLowerLeft);
tools_gradient_verttube1->setData(glow_eGradient_VerticalTube1); tools_gradient->addItem(get_icon("$pwr_exe/ge_gradient_radupperright.png"),
"Gradient RadialUpperRight", glow_eGradient_RadialUpperRight);
QAction* tools_gradient_verttube2 tools_gradient->addItem(get_icon("$pwr_exe/ge_gradient_radlowerright.png"),
= addMenuItem(toplevel, tools_gradient, "Gradient VerticalTube2", "Gradient RadialLowerRight", glow_eGradient_RadialLowerRight);
SLOT(activate_gradient()), "", "$pwr_exe/ge_gradient_verttube2.png");
tools_gradient_verttube2->setData(glow_eGradient_VerticalTube2);
QAction* tools_gradient_diagupperleft = addMenuItem(toplevel, tools_gradient,
"Gradient DiagonalUpperLeft", SLOT(activate_gradient()), "",
"$pwr_exe/ge_gradient_diagupperleft.png");
tools_gradient_diagupperleft->setData(glow_eGradient_DiagonalUpperLeft);
QAction* tools_gradient_diaglowerleft = addMenuItem(toplevel, tools_gradient,
"Gradient DiagonalLowerLeft", SLOT(activate_gradient()), "",
"$pwr_exe/ge_gradient_diaglowerleft.png");
tools_gradient_diaglowerleft->setData(glow_eGradient_DiagonalLowerLeft);
QAction* tools_gradient_diagupperright = addMenuItem(toplevel, tools_gradient,
"Gradient DiagonalUpperRight", SLOT(activate_gradient()), "",
"$pwr_exe/ge_gradient_diagupperright.png");
tools_gradient_diagupperright->setData(glow_eGradient_DiagonalUpperRight);
QAction* tools_gradient_diaglowerright = addMenuItem(toplevel, tools_gradient,
"Gradient DiagonalLowerRight", SLOT(activate_gradient()), "",
"$pwr_exe/ge_gradient_diaglowerright.png");
tools_gradient_diaglowerright->setData(glow_eGradient_DiagonalLowerRight);
QAction* tools_gradient_diaguptube
= addMenuItem(toplevel, tools_gradient, "Gradient DiagonalUpTube",
SLOT(activate_gradient()), "", "$pwr_exe/ge_gradient_diaguptube.png");
tools_gradient_diaguptube->setData(glow_eGradient_DiagonalUpTube);
QAction* tools_gradient_diagdowntube = addMenuItem(toplevel, tools_gradient,
"Gradient DiagonalDownTube", SLOT(activate_gradient()), "",
"$pwr_exe/ge_gradient_diagdowntube.png");
tools_gradient_diagdowntube->setData(glow_eGradient_DiagonalDownTube);
QAction* tools_gradient_globe
= addMenuItem(toplevel, tools_gradient, "Gradient Globe",
SLOT(activate_gradient()), "", "$pwr_exe/ge_gradient_globe.png");
tools_gradient_globe->setData(glow_eGradient_Globe);
QAction* tools_gradient_radcenter
= addMenuItem(toplevel, tools_gradient, "Gradient RadialCenter",
SLOT(activate_gradient()), "", "$pwr_exe/ge_gradient_radcenter.png");
tools_gradient_radcenter->setData(glow_eGradient_RadialCenter);
QAction* tools_gradient_radupperleft = addMenuItem(toplevel, tools_gradient,
"Gradient RadialUpperLeft", SLOT(activate_gradient()), "",
"$pwr_exe/ge_gradient_radupperleft.png");
tools_gradient_radupperleft->setData(glow_eGradient_RadialUpperLeft);
QAction* tools_gradient_radlowerleft = addMenuItem(toplevel, tools_gradient,
"Gradient RadialLowerLeft", SLOT(activate_gradient()), "",
"$pwr_exe/ge_gradient_radlowerleft.png");
tools_gradient_radlowerleft->setData(glow_eGradient_RadialLowerLeft);
QAction* tools_gradient_radupperright = addMenuItem(toplevel, tools_gradient,
"Gradient RadialUpperRight", SLOT(activate_gradient()), "",
"$pwr_exe/ge_gradient_radupperright.png");
tools_gradient_radupperright->setData(glow_eGradient_RadialUpperRight);
QAction* tools_gradient_radlowerright = addMenuItem(toplevel, tools_gradient,
"Gradient RadialLowerRight", SLOT(activate_gradient()), "",
"$pwr_exe/ge_gradient_radlowerright.png");
tools_gradient_radlowerright->setData(glow_eGradient_RadialLowerRight);
// Gradient buttons // Gradient buttons
QAction* tools_button_gradient_no QAction* tools_button_gradient_no
...@@ -2045,6 +2025,10 @@ GeQt::GeQt(void* x_parent_ctx, QWidget* x_parent_widget, ...@@ -2045,6 +2025,10 @@ GeQt::GeQt(void* x_parent_ctx, QWidget* x_parent_widget,
toplevel->show(); toplevel->show();
tools_textfont->setFixedHeight(tools_textsize->height());
tools_textfont->setFixedWidth(tools_textfont->width());
tools_textfont->setFont(QFont("Helvetica"));
graph_list->setVisible(false); graph_list->setVisible(false);
objectnav_w->setVisible(false); objectnav_w->setVisible(false);
hpaned3->setVisible(false); hpaned3->setVisible(false);
......
...@@ -42,6 +42,7 @@ ...@@ -42,6 +42,7 @@
#include "ge.h" #include "ge.h"
#include <QAction> #include <QAction>
#include <QComboBox>
#include <QLabel> #include <QLabel>
#include <QSplitter> #include <QSplitter>
...@@ -62,7 +63,9 @@ public: ...@@ -62,7 +63,9 @@ public:
QLabel* msg_label; QLabel* msg_label;
QLabel* cmd_prompt; QLabel* cmd_prompt;
QAction* grid_on_w; QAction* grid_on_w;
QAction* grid_sizes[4]; QComboBox* tools_gridsize;
QComboBox* tools_gradient;
QComboBox* tools_textfont;
QAction* show_grid_w; QAction* show_grid_w;
QAction* view_plant_w; QAction* view_plant_w;
QAction* view_graphlist_w; QAction* view_graphlist_w;
...@@ -217,17 +220,18 @@ public slots: ...@@ -217,17 +220,18 @@ public slots:
void activate_decr_intensity(); void activate_decr_intensity();
void activate_incr_shift(); void activate_incr_shift();
void activate_decr_shift(); void activate_decr_shift();
void activate_gradient(int idx);
void activate_gradient(); void activate_gradient();
void activate_reset_mode(); void activate_reset_mode();
void activate_scale(); void activate_scale();
void activate_scale_double(); void activate_scale_double();
void activate_scale_half(); void activate_scale_half();
void activate_grid(bool set); void activate_grid(bool set);
void activate_linewidth(); void activate_linewidth(int idx);
void activate_linetype(); void activate_linetype(int idx);
void activate_gridsize(); void activate_gridsize(int idx);
void activate_textsize(); void activate_textsize(int idx);
void activate_textfont(); void activate_textfont(int idx);
void activate_textbold(bool set); void activate_textbold(bool set);
void activate_zoom_in(); void activate_zoom_in();
void activate_zoom_out(); void activate_zoom_out();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment