9 changed files with 141 additions and 111 deletions
@ -1,9 +1,14 @@ |
|||||||
#include "juci.h" |
#include "juci.h" |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char *argv[]) { |
int main(int argc, char *argv[]) { |
||||||
Glib::RefPtr<Gtk::Application> app = Gtk::Application::create( |
Glib::RefPtr<Gtk::Application> app = Gtk::Application::create( |
||||||
argc, |
argc, |
||||||
argv, |
argv, |
||||||
"no.sout.juci"); |
"no.sout.juci"); |
||||||
|
// app->set_flags(Gio::APPLICATION_NON_UNIQUE);
|
||||||
|
|
||||||
Window window; |
Window window; |
||||||
return app->run(window); |
return app->run(window); |
||||||
} |
} |
||||||
|
|||||||
@ -1,47 +1,44 @@ |
|||||||
#include "source.h" |
#include "source.h" |
||||||
#include <iostream> |
#include <iostream> |
||||||
|
|
||||||
using namespace std; |
|
||||||
|
|
||||||
|
|
||||||
//////////////
|
//////////////
|
||||||
//// View ////
|
//// View ////
|
||||||
//////////////
|
//////////////
|
||||||
Source::View::View() { |
Source::View::View() { |
||||||
cout << "View construktor run" << endl; |
std::cout << "View constructor run" << std::endl; |
||||||
} |
} |
||||||
|
|
||||||
void Source::View::UpdateLine(Glib::RefPtr<Gtk::TextBuffer::Mark> mark) { |
void Source::View::UpdateLine(Glib::RefPtr<Gtk::TextBuffer::Mark> mark) { |
||||||
cout << "Update line called. linum: " << mark->get_iter().get_line() << endl; |
std::cout << "Update line called. linum: "; |
||||||
|
std::cout << mark->get_iter().get_line() << std::endl; |
||||||
} |
} |
||||||
|
|
||||||
///////////////
|
///////////////
|
||||||
//// Model ////
|
//// Model ////
|
||||||
///////////////
|
///////////////
|
||||||
Source::Model::Model() { |
Source::Model::Model() { |
||||||
cout << "Model construktor run" << endl; |
std::cout << "Model constructor run" << std::endl; |
||||||
} |
} |
||||||
|
|
||||||
////////////////////
|
////////////////////
|
||||||
//// Controller ////
|
//// Controller ////
|
||||||
////////////////////
|
////////////////////
|
||||||
|
|
||||||
/**
|
// Source::Controller::Controller()
|
||||||
* |
// Constructor for Controller
|
||||||
*/ |
|
||||||
Source::Controller::Controller() { |
Source::Controller::Controller() { |
||||||
cout << "Controller construktor run" << endl; |
std::cout << "Controller constructor run" << std::endl; |
||||||
} |
} |
||||||
/**
|
// Source::Controller::view()
|
||||||
* |
// return shared_ptr to the view
|
||||||
*/ |
Source::View& Source::Controller::view() { |
||||||
std::shared_ptr<Source::View> Source::Controller::sourceview() { |
return view_; |
||||||
sourceview(); |
|
||||||
return std::shared_ptr<Source::View>(&sourceview_); |
|
||||||
} |
} |
||||||
/**
|
// Source::Controller::model()
|
||||||
* |
// return shared_ptr to the model()
|
||||||
*/ |
Source::Model& Source::Controller::model() { |
||||||
void Source::Controller::OnLineEdit(Glib::RefPtr<Gtk::TextBuffer::Mark> mark){ |
return model_; |
||||||
|
|
||||||
} |
} |
||||||
|
// Source::Controller::OnLineEdit()
|
||||||
|
// fired when a line in the buffer is edited
|
||||||
|
void Source::Controller::OnLineEdit(Glib::RefPtr<Gtk::TextBuffer::Mark> mark) {} |
||||||
|
|||||||
@ -1,18 +1,27 @@ |
|||||||
#include "juci.h" |
#include "juci.h" |
||||||
|
|
||||||
Window::Window() : |
Window::Window() : |
||||||
window_box_(Gtk::ORIENTATION_HORIZONTAL), |
window_box_(Gtk::ORIENTATION_VERTICAL), |
||||||
menu_(keybindings_) { |
menu_(keybindings_) { |
||||||
set_title("example juCi++"); |
set_title("juCi++"); |
||||||
set_default_size(600, 600); |
set_default_size(600, 600); |
||||||
// window_box_.add(*source_.sourceview());
|
|
||||||
add(window_box_); |
add(window_box_); |
||||||
|
keybindings_.action_group()->add(Gtk::Action::create("FileQuit", |
||||||
|
Gtk::Stock::QUIT), |
||||||
|
[this]() { |
||||||
|
OnSystemQuit(); |
||||||
|
}); |
||||||
|
|
||||||
add_accel_group(keybindings_.ui_manager()->get_accel_group()); |
add_accel_group(keybindings_.ui_manager()->get_accel_group()); |
||||||
window_box_.pack_start(menu_.view()); |
window_box_.pack_start(menu_.view(), Gtk::PACK_SHRINK); |
||||||
|
window_box_.pack_start(source().view()); |
||||||
show_all_children(); |
show_all_children(); |
||||||
|
} |
||||||
|
|
||||||
|
Source::Controller& Window::source() { |
||||||
|
return source_; |
||||||
} |
} |
||||||
|
|
||||||
std::shared_ptr<Source::Controller> Window::source() { |
void Window::OnSystemQuit() { |
||||||
return std::shared_ptr<Source::Controller>(&source_); |
hide(); |
||||||
} |
} |
||||||
|
|||||||
Loading…
Reference in new issue