Project properties dialog

This commit is contained in:
Nedko Arnaudov 2008-07-04 22:47:59 +03:00
parent 9d76692e72
commit 0b02ba8c5f
10 changed files with 334 additions and 16 deletions

View File

@ -21,6 +21,9 @@ patchage_SOURCES = \
Widget.hpp \
main.cpp
patchage_SOURCES += common.hpp
patchage_SOURCES += globals.hpp
AM_CXXFLAGS += @DBUS_CFLAGS@
patchage_SOURCES += jack_proxy.cpp
patchage_SOURCES += jack_proxy.hpp
@ -37,3 +40,6 @@ patchage_SOURCES += project.hpp
patchage_SOURCES += session.cpp
patchage_SOURCES += session.hpp
patchage_SOURCES += project_properties.cpp
patchage_SOURCES += project_properties.hpp

View File

@ -29,7 +29,6 @@
#include CONFIG_H_PATH
#include "common.hpp"
#include "GladeFile.hpp"
#include "jack_proxy.hpp"
#include "JackSettingsDialog.hpp"
#include "Patchage.hpp"
@ -38,6 +37,7 @@
#include "lash_proxy.hpp"
#include "project_list.hpp"
#include "session.hpp"
#include "globals.hpp"
//#define LOG_TO_STD
#define LOG_TO_STATUS
@ -77,11 +77,10 @@ gtkmm_set_width_for_given_text (Gtk::Widget &w, const gchar *text,
/* end Gtk helpers */
#define INIT_WIDGET(x) x(xml, ((const char*)#x) + 1)
#define INIT_WIDGET(x) x(g_xml, ((const char*)#x) + 1)
Patchage::Patchage(int argc, char** argv)
: xml(GladeFile::open("patchage"))
, INIT_WIDGET(_menu_open_session)
: INIT_WIDGET(_menu_open_session)
, INIT_WIDGET(_menu_save_session)
, INIT_WIDGET(_menu_save_session_as)
, INIT_WIDGET(_menu_close_session)
@ -212,7 +211,7 @@ Patchage::Patchage(int argc, char** argv)
_session = new session();
_project_list = new project_list(xml, this, _session);
_project_list = new project_list(this, _session);
_lash = new lash_proxy(this, _session);
@ -700,12 +699,11 @@ class load_project_dialog
{
public:
load_project_dialog(
Glib::RefPtr<Gnome::Glade::Xml> xml,
Patchage *app)
: _app(app)
{
_dialog.init(xml, "load_project_dialog");
_widget.init(xml, "loadable_projects_list");
_dialog.init(g_xml, "load_project_dialog");
_widget.init(g_xml, "loadable_projects_list");
_columns.add(_columns.name);
_columns.add(_columns.modified);
@ -806,7 +804,7 @@ void
Patchage::load_project_ask()
{
std::list<lash_project_info> projects;
load_project_dialog dialog(xml, this);
load_project_dialog dialog(this);
_lash->get_available_projects(projects);

View File

@ -121,8 +121,6 @@ protected:
void buffer_size_changed();
Glib::RefPtr<Gnome::Glade::Xml> xml;
Widget<Gtk::MenuItem> _menu_open_session;
Widget<Gtk::MenuItem> _menu_save_session;
Widget<Gtk::MenuItem> _menu_save_session_as;

26
src/globals.hpp Normal file
View File

@ -0,0 +1,26 @@
// -*- Mode: C++ ; indent-tabs-mode: t -*-
/* This file is part of Patchage.
* Copyright (C) 2008 Nedko Arnaudov <nedko@arnaudov.name>
*
* Patchage 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.
*
* Patchage 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 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.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef GLOBALS_HPP__08F1016E_CB85_4758_B5CD_92E0C15F5568__INCLUDED
#define GLOBALS_HPP__08F1016E_CB85_4758_B5CD_92E0C15F5568__INCLUDED
#if defined(PATCHAGE_WIDGET_HPP)
extern Glib::RefPtr<Gnome::Glade::Xml> g_xml;
#endif
#endif // #ifndef GLOBALS_HPP__08F1016E_CB85_4758_B5CD_92E0C15F5568__INCLUDED

View File

@ -22,6 +22,10 @@
#include <glibmm/exception.h>
#include "Patchage.hpp"
#include "GladeFile.hpp"
#include "globals.hpp"
Glib::RefPtr<Gnome::Glade::Xml> g_xml;
int main(int argc, char** argv)
{
@ -31,6 +35,8 @@ int main(int argc, char** argv)
Gnome::Canvas::init();
Gtk::Main app(argc, argv);
g_xml = GladeFile::open("patchage");
Patchage patchage(argc, argv);
app.run(*patchage.window());

View File

@ -648,7 +648,164 @@ Nedko Arnaudov &lt;nedko@arnaudov.name&gt;</property>
</widget>
</child>
<child>
<widget class="GtkButton" id="button">
<widget class="GtkButton" id="ok_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">gtk-ok</property>
<property name="use_stock">True</property>
<property name="response_id">2</property>
</widget>
<packing>
<property name="position">1</property>
</packing>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="pack_type">GTK_PACK_END</property>
</packing>
</child>
</widget>
</child>
</widget>
<widget class="GtkDialog" id="project_properties_dialog">
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="border_width">5</property>
<property name="title" translatable="yes">Project properties</property>
<property name="modal">True</property>
<property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
<property name="transient_for">main_win</property>
<property name="has_separator">False</property>
<child internal-child="vbox">
<widget class="GtkVBox" id="dialog-vbox5">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="spacing">2</property>
<child>
<widget class="GtkVBox" id="vbox1">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="spacing">10</property>
<child>
<widget class="GtkFrame" id="frame1">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label_xalign">0</property>
<property name="shadow_type">GTK_SHADOW_NONE</property>
<child>
<widget class="GtkEntry" id="project_name">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
</widget>
</child>
<child>
<widget class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">&lt;b&gt;Project name&lt;/b&gt;</property>
<property name="use_markup">True</property>
</widget>
<packing>
<property name="type">label_item</property>
</packing>
</child>
</widget>
<packing>
<property name="expand">False</property>
</packing>
</child>
<child>
<widget class="GtkFrame" id="frame2">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label_xalign">0</property>
<property name="shadow_type">GTK_SHADOW_NONE</property>
<child>
<widget class="GtkEntry" id="short_comment">
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="text" translatable="yes">not implemented yet</property>
</widget>
</child>
<child>
<widget class="GtkLabel" id="label2">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">&lt;b&gt;Short comment&lt;/b&gt;</property>
<property name="use_markup">True</property>
</widget>
<packing>
<property name="type">label_item</property>
</packing>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="position">1</property>
</packing>
</child>
<child>
<widget class="GtkFrame" id="frame3">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label_xalign">0</property>
<property name="shadow_type">GTK_SHADOW_NONE</property>
<child>
<widget class="GtkTextView" id="long_comment">
<property name="width_request">300</property>
<property name="height_request">200</property>
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="text" translatable="yes">not implemented yet</property>
</widget>
</child>
<child>
<widget class="GtkLabel" id="label3">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">&lt;b&gt;Long comment&lt;/b&gt;</property>
<property name="use_markup">True</property>
</widget>
<packing>
<property name="type">label_item</property>
</packing>
</child>
</widget>
<packing>
<property name="position">2</property>
</packing>
</child>
</widget>
<packing>
<property name="position">1</property>
</packing>
</child>
<child internal-child="action_area">
<widget class="GtkHButtonBox" id="dialog-action_area5">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="layout_style">GTK_BUTTONBOX_END</property>
<child>
<widget class="GtkButton" id="cancel_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">gtk-cancel</property>
<property name="use_stock">True</property>
<property name="response_id">1</property>
</widget>
</child>
<child>
<widget class="GtkButton" id="ok_buton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>

View File

@ -26,6 +26,8 @@
#include "Patchage.hpp"
#include "session.hpp"
#include "project.hpp"
#include "project_properties.hpp"
#include "globals.hpp"
struct project_list_column_record : public Gtk::TreeModel::ColumnRecord
{
@ -55,15 +57,15 @@ struct project_list_impl : public sigc::trackable
void on_menu_popup_save_all_projects();
void on_menu_popup_save_project(const Glib::ustring& project_name);
void on_menu_popup_close_project(const Glib::ustring& project_name);
void on_menu_popup_project_properties(shared_ptr<project> project_ptr);
void on_menu_popup_close_all_projects();
};
project_list::project_list(
Glib::RefPtr<Gnome::Glade::Xml> xml,
Patchage * app,
session * session_ptr)
{
_impl_ptr = new project_list_impl(xml, app);
_impl_ptr = new project_list_impl(g_xml, app);
session_ptr->_signal_project_added.connect(mem_fun(_impl_ptr, &project_list_impl::project_added));
session_ptr->_signal_project_closed.connect(mem_fun(_impl_ptr, &project_list_impl::project_closed));
}
@ -120,7 +122,9 @@ project_list_impl::on_button_press_event(GdkEventButton * event_ptr)
selection->unselect_all();
selection->select(path);
Glib::ustring name = (*selection->get_selected())[_columns.name];
Gtk::TreeIter iter = selection->get_selected();
Glib::ustring name = (*iter)[_columns.name];
shared_ptr<project> project_ptr = (*iter)[_columns.project_ptr];
menulist.push_back(
Gtk::Menu_Helpers::MenuElem(
@ -138,6 +142,15 @@ project_list_impl::on_button_press_event(GdkEventButton * event_ptr)
*this,
&project_list_impl::on_menu_popup_close_project),
name)));
menulist.push_back(
Gtk::Menu_Helpers::MenuElem(
(string)"_Project '" + name + "' properties",
sigc::bind(
sigc::mem_fun(
*this,
&project_list_impl::on_menu_popup_project_properties),
project_ptr)));
}
else
{
@ -181,6 +194,15 @@ project_list_impl::on_menu_popup_close_project(
_app->close_project(project_name);
}
void
project_list_impl::on_menu_popup_project_properties(
shared_ptr<project> project_ptr)
{
project_properties_dialog dialog;
dialog.run(project_ptr);
}
void
project_list_impl::on_menu_popup_close_all_projects()
{

View File

@ -27,7 +27,6 @@ class project_list
{
public:
project_list(
Glib::RefPtr<Gnome::Glade::Xml> xml,
Patchage* app,
session * session_ptr);

View File

@ -0,0 +1,70 @@
// -*- Mode: C++ ; indent-tabs-mode: t -*-
/* This file is part of Patchage.
* Copyright (C) 2008 Nedko Arnaudov <nedko@arnaudov.name>
*
* Patchage 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.
*
* Patchage 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 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.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <gtkmm.h>
#include <libglademm/xml.h>
#include "common.hpp"
#include "project.hpp"
#include "project_properties.hpp"
#include "Widget.hpp"
#include "globals.hpp"
struct project_properties_dialog_impl
{
Widget<Gtk::Dialog> _dialog;
Widget<Gtk::Entry> _name;
project_properties_dialog_impl();
};
project_properties_dialog::project_properties_dialog()
{
_impl_ptr = new project_properties_dialog_impl;
}
project_properties_dialog::~project_properties_dialog()
{
delete _impl_ptr;
}
void
project_properties_dialog::run(
shared_ptr<project> project_ptr)
{
string name;
int result;
project_ptr->get_name(name);
_impl_ptr->_name->set_text(name);
result = _impl_ptr->_dialog->run();
if (result == 2)
{
//project_ptr->set_name(_impl_ptr->_name->get_text());
}
_impl_ptr->_dialog->hide();
}
project_properties_dialog_impl::project_properties_dialog_impl()
{
_dialog.init(g_xml, "project_properties_dialog");
_name.init(g_xml, "project_name");
}

View File

@ -0,0 +1,36 @@
// -*- Mode: C++ ; indent-tabs-mode: t -*-
/* This file is part of Patchage.
* Copyright (C) 2008 Nedko Arnaudov <nedko@arnaudov.name>
*
* Patchage 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.
*
* Patchage 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 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.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef PROJECT_PROPERTIES_HPP__B854A265_3660_4DAA_87E7_104020C5962D__INCLUDED
#define PROJECT_PROPERTIES_HPP__B854A265_3660_4DAA_87E7_104020C5962D__INCLUDED
struct project_properties_dialog_impl;
class project_properties_dialog
{
public:
project_properties_dialog();
~project_properties_dialog();
void run(shared_ptr<project> project_ptr);
private:
project_properties_dialog_impl * _impl_ptr;
};
#endif // #ifndef PROJECT_PROPERTIES_HPP__B854A265_3660_4DAA_87E7_104020C5962D__INCLUDED