Browse Source

dunno what i have done

merge-requests/365/head
oyvang 11 years ago
parent
commit
012754cfe2
  1. 1
      juci/juci.cc
  2. 3
      juci/keybindings.cc
  3. 15
      juci/menu.cc
  4. 2
      juci/menu.h
  5. 5
      juci/window.cc

1
juci/juci.cc

@ -7,7 +7,6 @@ int main(int argc, char *argv[]) {
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);

3
juci/keybindings.cc

@ -4,11 +4,14 @@
Keybindings::Controller::Controller() { Keybindings::Controller::Controller() {
action_group_ = Gtk::ActionGroup::create(); action_group_ = Gtk::ActionGroup::create();
ui_manager_ = Gtk::UIManager::create(); ui_manager_ = Gtk::UIManager::create();
} }
Keybindings::Controller::~Controller(){ Keybindings::Controller::~Controller(){
} }
void Keybindings::Controller::set_ui_manager_action_group(Glib::RefPtr<Gtk::ActionGroup> action_group) { void Keybindings::Controller::set_ui_manager_action_group(Glib::RefPtr<Gtk::ActionGroup> action_group) {
ui_manager_->insert_action_group(action_group); ui_manager_->insert_action_group(action_group);
} }
void Keybindings::Controller::set_ui_manger_string(std::string ui_string) { void Keybindings::Controller::set_ui_manger_string(std::string ui_string) {

15
juci/menu.cc

@ -38,6 +38,7 @@ Menu::Model::Model() {
" </menu> " " </menu> "
" <menu action='HelpMenu'> " " <menu action='HelpMenu'> "
" <menuitem action='HelpAbout'/> " " <menuitem action='HelpAbout'/> "
" <menuitem action='HelpHide'/> "
" </menu> " " </menu> "
" </menubar> " " </menubar> "
"</ui> "; "</ui> ";
@ -81,14 +82,12 @@ Menu::Controller::Controller(Keybindings::Controller keybindings) :
[this]() { [this]() {
OnFileNewEmptyfile(); OnFileNewEmptyfile();
}); });
keybindings_.action_group()->add(Gtk::Action::create("FileNewCC", keybindings_.action_group()->add(Gtk::Action::create("FileNewCC", "New cc file"),
Gtk::Stock::NEW, "New cc file", "Create a new cc file"),
Gtk::AccelKey("<control><alt>c"), Gtk::AccelKey("<control><alt>c"),
[this]() { [this]() {
OnFileNewCCFile(); OnFileNewCCFile();
}); });
keybindings_.action_group()->add(Gtk::Action::create("FileNewH", keybindings_.action_group()->add(Gtk::Action::create("FileNewH","New h file" ),
Gtk::Stock::NEW, "New h file", "Create a new h file"),
Gtk::AccelKey("<control><alt>h"), Gtk::AccelKey("<control><alt>h"),
[this]() { [this]() {
OnFileNewHeaderFile(); OnFileNewHeaderFile();
@ -152,6 +151,12 @@ Menu::Controller::Controller(Keybindings::Controller keybindings) :
[this]() { [this]() {
OnHelpAbout(); OnHelpAbout();
}); });
keybindings_.action_group()->add(Gtk::Action::create("HelpHide"),
Gtk::AccelKey("<control><alt>K"),
[this]() {
OnHelpAbout();
});
/* END help menu */ /* END help menu */
@ -159,6 +164,8 @@ Menu::Controller::Controller(Keybindings::Controller keybindings) :
keybindings_.ui_manager()->add_ui_from_string(menu_model_.ui_string()); keybindings_.ui_manager()->add_ui_from_string(menu_model_.ui_string());
keybindings_.ui_manager()->insert_action_group(keybindings_.action_group()); keybindings_.ui_manager()->insert_action_group(keybindings_.action_group());
} }
Menu::Controller::~Controller() { Menu::Controller::~Controller() {

2
juci/menu.h

@ -31,6 +31,8 @@ namespace Menu {
protected: protected:
Gtk::Box view_; Gtk::Box view_;
}; // class View }; // class View
// controller // controller
class Controller { class Controller {
public: public:

5
juci/window.cc

@ -2,7 +2,7 @@
Window::Window() : Window::Window() :
window_box_(Gtk::ORIENTATION_VERTICAL), window_box_(Gtk::ORIENTATION_VERTICAL),
menu_(keybindings_) { menu_(keybindings_){
set_title("juCi++"); set_title("juCi++");
set_default_size(600, 600); set_default_size(600, 600);
add(window_box_); add(window_box_);
@ -16,6 +16,9 @@ Window::Window() :
window_box_.pack_start(menu_.view(), Gtk::PACK_SHRINK); window_box_.pack_start(menu_.view(), Gtk::PACK_SHRINK);
window_box_.pack_start(source().view()); window_box_.pack_start(source().view());
show_all_children(); show_all_children();
//TODO(Oyvang, Forgi, Zalox) Find a better solution to hide menu items and still have the keybinding
keybindings_.action_group()->get_action("HelpHide")->set_visible(false);
show();
} }
Source::Controller& Window::source() { Source::Controller& Window::source() {

Loading…
Cancel
Save