Browse Source

BAB-21 #comment Working example #time 2h

master
tedjk 11 years ago
parent
commit
5f7837458b
  1. 19
      juci/api.cc
  2. 2
      juci/notebook.h

19
juci/api.cc

@ -10,7 +10,20 @@ libjuci::ApiServiceProvider::ApiServiceProvider( ){
std::cout << "Apiservice std.ctor" << std::endl; std::cout << "Apiservice std.ctor" << std::endl;
} }
void libjuci::ApiServiceProvider::ReplaceWord(std::string word){ void libjuci::ApiServiceProvider::ReplaceWord(std::string word){
std::cout << word << std::endl;
Glib::RefPtr<Gtk::TextBuffer> buffer = libjuci::ApiServiceProvider::notebook_->source_vec_.back()->view().get_buffer();
Gtk::TextIter text_iterator = buffer->get_insert()->get_iter();
Gtk::TextIter end = buffer->get_insert()->get_iter();
while( !text_iterator.starts_word()){
// text_iterator--;
text_iterator.backward_char();
}
buffer->erase(text_iterator, end);
text_iterator = buffer->get_insert()->get_iter();
buffer->insert(text_iterator, word);
} }
void libjuci::ApiServiceProvider::ReplaceLine(std::string line){} void libjuci::ApiServiceProvider::ReplaceLine(std::string line){}
@ -37,8 +50,8 @@ void libjuci::ReplaceWord(const std::string word_) {
// << std::endl; // << std::endl;
//libjuci::ApiServiceProvider::ReplaceWord(word); //libjuci::ApiServiceProvider::ReplaceWord(word);
libjuci::ApiServiceProvider::ReplaceWord(word_);
std::cout << "The string: " << word_ << std::endl; //std::cout << "The string: " << word_ << std::endl;
} }
void libjuci::ReplaceLine(const std::string line) { void libjuci::ReplaceLine(const std::string line) {

2
juci/notebook.h

@ -24,7 +24,7 @@ namespace Notebook {
void OnNewPage(std::string name); void OnNewPage(std::string name);
void OnCloseCurrentPage(); void OnCloseCurrentPage();
void OnOpenFile(std::string filename); void OnOpenFile(std::string filename);
private: // private:
View view_; View view_;
Entry::Controller entry_; Entry::Controller entry_;
std::vector<Source::Controller*> source_vec_; std::vector<Source::Controller*> source_vec_;

Loading…
Cancel
Save