[glom] Details: Do not enable drag-and-drop by default.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glom] Details: Do not enable drag-and-drop by default.
- Date: Thu, 6 Oct 2011 10:32:07 +0000 (UTC)
commit 73aa08151bdccf299cfe8763f8b6958458c627b6
Author: Murray Cumming <murrayc murrayc com>
Date: Thu Oct 6 12:31:56 2011 +0200
Details: Do not enable drag-and-drop by default.
* glom/utility_widgets/flowtable.cc: Turn of drag-and-drop by default in
the EggSpreadTableDnd
* glom/mode_data/flowtablewithfields.[h|cc]: Added set_enable_drag_and_drop().
* glom/mode_data/box_data_details.[h|cc]: Added set_enable_drag_and_drop(),
calling the FlowTableWithFields.
glom/application.[h|cc]: Rename the Show Layout Toolbar menu item to
Drag and Drop Layout, though that is a bad name and I would like a better one.
* glom/frame_glom.[h|cc]: show_layout_toolbar(): Rename to
set_enable_layout_drag_and_drop().
* glom/mode_data/notebook_data.[h|cc]: Rename show_layout_toolbar() to
set_enable_layout_drag_and_drop() and make it enable dnd as well as showing
the toolpallette. The toolpalette is then a visual indication that
drag-and-drop is possible.
* glom/mode_data/test_flowtablewithfields.cc: Add a sub-group and enable
drag and drop.
ChangeLog | 21 +++++++++++++++++++++
glom/application.cc | 19 +++++++++++--------
glom/application.h | 4 ++--
glom/frame_glom.cc | 4 ++--
glom/frame_glom.h | 3 ++-
glom/mode_data/box_data_details.cc | 5 +++++
glom/mode_data/box_data_details.h | 2 ++
glom/mode_data/flowtablewithfields.cc | 24 +++++++++++++++++++++++-
glom/mode_data/flowtablewithfields.h | 2 ++
glom/mode_data/notebook_data.cc | 5 +++--
glom/mode_data/notebook_data.h | 3 ++-
glom/mode_data/test_flowtablewithfields.cc | 19 ++++++++++++++++---
glom/utility_widgets/flowtable.cc | 3 +++
13 files changed, 94 insertions(+), 20 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index bc92459..fa944f5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,26 @@
2011-10-06 Murray Cumming <murrayc murrayc com>
+ Details: Do not enable drag-and-drop by default.
+
+ * glom/utility_widgets/flowtable.cc: Turn of drag-and-drop by default in
+ the EggSpreadTableDnd
+ * glom/mode_data/flowtablewithfields.[h|cc]: Added set_enable_drag_and_drop().
+ * glom/mode_data/box_data_details.[h|cc]: Added set_enable_drag_and_drop(),
+ calling the FlowTableWithFields.
+
+ * glom/application.[h|cc]: Rename the Show Layout Toolbar menu item to
+ Drag and Drop Layout, though that is a bad name and I would like a better one.
+ * glom/frame_glom.[h|cc]: show_layout_toolbar(): Rename to
+ set_enable_layout_drag_and_drop().
+ * glom/mode_data/notebook_data.[h|cc]: Rename show_layout_toolbar() to
+ set_enable_layout_drag_and_drop() and make it enable dnd as well as showing
+ the toolpallette. The toolpalette is then a visual indication that
+ drag-and-drop is possible.
+ * glom/mode_data/test_flowtablewithfields.cc: Add a sub-group and enable
+ drag and drop.
+
+2011-10-06 Murray Cumming <murrayc murrayc com>
+
Update EggSpreadTable tests.
* glom/utility_widgets/eggspreadtablemm/test_spreadtablednd.cc: Fix a crash.
diff --git a/glom/application.cc b/glom/application.cc
index 750a901..0b60d29 100644
--- a/glom/application.cc
+++ b/glom/application.cc
@@ -505,9 +505,12 @@ void Application::init_menus()
m_listDeveloperActions.push_back(action);
m_refActionGroup_Others->add(action, sigc::mem_fun(*this, &Application::on_menu_developer_restore_backup));
- m_action_show_layout_toolbar = Gtk::ToggleAction::create("GlomAction_Menu_Developer_ShowLayoutToolbar", _("_Show Layout Toolbar"));
- m_listDeveloperActions.push_back(m_action_show_layout_toolbar);
- m_refActionGroup_Others->add(m_action_show_layout_toolbar, sigc::mem_fun(*this, &Application::on_menu_developer_show_layout_toolbar));
+ //TODO: Think of a better name for this menu item,
+ //though it mostly only exists because it is not quite ready to be on by default:
+ //Note to translators: Drag and Drop is part of the name, not a verb or action:
+ m_action_enable_layout_drag_and_drop = Gtk::ToggleAction::create("GlomAction_Menu_Developer_EnableLayoutDragAndDrop", _("_Drag and Drop Layout"));
+ m_listDeveloperActions.push_back(m_action_enable_layout_drag_and_drop);
+ m_refActionGroup_Others->add(m_action_enable_layout_drag_and_drop, sigc::mem_fun(*this, &Application::on_menu_developer_enable_layout_drag_and_drop));
#endif // !GLOM_ENABLE_CLIENT_ONLY
@@ -582,7 +585,7 @@ void Application::init_menus()
" <menuitem action='GlomAction_Menu_Developer_ActivePlatform_Normal' />"
" <menuitem action='GlomAction_Menu_Developer_ActivePlatform_Maemo' />"
" </menu>"
- " <menuitem action='GlomAction_Menu_Developer_ShowLayoutToolbar' />"
+ " <menuitem action='GlomAction_Menu_Developer_EnableLayoutDragAndDrop' />"
" <separator />"
" <menuitem action='GlomAction_Menu_Developer_ExportBackup' />"
" <menuitem action='GlomAction_Menu_Developer_RestoreBackup' />"
@@ -667,7 +670,7 @@ void Application::on_menu_developer_developer()
return;
m_pFrame->on_menu_developer_developer(m_action_menu_developer_developer, m_action_menu_developer_operator);
- m_pFrame->show_layout_toolbar(m_action_show_layout_toolbar->get_active());
+ m_pFrame->set_enable_layout_drag_and_drop(m_action_enable_layout_drag_and_drop->get_active());
}
void Application::on_menu_developer_operator()
@@ -675,7 +678,7 @@ void Application::on_menu_developer_operator()
if(m_pFrame)
{
m_pFrame->on_menu_developer_operator(m_action_menu_developer_operator);
- m_pFrame->show_layout_toolbar(false);
+ m_pFrame->set_enable_layout_drag_and_drop(false);
}
}
#endif // !GLOM_ENABLE_CLIENT_ONLY
@@ -2848,9 +2851,9 @@ bool Application::do_restore_backup(const Glib::ustring& backup_uri)
return true;
}
-void Application::on_menu_developer_show_layout_toolbar()
+void Application::on_menu_developer_enable_layout_drag_and_drop()
{
- m_pFrame->show_layout_toolbar(m_action_show_layout_toolbar->get_active());
+ m_pFrame->set_enable_layout_drag_and_drop(m_action_enable_layout_drag_and_drop->get_active());
}
diff --git a/glom/application.h b/glom/application.h
index 09780fe..393025d 100644
--- a/glom/application.h
+++ b/glom/application.h
@@ -162,7 +162,7 @@ private:
void on_menu_developer_active_platform_maemo();
void on_menu_developer_export_backup();
void on_menu_developer_restore_backup();
- void on_menu_developer_show_layout_toolbar();
+ void on_menu_developer_enable_layout_drag_and_drop ();
void on_window_translations_hide();
@@ -220,7 +220,7 @@ private:
#ifndef GLOM_ENABLE_CLIENT_ONLY
Glib::RefPtr<Gtk::Action> m_action_developer_users;
Glib::RefPtr<Gtk::RadioAction> m_action_menu_developer_developer, m_action_menu_developer_operator;
- Glib::RefPtr<Gtk::ToggleAction> m_action_show_layout_toolbar;
+ Glib::RefPtr<Gtk::ToggleAction> m_action_enable_layout_drag_and_drop ;
#endif // !GLOM_ENABLE_CLIENT_ONLY
Glib::RefPtr<Gtk::ToggleAction> m_toggleaction_network_shared;
diff --git a/glom/frame_glom.cc b/glom/frame_glom.cc
index 0abdb37..a57b45d 100644
--- a/glom/frame_glom.cc
+++ b/glom/frame_glom.cc
@@ -1025,9 +1025,9 @@ void Frame_Glom::on_menu_file_print_edit_layouts()
on_menu_developer_print_layouts();
}
-void Frame_Glom::show_layout_toolbar (bool show)
+void Frame_Glom::set_enable_layout_drag_and_drop(bool enable)
{
- m_Notebook_Data.show_layout_toolbar(show);
+ m_Notebook_Data.set_enable_layout_drag_and_drop(enable);
}
#endif // !GLOM_ENABLE_CLIENT_ONLY
diff --git a/glom/frame_glom.h b/glom/frame_glom.h
index 40288cc..f8bb8eb 100644
--- a/glom/frame_glom.h
+++ b/glom/frame_glom.h
@@ -161,7 +161,8 @@ public:
///Create the database for new documents, showing the Connection dialog
bool create_database(const Glib::ustring& database_name, const Glib::ustring& title);
- void show_layout_toolbar(bool show = true);
+
+ void set_enable_layout_drag_and_drop(bool enable = true);
#endif // !GLOM_ENABLE_CLIENT_ONLY
void export_data_to_vector(Document::type_example_rows& the_vector, const FoundSet& found_set, const Document::type_list_layout_groups& sequence);
diff --git a/glom/mode_data/box_data_details.cc b/glom/mode_data/box_data_details.cc
index 703759d..85d9238 100644
--- a/glom/mode_data/box_data_details.cc
+++ b/glom/mode_data/box_data_details.cc
@@ -968,4 +968,9 @@ void Box_Data_Details::do_new_record()
on_button_new();
}
+void Box_Data_Details::set_enable_drag_and_drop(bool enabled)
+{
+ m_FlowTable.set_enable_drag_and_drop(enabled);
+}
+
} //namespace Glom
diff --git a/glom/mode_data/box_data_details.h b/glom/mode_data/box_data_details.h
index 3ab145d..d114504 100644
--- a/glom/mode_data/box_data_details.h
+++ b/glom/mode_data/box_data_details.h
@@ -68,6 +68,8 @@ public:
#endif
void do_new_record();
+
+ void set_enable_drag_and_drop(bool enabled = true);
protected:
diff --git a/glom/mode_data/flowtablewithfields.cc b/glom/mode_data/flowtablewithfields.cc
index 8fd25cf..8a07d72 100644
--- a/glom/mode_data/flowtablewithfields.cc
+++ b/glom/mode_data/flowtablewithfields.cc
@@ -1454,9 +1454,31 @@ void FlowTableWithFields::set_find_mode(bool val)
subtable->set_find_mode(m_find_mode);
}
}
-
}
+void FlowTableWithFields::set_enable_drag_and_drop(bool enabled)
+{
+ const EggDragEnableMode drag_mode =
+ (enabled ? EGG_DRAG_FULL : EGG_DRAG_DISABLED);
+
+ //Only enable dragging of the sub-tables.
+ //Otherwise just the whole thing will be dragged,
+ //though there would be nowhere to drop it:
+ set_drag_enabled(EGG_DRAG_DISABLED);
+ set_drop_enabled(enabled);
+
+ for(type_sub_flow_tables::iterator iter = m_sub_flow_tables.begin(); iter != m_sub_flow_tables.end(); ++iter)
+ {
+ FlowTableWithFields* child = *iter;
+ if(child)
+ {
+ //std::cout << G_STRFUNC << ": child" << std::endl;
+ child->set_drag_enabled(drag_mode);
+ child->set_drop_enabled(enabled);
+ }
+ }
+}
+
#endif // !GLOM_ENABLE_CLIENT_ONLY
} //namespace Glom
diff --git a/glom/mode_data/flowtablewithfields.h b/glom/mode_data/flowtablewithfields.h
index d074d2c..b32d1b2 100644
--- a/glom/mode_data/flowtablewithfields.h
+++ b/glom/mode_data/flowtablewithfields.h
@@ -132,6 +132,8 @@ public:
*/
void get_layout_groups(Document::type_list_layout_groups& groups);
sharedptr<LayoutGroup> get_layout_group();
+
+ void set_enable_drag_and_drop(bool enabled = true);
/** For instance,
* void on_flowtable_field_edited(const sharedptr<const LayoutItem_Field>& field, const Gnome::Gda::Value& value);
diff --git a/glom/mode_data/notebook_data.cc b/glom/mode_data/notebook_data.cc
index d563c4f..db5a08b 100644
--- a/glom/mode_data/notebook_data.cc
+++ b/glom/mode_data/notebook_data.cc
@@ -297,9 +297,10 @@ void Notebook_Data::do_menu_developer_layout()
}
}
-void Notebook_Data::show_layout_toolbar(bool show)
+void Notebook_Data::set_enable_layout_drag_and_drop(bool enable)
{
- m_Box_Details.show_layout_toolbar(show);
+ m_Box_Details.show_layout_toolbar(enable);
+ m_Box_Details.set_enable_drag_and_drop(enable);
}
#endif // !GLOM_ENABLE_CLIENT_ONLY
diff --git a/glom/mode_data/notebook_data.h b/glom/mode_data/notebook_data.h
index 4dc7e19..23dfe6d 100644
--- a/glom/mode_data/notebook_data.h
+++ b/glom/mode_data/notebook_data.h
@@ -54,7 +54,8 @@ public:
#ifndef GLOM_ENABLE_CLIENT_ONLY
virtual void do_menu_developer_layout(); //override
- void show_layout_toolbar(bool show = true);
+
+ void set_enable_layout_drag_and_drop(bool enable = true);
#endif // !GLOM_ENABLE_CLIENT_ONLY
virtual void do_menu_file_print(); //override
diff --git a/glom/mode_data/test_flowtablewithfields.cc b/glom/mode_data/test_flowtablewithfields.cc
index 5f4f648..40c6223 100644
--- a/glom/mode_data/test_flowtablewithfields.cc
+++ b/glom/mode_data/test_flowtablewithfields.cc
@@ -61,6 +61,18 @@ static void fill_flowtable(Glom::FlowTableWithFields& flowtable)
item->set_title("title for image");
flowtable.add_layout_item(item);
}
+
+ Glom::sharedptr<Glom::LayoutGroup> group =
+ Glom::sharedptr<Glom::LayoutGroup>::create();
+ Glom::sharedptr<Glom::LayoutItem_Text> item =
+ Glom::sharedptr<Glom::LayoutItem_Text>::create();
+ item->set_text("inner text 1");
+ group->add_item(item);
+ item =
+ Glom::sharedptr<Glom::LayoutItem_Text>::create();
+ item->set_text("inner text 2");
+ group->add_item(item);
+ flowtable.add_layout_item(group);
}
static void clear_flowtable(Glom::FlowTableWithFields& flowtable)
@@ -87,9 +99,10 @@ main(int argc, char* argv[])
window.add(flowtable);
flowtable.set_design_mode();
flowtable.show();
-
-// Glom::DragWindow drag_window;
-// drag_window.show();
+
+ flowtable.set_enable_drag_and_drop(true);
+ //flowtable.set_drag_enabled(EGG_DRAG_FULL);
+ //flowtable.set_drop_enabled(true);
Gtk::Main::run(window);
diff --git a/glom/utility_widgets/flowtable.cc b/glom/utility_widgets/flowtable.cc
index a44ee80..ccad14a 100644
--- a/glom/utility_widgets/flowtable.cc
+++ b/glom/utility_widgets/flowtable.cc
@@ -31,6 +31,9 @@ FlowTable::FlowTable()
:
m_design_mode(false)
{
+ //Default to disabling drag and drop:
+ set_drag_enabled(EGG_DRAG_DISABLED);
+ set_drop_enabled(false);
}
FlowTable::~FlowTable()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]