Commit e7efc139 authored by daniel_e's avatar daniel_e
Browse files

New files. Move Util::prior() and next() hitherto, and add

* src/miscutils.{cc,h}: New files.  Move Util::prior() and next() hitherto,
and add Util::gtk_version_at_least() to do a runtime version check.
* src/Makefile.am: Add miscutils.{cc,h}.

* src/stringutils.h: Move prior() and next() into miscutils.h.
* src/filebuffer.cc: #include "miscutils.h".
* src/filetree.cc (expand_and_select): Use the lazy scrolling feature
if GTK+ >= 2.1.4 is available at runtime.
parent f0c3745d
2002-12-15 Daniel Elstner <daniel.elstner@gmx.net>
* src/miscutils.{cc,h}: New files. Move Util::prior() and next()
hitherto, and add Util::gtk_version_at_least() to do a runtime
version check.
* src/Makefile.am: Add miscutils.{cc,h}.
* src/stringutils.h: Move prior() and next() into miscutils.h.
* src/filebuffer.cc: #include "miscutils.h".
* src/filetree.cc (expand_and_select): Use the lazy scrolling
feature if GTK+ >= 2.1.4 is available at runtime.
2002-12-15 Daniel Elstner <daniel.elstner@gmx.net>
* src/filetree.cc (expand_and_select): Don't pass row_align to
......
......@@ -44,6 +44,8 @@ regexxer_SOURCES = \
main.cc \
mainwindow.cc \
mainwindow.h \
miscutils.cc \
miscutils.h \
pcreshell.cc \
pcreshell.h \
prefdialog.cc \
......
......@@ -20,6 +20,7 @@
#include "filebuffer.h"
#include "filebufferundo.h"
#include "miscutils.h"
#include "pcreshell.h"
#include "stringutils.h"
......
......@@ -20,14 +20,13 @@
#include "filetree.h"
#include "filetreeprivate.h"
#include "miscutils.h"
#include "pcreshell.h"
#include "signalutils.h"
#include "stringutils.h"
#include <gtkmm/stock.h>
#include <config.h>
using namespace Regexxer::FileTreePrivate;
......@@ -730,11 +729,10 @@ void FileTree::expand_and_select(const Gtk::TreePath& path)
get_selection()->select(path);
#if REGEXXER_HAVE_GTKMM_22 /* actually a GTK+ issue */
scroll_to_row(path);
#else
scroll_to_row(path, 0.5);
#endif
if(Util::gtk_version_at_least(1, 4)) // GTK+ >= 2.1.4
scroll_to_row(path);
else
scroll_to_row(path, 0.5);
}
void FileTree::on_treestore_sort_column_changed()
......
/* $Id$
*
* Copyright (c) 2002 Daniel Elstner <daniel.elstner@gmx.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License VERSION 2 as
* published by the Free Software Foundation. You are not allowed to
* use any other version of the license; unless you got the explicit
* permission from the author to do so.
*
* This program 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "miscutils.h"
#include <gtk/gtk.h>
bool Util::gtk_version_at_least(unsigned int minor, unsigned int micro)
{
g_assert(gtk_major_version == GTK_MAJOR_VERSION);
return ((gtk_minor_version > minor) ||
(gtk_minor_version == minor && gtk_micro_version >= micro));
}
/* $Id$
*
* Copyright (c) 2002 Daniel Elstner <daniel.elstner@gmx.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License VERSION 2 as
* published by the Free Software Foundation. You are not allowed to
* use any other version of the license; unless you got the explicit
* permission from the author to do so.
*
* This program 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef REGEXXER_MISCUTILS_H_INCLUDED
#define REGEXXER_MISCUTILS_H_INCLUDED
namespace Util
{
/* next() and prior(): Idea shamelessly stolen from boost.
*/
template <class Iterator>
inline Iterator next(Iterator pos) { return ++pos; }
template <class Iterator>
inline Iterator prior(Iterator pos) { return --pos; }
/* Return true if the GTK+ version is GTK_MAJOR_VERSION.minor.micro
* or higher. There is no parameter for the major version since using
* a different major release would require (at least) recompiling the
* program anyway.
*/
bool gtk_version_at_least(unsigned int minor, unsigned int micro);
} // namespace Util
#endif /* REGEXXER_MISCUTILS_H_INCLUDED */
......@@ -31,14 +31,6 @@ namespace Util
typedef std::vector< std::pair<int,int> > CaptureVector;
// next() and prior(): Idea shamelessly stolen from boost.
//
template <class Iterator>
inline Iterator next(Iterator pos) { return ++pos; }
template <class Iterator>
inline Iterator prior(Iterator pos) { return --pos; }
void trim_whitespace(Glib::ustring::const_iterator& pbegin, Glib::ustring::const_iterator& pend);
bool validate_encoding(const std::string& encoding);
bool encodings_equal(const std::string& lhs, const std::string& rhs);
......
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