Commit 19b0868b authored by Christoffer Ackelman's avatar Christoffer Ackelman

QT: removed the code to maintain the aspect ratio on XttGe, it doesn't work in QT.

parent 40a46927
...@@ -234,69 +234,6 @@ void XttGeQtWidget::closeEvent(QCloseEvent* event) ...@@ -234,69 +234,6 @@ void XttGeQtWidget::closeEvent(QCloseEvent* event)
event->ignore(); event->ignore();
} }
void XttGeQtWidget::resizeEvent(QResizeEvent* event)
{
int oldWidth = event->oldSize().width();
int oldHeight = event->oldSize().height();
int width = event->size().width();
int height = event->size().height();
event->accept();
if (width != oldWidth && height != oldHeight) {
if (ge->min_aspect * height > width) {
int delta = height - width / ge->min_aspect;
if (height - delta >= 0) {
height -= delta;
} else {
delta = height * ge->min_aspect - width;
if (width + delta <= INT_MAX) {
width += delta;
}
}
}
if (ge->max_aspect * height < width) {
int delta = width - height * ge->max_aspect;
if (width - delta >= 0) {
width -= delta;
} else {
delta = width / ge->max_aspect - height;
if (height + delta <= INT_MAX) {
height += delta;
}
}
}
} else if (width != oldWidth) {
if (ge->min_aspect * height > width) {
int delta = height - width / ge->min_aspect;
if (height - delta >= 0) {
height -= delta;
}
}
if (ge->max_aspect * height < width) {
int delta = width / ge->max_aspect - height;
if (height + delta <= INT_MAX) {
height += delta;
}
}
} else if (height != oldHeight) {
if (ge->min_aspect * height > width) {
int delta = height * ge->min_aspect - width;
if (width + delta <= INT_MAX) {
width += delta;
}
}
if (ge->max_aspect * height < width) {
int delta = width - height * ge->max_aspect;
if (width - delta >= 0) {
width -= delta;
}
}
}
resize(width, height);
}
XttGeQt::XttGeQt(void* xg_parent_ctx, const char* xg_name, XttGeQt::XttGeQt(void* xg_parent_ctx, const char* xg_name,
const char* xg_filename, int xg_scrollbar, int xg_menu, int xg_navigator, const char* xg_filename, int xg_scrollbar, int xg_menu, int xg_navigator,
int xg_width, int xg_height, int x, int y, double scan_time, int xg_width, int xg_height, int x, int y, double scan_time,
...@@ -367,7 +304,7 @@ XttGeQt::XttGeQt(void* xg_parent_ctx, const char* xg_name, ...@@ -367,7 +304,7 @@ XttGeQt::XttGeQt(void* xg_parent_ctx, const char* xg_name,
graph->sound_cb = &ge_sound_cb; graph->sound_cb = &ge_sound_cb;
graph->eventlog_cb = &ge_eventlog_cb; graph->eventlog_cb = &ge_eventlog_cb;
grow_widget->setMinimumSize(window_width, window_height); grow_widget->resize(window_width, window_height);
QObject::connect(((GraphQt*)graph)->grow_widget, QObject::connect(((GraphQt*)graph)->grow_widget,
SIGNAL(resize_signal(QResizeEvent*)), toplevel, SIGNAL(resize_signal(QResizeEvent*)), toplevel,
...@@ -454,10 +391,6 @@ XttGeQt::XttGeQt(void* xg_parent_ctx, const char* xg_name, ...@@ -454,10 +391,6 @@ XttGeQt::XttGeQt(void* xg_parent_ctx, const char* xg_name,
window_height = zoom * (y1 - y0); window_height = zoom * (y1 - y0);
} }
float rd = (window_width < 300 || window_height < 300) ? 0.2 : 0.05;
min_aspect = double(window_width) / window_height * (1.0 - rd);
max_aspect = double(window_width) / window_height * (1.0 + rd);
toplevel->resize(window_width, window_height); toplevel->resize(window_width, window_height);
} }
......
...@@ -102,7 +102,6 @@ public: ...@@ -102,7 +102,6 @@ public:
protected: protected:
void focusInEvent(QFocusEvent* event); void focusInEvent(QFocusEvent* event);
void closeEvent(QCloseEvent* event); void closeEvent(QCloseEvent* event);
void resizeEvent(QResizeEvent* event);
public slots: public slots:
void activate_confirm_ok(); void activate_confirm_ok();
......
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