Browse Source

Merge pull request #1 from cppit/master

Update eidheim/jucipp
merge-requests/365/head
Ole Christian Eidheim 11 years ago
parent
commit
f6d9984d79
  1. 1
      juci/config.json
  2. 1
      juci/menu.xml
  3. 28
      juci/notebook.cc
  4. 2
      juci/notebook.h
  5. 5
      juci/source.cc
  6. 2
      juci/source.h

1
juci/config.json

@ -47,6 +47,7 @@
"edit_cut": "<control>x", "edit_cut": "<control>x",
"edit_paste": "<control>v", "edit_paste": "<control>v",
"edit_undo": "<control>z", "edit_undo": "<control>z",
"edit_redo": "<control>y",
"edit_find": "<control>f", "edit_find": "<control>f",
"compile_and_run": "<control><alt>r", "compile_and_run": "<control><alt>r",
"compile": "<control>r" "compile": "<control>r"

1
juci/menu.xml

@ -20,6 +20,7 @@
<separator/> <separator/>
<menuitem action='EditFind'/> <menuitem action='EditFind'/>
<menuitem action='EditUndo'/> <menuitem action='EditUndo'/>
<menuitem action='EditRedo'/>
</menu> </menu>
<menu action='ProjectMenu'> <menu action='ProjectMenu'>
<menuitem action='ProjectCompileAndRun'/> <menuitem action='ProjectCompileAndRun'/>

28
juci/notebook.cc

@ -120,8 +120,31 @@ void Notebook::Controller::CreateKeybindings(Keybindings::Controller
Gtk::AccelKey(keybindings.config_ Gtk::AccelKey(keybindings.config_
.key_map()["edit_undo"]), .key_map()["edit_undo"]),
[this]() { [this]() {
//OnUndo(); INFO("On undo");
Glib::RefPtr<Gsv::UndoManager> undo_manager =
CurrentTextView().get_source_buffer()->get_undo_manager();
if (Pages() != 0 && undo_manager->can_undo()) {
undo_manager->undo();
}
INFO("Done undo");
}
);
keybindings.action_group_menu()->
add(Gtk::Action::create("EditRedo",
"Redo"),
Gtk::AccelKey(keybindings.config_
.key_map()["edit_redo"]),
[this]() {
INFO("On Redo");
Glib::RefPtr<Gsv::UndoManager> undo_manager =
CurrentTextView().get_source_buffer()->get_undo_manager();
if (Pages() != 0 && undo_manager->can_redo()) {
undo_manager->redo();
}
INFO("Done Redo");
}); });
entry_.view_.entry().signal_activate(). entry_.view_.entry().signal_activate().
connect( connect(
[this]() { [this]() {
@ -515,7 +538,8 @@ void Notebook::Controller
} }
} }
Gtk::TextView& Notebook::Controller::CurrentTextView() { Source::View& Notebook::Controller::CurrentTextView() {
INFO("Getting sourceview");
return text_vec_.at(CurrentPage())->view(); return text_vec_.at(CurrentPage())->view();
} }

2
juci/notebook.h

@ -36,7 +36,7 @@ namespace Notebook {
Directories::Config& dir_cfg); Directories::Config& dir_cfg);
~Controller(); ~Controller();
Glib::RefPtr<Gtk::TextBuffer> Buffer(Source::Controller *source); Glib::RefPtr<Gtk::TextBuffer> Buffer(Source::Controller *source);
Gtk::TextView& CurrentTextView(); Source::View& CurrentTextView();
int CurrentPage(); int CurrentPage();
Gtk::Box& entry_view(); Gtk::Box& entry_view();
Gtk::Notebook& Notebook(); Gtk::Notebook& Notebook();

5
juci/source.cc

@ -28,6 +28,7 @@ Range(const Source::Range &org) :
//// View //// //// View ////
////////////// //////////////
Source::View::View() { Source::View::View() {
Gsv::init();
override_font(Pango::FontDescription("Monospace")); override_font(Pango::FontDescription("Monospace"));
set_show_line_numbers(true); set_show_line_numbers(true);
set_highlight_current_line(true); set_highlight_current_line(true);
@ -390,6 +391,6 @@ void Source::Controller::OnOpenFile(const string &filepath) {
}); });
} }
} }
Glib::RefPtr<Gtk::TextBuffer> Source::Controller::buffer() { Glib::RefPtr<Gsv::Buffer> Source::Controller::buffer() {
return view().get_buffer(); return view().get_source_buffer();
} }

2
juci/source.h

@ -152,7 +152,7 @@ namespace Source {
int column, int column,
std::vector<AutoCompleteData> std::vector<AutoCompleteData>
*suggestions); *suggestions);
Glib::RefPtr<Gtk::TextBuffer> buffer(); Glib::RefPtr<Gsv::Buffer> buffer();
bool is_saved() { return is_saved_; } bool is_saved() { return is_saved_; }
bool is_changed() { return is_changed_; } bool is_changed() { return is_changed_; }
std::string path() { return model().file_path(); } std::string path() { return model().file_path(); }

Loading…
Cancel
Save