Browse Source

Fix semantic errors

master
Jørgen Lien Sellæg 11 years ago
parent
commit
8caba58f66
  1. 4
      juci/CMakeLists.txt
  2. 17
      juci/juci.cc
  3. 16
      juci/juci.h
  4. 11
      juci/menu.cc
  5. 67
      juci/menu.h
  6. 47
      juci/source.cc
  7. 31
      juci/source.h
  8. 16
      juci/window.cc

4
juci/CMakeLists.txt

@ -64,9 +64,9 @@ endif()
add_executable(${project_name}
# list of every needed file to create the executable
menu.h
menu.cc
source.h
source.cc
window.cc
juci.cc
)

17
juci/juci.cc

@ -1,9 +1,18 @@
#include "juci.h"
int main(int argc, char *argv[]) {
Glib::RefPtr<Gtk::Application> app = Gtk::Application::create(argc, argv, "no.sout.juci");
Glib::RefPtr<Gtk::Application> app = Gtk::Application::create(
argc,
argv,
"no.sout.juci"
);
Window window;
return app->run(window);;
}
////////////////
//// Window ////
////////////////
std::shared_ptr<Source::Controller> Window::source() {
return std::shared_ptr<Source::Controller>(&source_);
}

16
juci/juci.h

@ -1,25 +1,23 @@
/*juCi++ main header file*/
#ifndef JUCI_H
#define JUCI_H
#ifndef JUCI_JUCI_H_
#define JUCI_JUCI_H_
#include <iostream>
#include "gtkmm.h"
#include "menu.h"
#include "source.h"
class Window : public Gtk::Window {
public:
Window();
virtual ~Window();
virtual ~Window(){};
Gtk::Box window_box_;
std::shared_ptr<Source::Controller> source();
private:
Menu::Controller menu;
Source::Controller source_;
/*signal handler*/
void onSystemQuit();
};
#endif // JUCI_H
#endif // JUCI_JUCI_H_

11
juci/menu.cc

@ -68,13 +68,14 @@ void Menu::View::set_ui_manger_string(std::string ui_string) {
}
}
void Menu::View::set_ui_manager_action_group(Glib::RefPtr<Gtk::ActionGroup> action_group) {
void Menu::View::set_ui_manager_action_group(Glib::RefPtr<Gtk::ActionGroup>
action_group) {
ui_manager_->insert_action_group(action_group);
}
Gtk::Box &Menu::View::view() {
Glib::RefPtr<Gtk::Box> Menu::View::view() {
view_.pack_start(*ui_manager_->get_widget("/MenuBar"), Gtk::PACK_SHRINK);
return view_;
return Glib::RefPtr<Gtk::Box>(&view_);
}
@ -184,7 +185,7 @@ Menu::Controller::~Controller() {
}
Gtk::Box &Menu::Controller::view() {
Glib::RefPtr<Gtk::Box> Menu::Controller::view() {
return menu_view_.view();
}
@ -204,7 +205,7 @@ void Menu::Controller::onFileNewHeaderFile() {
void Menu::Controller::onSystemQuit(){
//TODO(Oyvang, Zalox, Forgie) Add everything that needs to be done before quiting
/*Quit the system*/
Gtk::Main::quit(); //TODO(Oyvang, Zalox, Forgie) methode is depricated, find a better solution.
}
void Menu::Controller::onPluginAddSnippet() {
std::cout << "Add snipper" << std::endl; //TODO(Forgi add you snippet magic code)

67
juci/menu.h

@ -1,90 +1,65 @@
#ifndef JUCI_MENU_H_
#define JUCI_MENU_H_
#include <iostream>
#include "gtkmm.h"
namespace Menu {
class Model {
public:
Model();
virtual~Model();
std::string ui_string() {
return ui_string_;
};
std::string ui_string() { return ui_string_; }
private:
std::string ui_string_;
};
}; // class Model
class View {
public:
View(Gtk::Orientation orient);
explicit View(Gtk::Orientation orient);
virtual ~View();
Gtk::Box &view();
Glib::RefPtr<Gtk::Box> view();
Glib::RefPtr <Gtk::ActionGroup> action_group() {
return action_group_;
};
}
Glib::RefPtr <Gtk::UIManager> ui_manager() {
return ui_manager_;
};
}
void set_ui_manger_string(std::string ui_string);
void set_ui_manager_action_group(Glib::RefPtr <Gtk::ActionGroup> action_group);
void set_ui_manager_action_group(
Glib::RefPtr<Gtk::ActionGroup> action_group);
protected:
Gtk::Box view_;
Glib::RefPtr <Gtk::UIManager> ui_manager_;
Glib::RefPtr <Gtk::ActionGroup> action_group_;
};
}; // class View
// controller
class Controller {
public:
Controller();
virtual ~Controller();
Gtk::Box &view();
Glib::RefPtr<Gtk::Box> view();
Glib::RefPtr <Gtk::UIManager> ui_manager() {
return menu_view_.ui_manager();
};
}
private:
Menu::View menu_view_;
Menu::Model menu_model_;
/*Signal handlers*/
void onFileNewEmptyfile();
View menu_view_;
Model menu_model_;
void onFileNewEmptyfile(); /*Signal handlers*/
void onFileNewCCFile();
void onFileNewHeaderFile();
void onFileOpenFile();
void onFileOpenFolder();
void onSystemQuit();
void onPluginAddSnippet();
void onWindowCloseTab();
void onEditCopy();
void onEditCut();
void onEditPaste();
void onEditFind();
void onWindowSplitWindow();
void onHelpAbout();
};
}
}; // class Controller
} // namespace Menu
#endif // JUCI_MENU_H_

47
juci/source.cc

@ -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){
}

31
juci/source.h

@ -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_

16
juci/window.cc

@ -2,25 +2,15 @@
Window::Window() :
window_box_(Gtk::ORIENTATION_HORIZONTAL),
menu() {
menu(),
source_() {
set_title("example juCi++");
set_default_size(600, 600);
// window_box_.add(*source_.sourceview());
add(window_box_);
add_accel_group(menu.ui_manager()->get_accel_group());
window_box_.pack_start(menu.view());
show_all_children();
};
Window::~Window() {
}

Loading…
Cancel
Save