[glom/gtktoolpallete] FLowTableDnd: Removed another use of LayoutItem types.
- From: Murray Cumming <murrayc src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [glom/gtktoolpallete] FLowTableDnd: Removed another use of LayoutItem types.
- Date: Fri, 8 Jan 2010 16:27:17 +0000 (UTC)
commit 38840b5bebe85fc7491cc676f50794fa2cc75ac3
Author: Murray Cumming <murrayc murrayc com>
Date: Mon Jan 4 12:00:57 2010 +0100
FLowTableDnd: Removed another use of LayoutItem types.
Makefile_glom.am | 2 --
glom/mode_data/flowtablewithfields.cc | 27 +++++++++++++++++++++++++--
glom/mode_data/flowtablewithfields.h | 4 ++--
glom/utility_widgets/flowtable_dnd.cc | 29 +++--------------------------
glom/utility_widgets/flowtable_dnd.h | 5 +++--
5 files changed, 33 insertions(+), 34 deletions(-)
---
diff --git a/Makefile_glom.am b/Makefile_glom.am
index 2ca7136..77f7da3 100644
--- a/Makefile_glom.am
+++ b/Makefile_glom.am
@@ -348,8 +348,6 @@ glom_glom_SOURCES += \
endif
glom_glom_LDADD = $(win_resfile) \
- glom/utility_widgets/egg/toolpalette/libeggtoolpalette.a \
- glom/utility_widgets/egg/util/libeggutil.a \
glom/libglom/libglom-$(GLOM_ABI_VERSION).la \
$(GLOM_LIBS) $(PYTHON_LIBS) $(INTLLIBS)
if !GLOM_ENABLE_MAEMO
diff --git a/glom/mode_data/flowtablewithfields.cc b/glom/mode_data/flowtablewithfields.cc
index 4c5d195..faf6f20 100644
--- a/glom/mode_data/flowtablewithfields.cc
+++ b/glom/mode_data/flowtablewithfields.cc
@@ -1425,9 +1425,32 @@ void FlowTableWithFields::on_dnd_add_layout_item_image(LayoutWidgetBase* above)
signal_layout_changed().emit();
}
-void FlowTableWithFields::on_dnd_add_layout_item(LayoutWidgetBase* above, const sharedptr<LayoutItem>& item)
+void FlowTableWithFields::on_dnd_add_layout_item(Gtk::Widget* dragged_widget, Gtk::Widget* above)
{
- dnd_add_to_layout_group(item, above);
+ LayoutWidgetBase* above_casted = dynamic_cast<LayoutWidgetBase*>(above);
+
+ LayoutWidgetBase* base = dynamic_cast<LayoutWidgetBase*>(dragged_widget);
+ if(!base)
+ return;
+
+ sharedptr<LayoutItem> item = base->get_layout_item();
+ if(!item)
+ {
+ m_internal_drag = false;
+ sharedptr<LayoutGroup> group = sharedptr<LayoutGroup>::cast_dynamic(get_layout_item());
+ if(group)
+ {
+ LayoutGroup::type_list_items items = group->m_list_items;
+ if(std::find(items.begin(), items.end(), item) != items.end())
+ {
+ m_internal_drag = true;
+ group->remove_item(item);
+ }
+ }
+
+ dnd_add_to_layout_group(item, above_casted);
+ base->set_dnd_in_progress(false);
+ }
// Don't do this here - it's done in the drag_end handler
// signal_layout_changed().emit();
diff --git a/glom/mode_data/flowtablewithfields.h b/glom/mode_data/flowtablewithfields.h
index c93c841..ff2a665 100644
--- a/glom/mode_data/flowtablewithfields.h
+++ b/glom/mode_data/flowtablewithfields.h
@@ -219,6 +219,7 @@ private:
#ifndef GLOM_ENABLE_CLIENT_ONLY
virtual void on_dnd_add_layout_item_by_type(int item_type_num, Gtk::Widget* above);
+ virtual void on_dnd_add_layout_item(Gtk::Widget* dragged_widget, Gtk::Widget* above);
virtual void on_dnd_add_placeholder(Gtk::Widget* above);
virtual void on_dnd_remove_placeholder();
virtual void set_child_widget_dnd_in_progress(Gtk::Widget* child, bool in_progress);
@@ -232,8 +233,7 @@ private:
void on_dnd_add_layout_item_image(LayoutWidgetBase* above);
void on_dnd_add_layout_notebook(LayoutWidgetBase* above);
void on_dnd_add_layout_portal(LayoutWidgetBase* above);
- void on_dnd_add_layout_item(LayoutWidgetBase* above, const sharedptr<LayoutItem>& item);
-
+
sharedptr<LayoutItem_Portal> get_portal_relationship();
void dnd_notify_failed_drop();
diff --git a/glom/utility_widgets/flowtable_dnd.cc b/glom/utility_widgets/flowtable_dnd.cc
index 09abd05..f0b8422 100644
--- a/glom/utility_widgets/flowtable_dnd.cc
+++ b/glom/utility_widgets/flowtable_dnd.cc
@@ -157,7 +157,7 @@ void FlowTableDnd::on_dnd_add_layout_item_by_type(int /* item_type */, Gtk::Widg
std::cerr << "FlowTableDnd::on_dnd_add_layout_item_by_type(): Not implemented. Derived classes should implement this." << std::endl;
}
-void FlowTableDnd::on_dnd_add_layout_item(LayoutWidgetBase* /* above */, const sharedptr<LayoutItem>& /* item */)
+void FlowTableDnd::on_dnd_add_layout_item(Gtk::Widget* /* dragged_widget */, Gtk::Widget* /* above */)
{
//This is not pure virtual, so we can easily use this base class in unit tests.
std::cerr << "FlowTableDnd::on_dnd_add_layout_item(): Not implemented. Derived classes should implement this." << std::endl;
@@ -208,31 +208,8 @@ void FlowTableDnd::on_drag_data_received(const Glib::RefPtr<Gdk::DragContext>& d
if(!data)
return;
- Gtk::Widget* widget = static_cast<Gtk::Widget*>(data);
-
- LayoutWidgetBase* base = dynamic_cast<LayoutWidgetBase*>(widget);
- if(!base)
- return;
-
- sharedptr<LayoutItem> item = base->get_layout_item();
- if(!item)
- {
- m_internal_drag = false;
- sharedptr<LayoutGroup> group = sharedptr<LayoutGroup>::cast_dynamic(get_layout_item());
- if(group)
- {
- LayoutGroup::type_list_items items = group->m_list_items;
- if(std::find(items.begin(), items.end(), item) != items.end())
- {
- m_internal_drag = true;
- group->remove_item(item);
- }
- }
-
- LayoutWidgetBase* above_casted = dynamic_cast<LayoutWidgetBase*>(above);
- on_dnd_add_layout_item(above_casted, item);
- base->set_dnd_in_progress(false);
- }
+ Gtk::Widget* dragged_widget = static_cast<Gtk::Widget*>(data);
+ on_dnd_add_layout_item(dragged_widget, above);
}
queue_draw();
diff --git a/glom/utility_widgets/flowtable_dnd.h b/glom/utility_widgets/flowtable_dnd.h
index 601b121..d0b7307 100644
--- a/glom/utility_widgets/flowtable_dnd.h
+++ b/glom/utility_widgets/flowtable_dnd.h
@@ -62,7 +62,7 @@ private:
//To be implemented by the derived class:
virtual void on_dnd_add_layout_item_by_type(int item_type, Gtk::Widget* above);
- virtual void on_dnd_add_layout_item(LayoutWidgetBase* above, const sharedptr<LayoutItem>& item);
+ virtual void on_dnd_add_layout_item(Gtk::Widget* dragged_widget, Gtk::Widget* above);
virtual void on_dnd_add_placeholder(Gtk::Widget* above);
virtual void on_dnd_remove_placeholder();
@@ -79,7 +79,8 @@ private:
FlowTableItem* find_current_dnd_item (Gtk::Widget* child, int x = -1, int y = -1);
FlowTableItem* m_current_dnd_item;
-
+
+protected: //TODO: Make this private:
bool m_internal_drag;
};
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]