2008-04-11 21:28:15 +02:00
|
|
|
/*
|
2008-04-11 23:04:39 +02:00
|
|
|
Actions.cpp - Definition of the main workspace window object
|
|
|
|
|
|
|
|
|
|
Copyright (C) Lumiera.org
|
|
|
|
|
2008, Joel Holdsworth <joel@airwebreathe.org.uk>
|
|
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
|
|
|
modify it under the terms of the GNU General Public License as
|
|
|
|
|
published by the Free Software Foundation; either version 2 of the
|
|
|
|
|
License, or (at your option) any later version.
|
|
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
|
|
|
|
|
|
* *****************************************************/
|
2008-04-11 21:28:15 +02:00
|
|
|
|
2008-04-12 18:46:32 +02:00
|
|
|
#include "../gtk-lumiera.hpp"
|
2008-04-11 21:28:15 +02:00
|
|
|
#include "actions.hpp"
|
2008-04-14 23:51:59 +02:00
|
|
|
#include "main-window.hpp"
|
2008-04-11 21:28:15 +02:00
|
|
|
|
2008-04-16 23:50:01 +02:00
|
|
|
#include "../dialogs/render.hpp"
|
|
|
|
|
|
2008-04-16 19:24:11 +02:00
|
|
|
using namespace Gtk;
|
|
|
|
|
using namespace Glib;
|
2008-04-16 23:50:01 +02:00
|
|
|
using namespace lumiera::gui;
|
2008-04-16 19:24:11 +02:00
|
|
|
|
2008-04-12 18:46:32 +02:00
|
|
|
namespace lumiera {
|
|
|
|
|
namespace gui {
|
|
|
|
|
namespace workspace {
|
2008-04-11 21:28:15 +02:00
|
|
|
|
2008-04-11 23:04:39 +02:00
|
|
|
Actions::Actions(MainWindow &main_window) :
|
|
|
|
|
mainWindow(main_window)
|
|
|
|
|
{
|
2008-04-16 23:50:01 +02:00
|
|
|
actionGroup = ActionGroup::create();
|
2008-04-16 19:24:11 +02:00
|
|
|
|
|
|
|
|
// File menu:
|
2008-04-16 23:50:01 +02:00
|
|
|
actionGroup->add(Action::create("FileMenu", _("_File")));
|
|
|
|
|
actionGroup->add(Action::create("FileNewProject", Stock::NEW, _("_New Project...")),
|
2008-04-16 20:48:54 +02:00
|
|
|
sigc::mem_fun(*this, &Actions::on_menu_file_new_project));
|
2008-04-16 23:50:01 +02:00
|
|
|
actionGroup->add(Action::create("FileOpenProject", Stock::OPEN, _("_Open Project...")),
|
|
|
|
|
sigc::mem_fun(*this, &Actions::on_menu_file_open_project));
|
|
|
|
|
actionGroup->add(Action::create("FileRender", _("_Render...")),
|
2008-04-16 19:24:11 +02:00
|
|
|
Gtk::AccelKey("<shift>R"),
|
|
|
|
|
sigc::mem_fun(*this, &Actions::on_menu_file_render));
|
2008-04-16 23:50:01 +02:00
|
|
|
actionGroup->add(Action::create("FileQuit", Stock::QUIT),
|
2008-04-16 19:24:11 +02:00
|
|
|
sigc::mem_fun(*this, &Actions::on_menu_file_quit));
|
|
|
|
|
|
|
|
|
|
// Edit menu:
|
2008-04-16 23:50:01 +02:00
|
|
|
actionGroup->add(Action::create("EditMenu", _("_Edit")));
|
|
|
|
|
actionGroup->add(Action::create("EditCopy", Stock::COPY),
|
2008-04-16 20:48:54 +02:00
|
|
|
sigc::mem_fun(*this, &Actions::on_menu_others));
|
2008-04-16 23:50:01 +02:00
|
|
|
actionGroup->add(Action::create("EditPaste", Stock::PASTE),
|
2008-04-16 19:24:11 +02:00
|
|
|
sigc::mem_fun(*this, &Actions::on_menu_others));
|
|
|
|
|
|
|
|
|
|
// Help menu:
|
2008-04-16 23:50:01 +02:00
|
|
|
actionGroup->add(Action::create("HelpMenu", _("_Help")) );
|
|
|
|
|
actionGroup->add(Action::create("HelpAbout", Stock::ABOUT),
|
2008-04-16 19:24:11 +02:00
|
|
|
sigc::mem_fun(*this, &Actions::on_menu_help_about) );
|
2008-04-11 23:04:39 +02:00
|
|
|
}
|
2008-04-11 21:28:15 +02:00
|
|
|
|
2008-04-16 23:50:01 +02:00
|
|
|
/* ===== File Menu Event Handlers ===== */
|
|
|
|
|
|
2008-04-16 20:48:54 +02:00
|
|
|
void
|
|
|
|
|
Actions::on_menu_file_new_project()
|
|
|
|
|
{
|
|
|
|
|
g_message("A File|New menu item was selecteda.");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
Actions::on_menu_file_open_project()
|
|
|
|
|
{
|
|
|
|
|
g_message("A File|Open menu item was selecteda.");
|
|
|
|
|
}
|
|
|
|
|
|
2008-04-12 18:46:32 +02:00
|
|
|
void
|
|
|
|
|
Actions::on_menu_file_render()
|
|
|
|
|
{
|
2008-04-16 23:50:01 +02:00
|
|
|
dialogs::Render dialog(mainWindow);
|
|
|
|
|
dialog.run();
|
2008-04-12 18:46:32 +02:00
|
|
|
}
|
|
|
|
|
|
2008-04-11 23:04:39 +02:00
|
|
|
void
|
|
|
|
|
Actions::on_menu_file_quit()
|
|
|
|
|
{
|
|
|
|
|
mainWindow.hide(); // Closes the main window to stop the Gtk::Main::run().
|
|
|
|
|
}
|
2008-04-11 21:28:15 +02:00
|
|
|
|
2008-04-16 19:24:11 +02:00
|
|
|
void
|
|
|
|
|
Actions::on_menu_help_about()
|
|
|
|
|
{
|
|
|
|
|
// Configure the about dialog
|
|
|
|
|
AboutDialog dialog;
|
|
|
|
|
|
2008-04-18 22:35:10 +02:00
|
|
|
//dialog.set_program_name(AppTitle);
|
2008-04-16 19:24:11 +02:00
|
|
|
dialog.set_version(AppVersion);
|
|
|
|
|
//dialog.set_version(Appconfig::get("version"));
|
|
|
|
|
dialog.set_copyright(AppCopyright);
|
|
|
|
|
dialog.set_website(AppWebsite);
|
|
|
|
|
dialog.set_authors(StringArrayHandle(AppAuthors,
|
|
|
|
|
sizeof(AppAuthors) / sizeof(gchar*),
|
|
|
|
|
OWNERSHIP_NONE));
|
|
|
|
|
|
|
|
|
|
dialog.set_transient_for(mainWindow);
|
|
|
|
|
|
|
|
|
|
// Show the about dialog
|
|
|
|
|
dialog.run();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//----- Temporary junk
|
2008-04-11 23:04:39 +02:00
|
|
|
void
|
|
|
|
|
Actions::on_menu_others()
|
|
|
|
|
{
|
2008-04-11 21:28:15 +02:00
|
|
|
g_message("A menu item was selected.");
|
2008-04-11 23:04:39 +02:00
|
|
|
}
|
2008-04-11 21:28:15 +02:00
|
|
|
|
2008-04-11 23:04:39 +02:00
|
|
|
} // namespace workspace
|
2008-04-12 18:46:32 +02:00
|
|
|
} // namespace gui
|
2008-04-11 23:04:39 +02:00
|
|
|
} // namespace lumiera
|
2008-04-11 21:28:15 +02:00
|
|
|
|