glom r1389 - in trunk: . glom/mode_data glom/utility_widgets



Author: jhs
Date: Thu Jan 17 19:44:25 2008
New Revision: 1389
URL: http://svn.gnome.org/viewvc/glom?rev=1389&view=rev

Log:
2008-01-17  Johannes Schmid <johannes schmid openismus com>

	* glom/mode_data/flowtablewithfields.cc:
	* glom/utility_widgets/flowtable.cc:
	
	Fixed some odd dragging bug and removed dialogs for
	new buttons/label. Use Developers->Layout instead to
	change the appearance of newly added items.

Modified:
   trunk/ChangeLog
   trunk/glom/mode_data/flowtablewithfields.cc
   trunk/glom/utility_widgets/flowtable.cc

Modified: trunk/glom/mode_data/flowtablewithfields.cc
==============================================================================
--- trunk/glom/mode_data/flowtablewithfields.cc	(original)
+++ trunk/glom/mode_data/flowtablewithfields.cc	Thu Jan 17 19:44:25 2008
@@ -1171,15 +1171,10 @@
 void FlowTableWithFields::on_dnd_add_layout_item_button(LayoutWidgetBase* above)
 {
   // create the button
-  sharedptr<LayoutItem_Button> layout_item_button(new LayoutItem_Button());
+  sharedptr<LayoutItem_Button> layout_item_button = sharedptr<LayoutItem_Button>::create();
+  layout_item_button->set_title(_("New Button")); //Give the button a default title, so it is big enough, and so people see that they should change it.
+  layout_item_button->set_name ("new_button");
   sharedptr<LayoutItem> layout_item = sharedptr<LayoutItem>::cast_dynamic(layout_item_button);
-  
-  // Get field informations
-  if (!get_field_information (layout_item))
-  {
-    realize();
-    return;
-  }
     
   //Add a widget for this layout item, after the "above" item:
   type_list_layoutwidgets::iterator cur_widget;
@@ -1211,12 +1206,9 @@
 void FlowTableWithFields::on_dnd_add_layout_item_text(LayoutWidgetBase* above)
 {
   // create the text label
-  sharedptr<LayoutItem_Text> layout_item_text(new LayoutItem_Text());
-  sharedptr<LayoutItem> layout_item = sharedptr<LayoutItem>::cast_dynamic(layout_item_text);
-  
-  // Get field informations
-  if (!get_field_information (layout_item))
-    return;
+  sharedptr<LayoutItem_Text> textobject = sharedptr<LayoutItem_Text>::create();
+  textobject->set_title(_("Text Title")); //Give the button a default title, so it is big enough, and so people see that they should change it.
+  sharedptr<LayoutItem> layout_item = sharedptr<LayoutItem>::cast_dynamic(textobject);
     
   //Add a widget for this layout item, after the "above" item:
   type_list_layoutwidgets::iterator cur_widget;
@@ -1225,7 +1217,7 @@
   else
     cur_widget = m_list_layoutwidgets.end();
 
-  add_layout_item_at_position(layout_item_text, cur_widget);
+  add_layout_item_at_position(textobject, cur_widget);
 
 
   //Get the layout group that the "above" widget's layout item is in:
@@ -1237,9 +1229,9 @@
   }
 
   if(above)
-    layout_group->add_item(layout_item_text, above->get_layout_item());
+    layout_group->add_item(textobject, above->get_layout_item());
   else
-    layout_group->add_item(layout_item_text);
+    layout_group->add_item(textobject);
 
   //Tell the parent to tell the document to save the layout:
   signal_layout_changed().emit();
@@ -1314,42 +1306,4 @@
   return layout_item;
 }
 
-#ifndef GLOM_ENABLE_CLIENT_ONLY
-bool FlowTableWithFields::get_field_information (sharedptr<LayoutItem>& item)
-{
-  bool retval = false; 
- 
-  try
-  {
-    Glib::RefPtr<Gnome::Glade::Xml> refXml = Gnome::Glade::Xml::create(GLOM_GLADEDIR "glom.glade", "dialog_drop_field");
-
-    Gtk::Dialog* dialog = 0;
-    Gtk::Entry* entry_name = 0;
-    Gtk::Entry* entry_title = 0;
-    
-    refXml->get_widget("dialog_drop_field", dialog);
-    refXml->get_widget("entry_name", entry_name);
-    refXml->get_widget("entry_title", entry_title);
-
-    if(dialog)
-    {
-      const int response = dialog->run();
-      dialog->hide();
-      if(response == Gtk::RESPONSE_OK)
-      {
-        item->set_name (entry_name->get_text());
-        item->set_title (entry_title->get_text());
-        retval = true;
-      }
-      delete dialog;
-    }
-  }
-  catch(const Gnome::Glade::XmlError& ex)
-  {
-    std::cerr << ex.what() << std::endl;
-  }
-  return retval;
-}
-#endif
-
 } //namespace Glom

Modified: trunk/glom/utility_widgets/flowtable.cc
==============================================================================
--- trunk/glom/utility_widgets/flowtable.cc	(original)
+++ trunk/glom/utility_widgets/flowtable.cc	Thu Jan 17 19:44:25 2008
@@ -1132,11 +1132,7 @@
   x += get_allocation().get_x();
   y += get_allocation().get_y();
   
-  m_current_dnd_item = dnd_get_item(x, y);
-	
-  on_dnd_remove_placeholder ();
-  realize();
-  
+  m_current_dnd_item = dnd_get_item(x, y);  
   LayoutWidgetBase* above = dnd_find_datawidget();
 	
   // above might be 0 here...
@@ -1217,13 +1213,12 @@
   LayoutWidgetBase* above = 0;
   if(m_current_dnd_item)
   {
-    if(m_current_dnd_item->m_first)
+		if(m_current_dnd_item->m_first)
     {
       Gtk::Alignment* alignment = dynamic_cast <Gtk::Alignment*>(m_current_dnd_item->m_first);
       if (alignment)
         above = dynamic_cast<PlaceholderGlom*>(alignment->get_child());
     }
-
     if(!above && m_current_dnd_item->m_first)
       above = dynamic_cast<LayoutWidgetBase*>(m_current_dnd_item->m_first);
 
@@ -1255,7 +1250,6 @@
 	}
     
   on_dnd_remove_placeholder ();
-  realize();
   
   LayoutWidgetBase* above = dnd_find_datawidget();
 	



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]