Newer
Older
#include "OE_ui_viewportoptions.h"
OE_ui_viewportOptions::OE_ui_viewportOptions(MainWindow* window, OE_root* root)
{
this->root = root;
this->window = window;
topGlWindowBar();
this->setMargin(0);
this->setContentsMargins(0,0,0,0);
onRefresh();
connect(getInterfaceDisplay(), SIGNAL(styleChange()), this, SLOT(onRefresh()));
}
QtMaterialIconButton* OE_ui_viewportOptions::setIconButton(QString iconFile, const QObject *receiver = NULL, const char * method = NULL)
{
QIcon icon;
icon.addFile(iconFile, QSize(), QIcon::Normal, QIcon::Off);
QtMaterialIconButton* button = new QtMaterialIconButton(icon);
button->setUseThemeColors(false);
button->setIconSize(QSize(25,25));
button->setRole(Material::Primary);
if (method)
connect(button, SIGNAL(clicked()), receiver, method);
void OE_ui_viewportOptions::topGlWindowBar()
setAlignment(Qt::AlignTop);
setSpacing(4);
setMargin(3);
addWidget(setIconButton(":/resources/zoom_selection.svg",getInterfaceDisplay(),SLOT(zoomOnSelection())));
addWidget(setIconButton(":/resources/zoom_document.svg"));
addSpacing(8);
gridButton = setIconButton(":/resources/grid.svg", this, SLOT(onToggleGrid()));
addWidget(gridButton);
showCurvesButton = setIconButton(":/resources/show_curve.svg", this, SLOT(onToggleShowCurve()));
addWidget(showCurvesButton);
showStitchButton = setIconButton(":/resources/show_stitch.svg", this, SLOT(onToggleShowStitch()));
addWidget(showStitchButton);
addSpacing(8);
selectCurvesButton = setIconButton(":/resources/select_curve.svg", this, SLOT(onToggleSelectCurve()));
addWidget(selectCurvesButton);
selectStitchButton = setIconButton(":/resources/select_stitch.svg", this, SLOT(onToggleSelectStitch()));
addWidget(selectStitchButton);
}
OE_controller* OE_ui_viewportOptions::getController()
{
return this->root->interfaceDisplay->getController();
}
OE_interfaceDisplay* OE_ui_viewportOptions::getInterfaceDisplay()
{
return this->root->interfaceDisplay;
}
OE_document* OE_ui_viewportOptions::getDocument()
{
return this->root->interfaceDisplay->getDocument();
}
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
void OE_ui_viewportOptions::onRefresh()
{
gridButton->setChecked(getInterfaceDisplay()->style->drawGrid);
showCurvesButton->setChecked(getInterfaceDisplay()->style->drawCurves);
showStitchButton->setChecked(getInterfaceDisplay()->style->drawStitches);
selectCurvesButton->setChecked(getInterfaceDisplay()->style->selectCurves);
selectStitchButton->setChecked(getInterfaceDisplay()->style->selectStitches);
}
void OE_ui_viewportOptions::onToggleGrid()
{
getInterfaceDisplay()->style->drawGrid = !getInterfaceDisplay()->style->drawGrid;
getInterfaceDisplay()->update();
}
void OE_ui_viewportOptions::onToggleShowCurve()
{
getInterfaceDisplay()->style->drawCurves = !getInterfaceDisplay()->style->drawCurves;
getInterfaceDisplay()->update();
}
void OE_ui_viewportOptions::onToggleShowStitch()
{
getInterfaceDisplay()->style->drawStitches = !getInterfaceDisplay()->style->drawStitches;
getInterfaceDisplay()->update();
}
void OE_ui_viewportOptions::onToggleSelectCurve()
{
getInterfaceDisplay()->style->selectCurves = !getInterfaceDisplay()->style->selectCurves;
getInterfaceDisplay()->update();
}
void OE_ui_viewportOptions::onToggleSelectStitch()
{
getInterfaceDisplay()->style->selectStitches = !getInterfaceDisplay()->style->selectStitches;
getInterfaceDisplay()->update();
}