X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-studio%2Ftags%2Fstable%2Fsynfig-studio%2Fsrc%2Fgtkmm%2Fadjust_window.cpp;fp=synfig-studio%2Ftags%2Fstable%2Fsynfig-studio%2Fsrc%2Fgtkmm%2Fadjust_window.cpp;h=0000000000000000000000000000000000000000;hb=0ae662c528942732c68caaaed4d37cc1264494fb;hp=ca0219f8f74eab94a5e223af81532398eca4a4d9;hpb=d35c28ab41fe06acb4d7e34ecf214f30027d324f;p=synfig.git diff --git a/synfig-studio/tags/stable/synfig-studio/src/gtkmm/adjust_window.cpp b/synfig-studio/tags/stable/synfig-studio/src/gtkmm/adjust_window.cpp deleted file mode 100644 index ca0219f..0000000 --- a/synfig-studio/tags/stable/synfig-studio/src/gtkmm/adjust_window.cpp +++ /dev/null @@ -1,167 +0,0 @@ -/* === S Y N F I G ========================================================= */ -/*! \file adjust_window.cpp -** \brief Adjustment Window Implementation File -** -** $Id: adjust_window.cpp,v 1.1.1.1 2005/01/07 03:34:35 darco Exp $ -** -** \legal -** Copyright (c) 2004 Adrian Bentley -** -** This package is free software; you can redistribute it and/or -** modify it under the terms of the GNU General Public License as -** published by the Free Software Foundation; either version 2 of -** the License, or (at your option) any later version. -** -** This package is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** General Public License for more details. -** \endlegal -*/ -/* ========================================================================= */ - -/* === H E A D E R S ======================================================= */ - -#ifdef USING_PCH -# include "pch.h" -#else -#ifdef HAVE_CONFIG_H -# include -#endif - -#include "adjust_window.h" -#include "app.h" - -#endif - -/* === U S I N G =========================================================== */ - -using namespace std; -//using namespace etl; -//using namespace synfig; - -using studio::Adjust_Window; - -/* === M A C R O S ========================================================= */ -const double EPSILON = 1.0e-6; - -/* === G L O B A L S ======================================================= */ - -/* === P R O C E D U R E S ================================================= */ - -/* === M E T H O D S ======================================================= */ - -/* === E N T R Y P O I N T ================================================= */ - -Adjust_Window::Adjust_Window(double value, double lower, double upper, - double stepinc, double pageinc, double pagesize, - Gtk::Adjustment *adj) -: Adjustment(value,lower,upper,stepinc,pageinc,pagesize), - adj_child(0) -{ - if(adj) set_child_adjustment(adj); -} - -Adjust_Window::~Adjust_Window() -{ - //connections should automatically be killed etc. -} - -//child interface functions -Gtk::Adjustment *Adjust_Window::get_child_adjustment() -{ - return adj_child; -} - -const Gtk::Adjustment *Adjust_Window::get_child_adjustment() const -{ - return adj_child; -} - -void Adjust_Window::set_child_adjustment(Gtk::Adjustment *child) -{ - childchanged.disconnect(); - - adj_child = child; - - synfig::info("Adjust: connecting to child signals"); - if(child) - { - childchanged = child->signal_changed().connect(sigc::mem_fun(*this,&Adjust_Window::update_fromchild)); - - update_child(); - } -} - -void Adjust_Window::on_changed() -{ - update_child(); -} - -void Adjust_Window::on_value_changed() -{ - update_child(); -} - -//SUB TIME FUNCTIONS -double Adjust_Window::get_sub_lower() const -{ - return get_value(); -} - -double Adjust_Window::get_sub_upper() const -{ - return get_value() + get_page_size(); -} - -//---- REFRESH FUNCTIONS ----- -void Adjust_Window::update_child() -{ - if(adj_child) - { - bool childchanged = false; - - double v = get_value(); - double ve = v + get_page_size(); - - //reset child's values if they need to be... - if(abs(v - adj_child->get_lower()) > EPSILON) - { - adj_child->set_lower(v); - childchanged = true; - } - - if(abs(ve - adj_child->get_upper()) > EPSILON) - { - adj_child->set_upper(ve); - childchanged = true; - } - - if(childchanged) - { - adj_child->changed(); - } - } -} - -void Adjust_Window::update_fromchild() -{ - if(adj_child) - { - double b = adj_child->get_lower(); - double dist = adj_child->get_upper() - b; - - //reset our values if they need to be... - if(abs(get_value() - b) > EPSILON) - { - set_value(b); - value_changed(); - } - - if(abs(get_page_size() - dist) > EPSILON) - { - set_page_size(dist); - changed(); - } - } -}