mirror of https://gitlab.com/cppit/jucipp
8 changed files with 185 additions and 134 deletions
@ -1,9 +1,18 @@ |
|||||||
#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, argv, "no.sout.juci"); |
argc, |
||||||
|
argv, |
||||||
|
"no.sout.juci" |
||||||
|
); |
||||||
Window window; |
Window window; |
||||||
|
|
||||||
return app->run(window);; |
return app->run(window);; |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
////////////////
|
||||||
|
//// Window ////
|
||||||
|
////////////////
|
||||||
|
std::shared_ptr<Source::Controller> Window::source() { |
||||||
|
return std::shared_ptr<Source::Controller>(&source_); |
||||||
} |
} |
||||||
|
|||||||
@ -1,25 +1,23 @@ |
|||||||
/*juCi++ main header file*/ |
/*juCi++ main header file*/ |
||||||
#ifndef JUCI_H |
#ifndef JUCI_JUCI_H_ |
||||||
#define JUCI_H |
#define JUCI_JUCI_H_ |
||||||
|
|
||||||
#include <iostream> |
#include <iostream> |
||||||
#include "gtkmm.h" |
#include "gtkmm.h" |
||||||
#include "menu.h" |
#include "menu.h" |
||||||
|
#include "source.h" |
||||||
|
|
||||||
class Window : public Gtk::Window { |
class Window : public Gtk::Window { |
||||||
public: |
public: |
||||||
Window(); |
Window(); |
||||||
|
virtual ~Window(){}; |
||||||
virtual ~Window(); |
|
||||||
|
|
||||||
Gtk::Box window_box_; |
Gtk::Box window_box_; |
||||||
|
std::shared_ptr<Source::Controller> source(); |
||||||
private: |
private: |
||||||
Menu::Controller menu; |
Menu::Controller menu; |
||||||
|
Source::Controller source_; |
||||||
/*signal handler*/ |
/*signal handler*/ |
||||||
void onSystemQuit(); |
void onSystemQuit(); |
||||||
|
|
||||||
}; |
}; |
||||||
|
|
||||||
#endif // JUCI_H
|
#endif // JUCI_JUCI_H_
|
||||||
|
|||||||
@ -1,90 +1,65 @@ |
|||||||
|
#ifndef JUCI_MENU_H_ |
||||||
|
#define JUCI_MENU_H_ |
||||||
|
|
||||||
#include <iostream> |
#include <iostream> |
||||||
#include "gtkmm.h" |
#include "gtkmm.h" |
||||||
namespace Menu { |
namespace Menu { |
||||||
class Model { |
class Model { |
||||||
public: |
public: |
||||||
Model(); |
Model(); |
||||||
|
|
||||||
virtual~Model(); |
virtual~Model(); |
||||||
|
std::string ui_string() { return ui_string_; } |
||||||
std::string ui_string() { |
|
||||||
return ui_string_; |
|
||||||
}; |
|
||||||
private: |
private: |
||||||
std::string ui_string_; |
std::string ui_string_; |
||||||
}; |
}; // class Model
|
||||||
|
|
||||||
|
|
||||||
class View { |
class View { |
||||||
public: |
public: |
||||||
View(Gtk::Orientation orient); |
explicit View(Gtk::Orientation orient); |
||||||
|
|
||||||
virtual ~View(); |
virtual ~View(); |
||||||
|
Glib::RefPtr<Gtk::Box> view(); |
||||||
Gtk::Box &view(); |
|
||||||
|
|
||||||
Glib::RefPtr <Gtk::ActionGroup> action_group() { |
Glib::RefPtr <Gtk::ActionGroup> action_group() { |
||||||
return action_group_; |
return action_group_; |
||||||
}; |
} |
||||||
|
|
||||||
Glib::RefPtr <Gtk::UIManager> ui_manager() { |
Glib::RefPtr <Gtk::UIManager> ui_manager() { |
||||||
return ui_manager_; |
return ui_manager_; |
||||||
}; |
} |
||||||
|
|
||||||
void set_ui_manger_string(std::string ui_string); |
void set_ui_manger_string(std::string ui_string); |
||||||
|
void set_ui_manager_action_group( |
||||||
void set_ui_manager_action_group(Glib::RefPtr <Gtk::ActionGroup> action_group); |
Glib::RefPtr<Gtk::ActionGroup> action_group); |
||||||
|
|
||||||
protected: |
protected: |
||||||
Gtk::Box view_; |
Gtk::Box view_; |
||||||
Glib::RefPtr <Gtk::UIManager> ui_manager_; |
Glib::RefPtr <Gtk::UIManager> ui_manager_; |
||||||
Glib::RefPtr <Gtk::ActionGroup> action_group_; |
Glib::RefPtr <Gtk::ActionGroup> action_group_; |
||||||
}; |
}; // class View
|
||||||
|
// controller
|
||||||
class Controller { |
class Controller { |
||||||
public: |
public: |
||||||
Controller(); |
Controller(); |
||||||
|
|
||||||
virtual ~Controller(); |
virtual ~Controller(); |
||||||
|
Glib::RefPtr<Gtk::Box> view(); |
||||||
Gtk::Box &view(); |
|
||||||
|
|
||||||
Glib::RefPtr <Gtk::UIManager> ui_manager() { |
Glib::RefPtr <Gtk::UIManager> ui_manager() { |
||||||
return menu_view_.ui_manager(); |
return menu_view_.ui_manager(); |
||||||
}; |
} |
||||||
|
|
||||||
private: |
private: |
||||||
Menu::View menu_view_; |
View menu_view_; |
||||||
Menu::Model menu_model_; |
Model menu_model_; |
||||||
|
void onFileNewEmptyfile(); /*Signal handlers*/ |
||||||
/*Signal handlers*/ |
|
||||||
void onFileNewEmptyfile(); |
|
||||||
|
|
||||||
void onFileNewCCFile(); |
void onFileNewCCFile(); |
||||||
|
|
||||||
void onFileNewHeaderFile(); |
void onFileNewHeaderFile(); |
||||||
|
|
||||||
void onFileOpenFile(); |
void onFileOpenFile(); |
||||||
|
|
||||||
void onFileOpenFolder(); |
void onFileOpenFolder(); |
||||||
|
|
||||||
void onSystemQuit(); |
void onSystemQuit(); |
||||||
|
|
||||||
void onPluginAddSnippet(); |
void onPluginAddSnippet(); |
||||||
|
|
||||||
void onWindowCloseTab(); |
void onWindowCloseTab(); |
||||||
|
|
||||||
void onEditCopy(); |
void onEditCopy(); |
||||||
|
|
||||||
void onEditCut(); |
void onEditCut(); |
||||||
|
|
||||||
void onEditPaste(); |
void onEditPaste(); |
||||||
|
|
||||||
void onEditFind(); |
void onEditFind(); |
||||||
|
|
||||||
void onWindowSplitWindow(); |
void onWindowSplitWindow(); |
||||||
|
|
||||||
void onHelpAbout(); |
void onHelpAbout(); |
||||||
|
}; // class Controller
|
||||||
}; |
} // namespace Menu
|
||||||
} |
#endif // JUCI_MENU_H_
|
||||||
|
|||||||
@ -0,0 +1,47 @@ |
|||||||
|
#include "source.h" |
||||||
|
#include <iostream> |
||||||
|
|
||||||
|
using namespace std; |
||||||
|
|
||||||
|
|
||||||
|
//////////////
|
||||||
|
//// View ////
|
||||||
|
//////////////
|
||||||
|
Source::View::View() { |
||||||
|
cout << "View construktor run" << endl; |
||||||
|
} |
||||||
|
|
||||||
|
void Source::View::UpdateLine(Glib::RefPtr<Gtk::TextBuffer::Mark> mark) { |
||||||
|
cout << "Update line called. linum: " << mark->get_iter().get_line() << endl; |
||||||
|
} |
||||||
|
|
||||||
|
///////////////
|
||||||
|
//// Model ////
|
||||||
|
///////////////
|
||||||
|
Source::Model::Model(){ |
||||||
|
cout << "Model construktor run" << endl; |
||||||
|
} |
||||||
|
|
||||||
|
////////////////////
|
||||||
|
//// Controller ////
|
||||||
|
////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
* |
||||||
|
*/ |
||||||
|
Source::Controller::Controller() { |
||||||
|
cout << "Controller construktor run" << endl; |
||||||
|
} |
||||||
|
/**
|
||||||
|
* |
||||||
|
*/ |
||||||
|
std::shared_ptr<Source::View> Source::Controller::sourceview() { |
||||||
|
sourceview(); |
||||||
|
return std::shared_ptr<Source::View>(&sourceview_); |
||||||
|
} |
||||||
|
/**
|
||||||
|
* |
||||||
|
*/ |
||||||
|
void Source::Controller::OnLineEdit(Glib::RefPtr<Gtk::TextBuffer::Mark> mark){ |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,31 @@ |
|||||||
|
#ifndef JUCI_SOURCE_H_ |
||||||
|
#define JUCI_SOURCE_H_ |
||||||
|
|
||||||
|
#include <iostream> |
||||||
|
#include "gtkmm.h" |
||||||
|
|
||||||
|
namespace Source { |
||||||
|
class View : public Gtk::TextView { |
||||||
|
public: |
||||||
|
View(); |
||||||
|
void UpdateLine(Glib::RefPtr<Gtk::TextBuffer::Mark> mark); |
||||||
|
private: |
||||||
|
void UpdateSyntaxHighlighting(int line_number); |
||||||
|
}; |
||||||
|
|
||||||
|
class Model{ |
||||||
|
public: |
||||||
|
Model(); |
||||||
|
}; |
||||||
|
|
||||||
|
class Controller { |
||||||
|
public: |
||||||
|
Controller(); |
||||||
|
std::shared_ptr<Source::View> sourceview(); |
||||||
|
private: |
||||||
|
void OnLineEdit(Glib::RefPtr<Gtk::TextBuffer::Mark> mark); |
||||||
|
protected: |
||||||
|
View sourceview_; |
||||||
|
}; // class Controller
|
||||||
|
} // namespace Source
|
||||||
|
#endif // JUCI_SOURCE_H_
|
||||||
Loading…
Reference in new issue