Browse Source

BAB-21 #comment fixed bug where plugins only worked on the last created/opened file #time 20m

master
tedjk 11 years ago
parent
commit
ce314d3fa3
  1. 13
      juci/api.cc
  2. 5
      juci/api.h

13
juci/api.cc

@ -51,17 +51,15 @@ void libjuci::ApiServiceProvider::AddKeybinding() {
"Add snippet"),
Gtk::AccelKey("<control><alt>space"),
[]() {
std::cout << "ctrl alt space" << std::endl;
libjuci::LoadPlugin("snippet");
});
std::cout << "addkeybinding" << std::endl;
}
///////////////////////
//// Api to python ////
///////////////////////
void libjuci::ReplaceWord(const std::string word_) {
libjuci::ApiServiceProvider::ReplaceWord(word_);
void libjuci::ReplaceWord(const std::string word) {
libjuci::ApiServiceProvider::ReplaceWord(word);
}
void libjuci::ReplaceLine(const std::string line) {
@ -122,7 +120,12 @@ void libjuci::IterToWordEnd(Gtk::TextIter &iter) {
}
Glib::RefPtr<Gtk::TextBuffer> libjuci::BufferFromNotebook() {
return Glib::RefPtr<Gtk::TextBuffer>(libjuci::ApiServiceProvider::notebook_->source_vec_.back()->view().get_buffer());
//TODO forgie: make sure it does not get the buffer to the last created textview.
int i = 0;
while(!libjuci::ApiServiceProvider::notebook_->source_vec_.at(i)->view().has_focus()) {
i++;
}
return Glib::RefPtr<Gtk::TextBuffer>(libjuci::ApiServiceProvider::notebook_->source_vec_.at(i)->view().get_buffer());
}
Gtk::TextIter libjuci::IterFromNotebook() {

5
juci/api.h

@ -35,13 +35,14 @@ namespace libjuci {
void IterToWordStart(Gtk::TextIter &iter);
void IterToWordEnd(Gtk::TextIter &iter);
Gtk::TextIter IterFromNotebook();
//TODO forgie: make sure it does not get the buffer to the last created textview.
Glib::RefPtr<Gtk::TextBuffer> BufferFromNotebook();
///////////////////////
//// Api to python ////
///////////////////////
void ReplaceWord(const std::string word_);
void ReplaceLine(const std::string line_);
void ReplaceWord(const std::string word);
void ReplaceLine(const std::string line);
std::string GetWord();
//TODO forgie: Make more functions targeting the python module

Loading…
Cancel
Save