Commit bc139d5f authored by daniel_e's avatar daniel_e
Browse files

(signal_preview_line_changed): Use the new Util::QueuedSignal rather than

queuing manually.
parent 2d5d553e
2002-11-25 Daniel Elstner <daniel.elstner@gmx.net>
* src/filebuffer.{cc,h} (signal_preview_line_changed): Use the
new Util::QueuedSignal rather than queuing manually.
2002-11-25 Daniel Elstner <daniel.elstner@gmx.net>
* src/signalutils.{cc,h}: New files containing various sigc++
......
......@@ -23,7 +23,6 @@
#include "stringutils.h"
#include <algorithm>
#include <glibmm.h>
namespace
......@@ -187,7 +186,6 @@ FileBuffer::FileBuffer()
current_match_ (match_list_.end()),
match_removed_ (false),
bound_state_ (BOUND_FIRST | BOUND_LAST),
preview_line_changed_ (false),
locked_ (false)
{}
......@@ -510,7 +508,7 @@ void FileBuffer::on_insert(const FileBuffer::iterator& pos, const Glib::ustring&
find_line_bounds(lbegin, lend);
if(pos.in_range(lbegin, lend))
queue_preview_line_changed();
signal_preview_line_changed.queue();
}
const Glib::RefPtr<RegexxerTags>& tagtable = RegexxerTags::instance();
......@@ -539,7 +537,7 @@ void FileBuffer::on_erase(const FileBuffer::iterator& rbegin, const FileBuffer::
find_line_bounds(lbegin, lend);
if(lbegin.in_range(rbegin, rend) || rbegin.in_range(lbegin, lend))
queue_preview_line_changed();
signal_preview_line_changed.queue();
}
const Glib::RefPtr<RegexxerTags>& tagtable = RegexxerTags::instance();
......@@ -699,7 +697,7 @@ void FileBuffer::remove_tag_current()
current_match_->mark->set_visible(false);
}
queue_preview_line_changed();
signal_preview_line_changed.queue();
}
}
......@@ -729,7 +727,7 @@ void FileBuffer::apply_tag_current()
place_cursor(start);
queue_preview_line_changed();
signal_preview_line_changed.queue();
}
}
......@@ -787,30 +785,5 @@ void FileBuffer::update_bound_state()
signal_bound_state_changed(bound_state_); // emit
}
void FileBuffer::queue_preview_line_changed()
{
// Collect subsequent emission requests and emit only once,
// as soon as the GLib main loop is idle again.
if(!preview_line_changed_)
{
preview_line_changed_ = true;
Glib::signal_idle().connect(
SigC::slot(*this, &FileBuffer::preview_line_changed_idle_callback),
Glib::PRIORITY_HIGH_IDLE);
}
}
bool FileBuffer::preview_line_changed_idle_callback()
{
signal_preview_line_changed(); // emit
// Tell queue_preview_line_changed() that we've done the update.
preview_line_changed_ = false;
return false; // disconnect callback
}
} // namespace Regexxer
......@@ -21,6 +21,8 @@
#ifndef REGEXXER_FILEBUFFER_H_INCLUDED
#define REGEXXER_FILEBUFFER_H_INCLUDED
#include "signalutils.h"
#include <list>
#include <utility>
#include <vector>
......@@ -116,7 +118,7 @@ public:
SigC::Signal1<void,int> signal_match_count_changed;
SigC::Signal1<void,BoundState> signal_bound_state_changed;
SigC::Signal0<void> signal_preview_line_changed;
Util::QueuedSignal signal_preview_line_changed;
SigC::Signal0<bool> signal_pulse;
protected:
......@@ -135,7 +137,6 @@ private:
std::list<MatchData>::iterator current_match_;
bool match_removed_;
BoundState bound_state_;
bool preview_line_changed_;
bool locked_;
void replace_match(std::list<MatchData>::iterator pos, const Glib::ustring& substitution);
......@@ -154,8 +155,6 @@ private:
static void find_line_bounds(iterator& line_begin, iterator& line_end);
void update_bound_state();
void queue_preview_line_changed();
bool preview_line_changed_idle_callback();
// Work-around for silly, stupid, and annoying gcc 2.95.x.
friend class FileBuffer::ScopedLock;
......
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