Commit 5289da6c authored by Christoffer Ackelman's avatar Christoffer Ackelman

Glow: Minor cleanup.

parent abff9ea4
...@@ -135,11 +135,6 @@ void BrowCtx::zoom(double factor) ...@@ -135,11 +135,6 @@ void BrowCtx::zoom(double factor)
change_scrollbar(); change_scrollbar();
} }
void BrowCtx::unzoom()
{
zoom(mw->base_zoom_factor / mw->zoom_factor_y);
}
void BrowCtx::print(char* filename) void BrowCtx::print(char* filename)
{ {
int i; int i;
......
...@@ -56,7 +56,6 @@ public: ...@@ -56,7 +56,6 @@ public:
void configure(); void configure();
void change_scrollbar(); void change_scrollbar();
void zoom(double factor); void zoom(double factor);
void unzoom();
void print(char* filename); void print(char* filename);
int get_first(GlowArrayElem** first) int get_first(GlowArrayElem** first)
{ {
......
...@@ -205,7 +205,6 @@ void ColPalCtx::configure() ...@@ -205,7 +205,6 @@ void ColPalCtx::configure()
} }
get_borders(); get_borders();
a.zoom(); a.zoom();
set_dirty();
change_scrollbar(); change_scrollbar();
set_colors(); set_colors();
hot_mode = glow_eHotMode_Disabled; hot_mode = glow_eHotMode_Disabled;
...@@ -257,11 +256,6 @@ void ColPalCtx::zoom(double factor) ...@@ -257,11 +256,6 @@ void ColPalCtx::zoom(double factor)
change_scrollbar(); change_scrollbar();
} }
void ColPalCtx::unzoom()
{
zoom(mw->base_zoom_factor / mw->zoom_factor_y);
}
void ColPalCtx::print(char* filename) void ColPalCtx::print(char* filename)
{ {
int i; int i;
...@@ -493,7 +487,6 @@ int ColPalCtx::event_handler(glow_eEvent event, int x, int y, int w, int h) ...@@ -493,7 +487,6 @@ int ColPalCtx::event_handler(glow_eEvent event, int x, int y, int w, int h)
} }
callback = 1; callback = 1;
} }
} else if (callback_object->type() == glow_eObjectType_GrowText) {
} }
} }
break; break;
...@@ -695,7 +688,6 @@ int ColPalCtx::event_handler(glow_eEvent event, int x, int y, int w, int h) ...@@ -695,7 +688,6 @@ int ColPalCtx::event_handler(glow_eEvent event, int x, int y, int w, int h)
if (callback_object_type != glow_eObjectType_NoObject) if (callback_object_type != glow_eObjectType_NoObject)
e.object.object = callback_object; e.object.object = callback_object;
event_callback[event](this, &e); event_callback[event](this, &e);
redraw_if_dirty();
} }
redraw_if_dirty(); redraw_if_dirty();
......
...@@ -94,9 +94,6 @@ public: ...@@ -94,9 +94,6 @@ public:
//! Adjust the pixel coordinates to the current zoomfactor. //! Adjust the pixel coordinates to the current zoomfactor.
void zoom(double factor); void zoom(double factor);
//! Reset to base zoomfactor.
void unzoom();
//! Not used. //! Not used.
void print(char* filename); void print(char* filename);
......
...@@ -177,6 +177,10 @@ int GlowCtx::save(char* filename, glow_eSaveMode mode) ...@@ -177,6 +177,10 @@ int GlowCtx::save(char* filename, glow_eSaveMode mode)
fp << int(glow_eSave_Ctx_x_left) << FSPACE << x_left << '\n'; fp << int(glow_eSave_Ctx_x_left) << FSPACE << x_left << '\n';
fp << int(glow_eSave_Ctx_y_high) << FSPACE << y_high << '\n'; fp << int(glow_eSave_Ctx_y_high) << FSPACE << y_high << '\n';
fp << int(glow_eSave_Ctx_y_low) << FSPACE << y_low << '\n'; fp << int(glow_eSave_Ctx_y_low) << FSPACE << y_low << '\n';
fp << int(glow_eSave_Ctx_window_width) << FSPACE << mw->window_width << '\n';
fp << int(glow_eSave_Ctx_window_height) << FSPACE << mw->window_height << '\n';
fp << int(glow_eSave_Ctx_nav_window_width) << FSPACE << navw->window_width << '\n';
fp << int(glow_eSave_Ctx_nav_window_height) << FSPACE << navw->window_height << '\n';
fp << int(glow_eSave_Ctx_nav_rect_ll_x) << FSPACE << nav_rect_ll_x << '\n'; fp << int(glow_eSave_Ctx_nav_rect_ll_x) << FSPACE << nav_rect_ll_x << '\n';
fp << int(glow_eSave_Ctx_nav_rect_ll_y) << FSPACE << nav_rect_ll_y << '\n'; fp << int(glow_eSave_Ctx_nav_rect_ll_y) << FSPACE << nav_rect_ll_y << '\n';
fp << int(glow_eSave_Ctx_nav_rect_ur_x) << FSPACE << nav_rect_ur_x << '\n'; fp << int(glow_eSave_Ctx_nav_rect_ur_x) << FSPACE << nav_rect_ur_x << '\n';
...@@ -345,6 +349,18 @@ int GlowCtx::open(char* filename, glow_eSaveMode mode) ...@@ -345,6 +349,18 @@ int GlowCtx::open(char* filename, glow_eSaveMode mode)
case glow_eSave_Ctx_y_low: case glow_eSave_Ctx_y_low:
fp >> y_low; fp >> y_low;
break; break;
case glow_eSave_Ctx_window_width:
fp >> mw->window_width;
break;
case glow_eSave_Ctx_window_height:
fp >> mw->window_height;
break;
case glow_eSave_Ctx_nav_window_width:
fp >> navw->window_width;
break;
case glow_eSave_Ctx_nav_window_height:
fp >> navw->window_height;
break;
case glow_eSave_Ctx_nav_rect_ll_x: case glow_eSave_Ctx_nav_rect_ll_x:
fp >> nav_rect_ll_x; fp >> nav_rect_ll_x;
break; break;
...@@ -834,6 +850,7 @@ void GlowCtx::nav_zoom() ...@@ -834,6 +850,7 @@ void GlowCtx::nav_zoom()
return; return;
if (a.size() > 0) { if (a.size() > 0) {
set_dirty();
get_borders(); get_borders();
double x_nav_left = MIN(x_left, mw->offset_x / mw->zoom_factor_x); double x_nav_left = MIN(x_left, mw->offset_x / mw->zoom_factor_x);
double x_nav_right double x_nav_right
...@@ -849,7 +866,6 @@ void GlowCtx::nav_zoom() ...@@ -849,7 +866,6 @@ void GlowCtx::nav_zoom()
navw->offset_x = int(x_nav_left * navw->zoom_factor_x); navw->offset_x = int(x_nav_left * navw->zoom_factor_x);
navw->offset_y = int(y_nav_low * navw->zoom_factor_y); navw->offset_y = int(y_nav_low * navw->zoom_factor_y);
a.nav_zoom(); a.nav_zoom();
set_dirty();
} }
} }
...@@ -917,7 +933,6 @@ int GlowCtx::event_handler(glow_eEvent event, int x, int y, int w, int h) ...@@ -917,7 +933,6 @@ int GlowCtx::event_handler(glow_eEvent event, int x, int y, int w, int h)
if (sts) if (sts)
break; break;
} }
} else if (event == event_create_node) {
} else if (event == event_move_node) { } else if (event == event_move_node) {
move_clear(); move_clear();
......
...@@ -88,11 +88,6 @@ void CurveCtx::zoom(double factor) ...@@ -88,11 +88,6 @@ void CurveCtx::zoom(double factor)
change_scrollbar(); change_scrollbar();
} }
void CurveCtx::unzoom()
{
zoom(mw->base_zoom_factor / mw->zoom_factor_x);
}
void CurveCtx::adjust_layout() void CurveCtx::adjust_layout()
{ {
int width, height; int width, height;
...@@ -113,23 +108,15 @@ void CurveCtx::nav_zoom() ...@@ -113,23 +108,15 @@ void CurveCtx::nav_zoom()
if (nodraw) if (nodraw)
return; return;
if (a.size() > 0) { if (a.size() > 0) {
double x_nav_left, x_nav_right, y_nav_low, y_nav_high; set_dirty();
get_borders(); get_borders();
// std::cout << "Borders : <" << x_left << " > " << x_right << " ^ " << if (feq(x_right, x_left) || feq(y_high, y_low))
// y_high << " Y " << y_low << '\n';
x_nav_left = x_left;
x_nav_right = x_right;
y_nav_low = y_low;
y_nav_high = y_high;
if (feq(x_nav_right, x_nav_left) || feq(y_nav_high, y_nav_low))
return; return;
navw->zoom_factor_x = navw->window_width / (x_nav_right - x_nav_left); navw->zoom_factor_x = navw->window_width / (x_right - x_left);
navw->zoom_factor_y = navw->window_height / (y_nav_high - y_nav_low); navw->zoom_factor_y = navw->window_height / (y_high - y_low);
navw->offset_x = int(x_nav_left * navw->zoom_factor_x); navw->offset_x = int(x_left * navw->zoom_factor_x);
navw->offset_y = int(y_nav_low * navw->zoom_factor_y); navw->offset_y = int(y_low * navw->zoom_factor_y);
a.nav_zoom(); a.nav_zoom();
set_dirty();
} }
} }
......
...@@ -48,7 +48,6 @@ public: ...@@ -48,7 +48,6 @@ public:
int layout_adjusted; int layout_adjusted;
void configure(); void configure();
void zoom(double factor); void zoom(double factor);
void unzoom();
void nav_zoom(); void nav_zoom();
void get_zoom(double* factor_x, double* factor_y); void get_zoom(double* factor_x, double* factor_y);
void get_prefered_zoom_y(int height, double* factor_y); void get_prefered_zoom_y(int height, double* factor_y);
......
...@@ -646,11 +646,6 @@ void KeyboardCtx::zoom(double factor) ...@@ -646,11 +646,6 @@ void KeyboardCtx::zoom(double factor)
nav_zoom(); nav_zoom();
} }
void KeyboardCtx::unzoom()
{
zoom(mw->base_zoom_factor / mw->zoom_factor_y);
}
int KeyboardCtx::event_handler(glow_eEvent event, int x, int y, int w, int h) int KeyboardCtx::event_handler(glow_eEvent event, int x, int y, int w, int h)
{ {
int sts; int sts;
......
...@@ -94,9 +94,6 @@ public: ...@@ -94,9 +94,6 @@ public:
//! Adjust the pixel coordinates to the current zoomfactor. //! Adjust the pixel coordinates to the current zoomfactor.
void zoom(double factor); void zoom(double factor);
//! Reset to base zoomfactor.
void unzoom();
//! Event handler //! Event handler
/*! /*!
\param event Current event. \param event Current event.
......
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