glom r1760 - in trunk: . glom/relationships_overview
- From: murrayc svn gnome org
- To: svn-commits-list gnome org
- Subject: glom r1760 - in trunk: . glom/relationships_overview
- Date: Wed, 26 Nov 2008 10:42:02 +0000 (UTC)
Author: murrayc
Date: Wed Nov 26 10:42:02 2008
New Revision: 1760
URL: http://svn.gnome.org/viewvc/glom?rev=1760&view=rev
Log:
2008-11-26 Murray Cumming <murrayc murrayc com>
* glom/relationships_overview/dialog_relationships_overview.[h|cc]:
Respond to changes in the scrolledwindow adjustments to increase the
canvas size when the window size changes, so it is always big enough,
avoiding dead areas.
Bug #559157 (Iain Lane).
Modified:
trunk/ChangeLog
trunk/glom/relationships_overview/dialog_relationships_overview.cc
trunk/glom/relationships_overview/dialog_relationships_overview.h
Modified: trunk/glom/relationships_overview/dialog_relationships_overview.cc
==============================================================================
--- trunk/glom/relationships_overview/dialog_relationships_overview.cc (original)
+++ trunk/glom/relationships_overview/dialog_relationships_overview.cc Wed Nov 26 10:42:02 2008
@@ -39,7 +39,8 @@
Dialog_RelationshipsOverview::Dialog_RelationshipsOverview(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& refGlade)
: Gtk::Dialog(cobject),
m_menu(0),
- m_modified(false)
+ m_modified(false),
+ m_scrolledwindow_canvas(0)
{
m_refPageSetup = Gtk::PageSetup::create();
m_refSettings = Gtk::PrintSettings::create();
@@ -116,12 +117,13 @@
//Get the scolled window and add the canvas to it:
- Gtk::ScrolledWindow* scrolledwindow_canvas = 0;
- refGlade->get_widget("scrolledwindow_canvas", scrolledwindow_canvas);
+ m_scrolledwindow_canvas = 0;
+ refGlade->get_widget("scrolledwindow_canvas", m_scrolledwindow_canvas);
- scrolledwindow_canvas->add(m_canvas);
+ m_scrolledwindow_canvas->add(m_canvas);
m_canvas.show();
+ //Restore the previous window size, to avoid annoying the user:
if(m_last_size_x != 0 && m_last_size_y != 0 )
{
set_default_size(m_last_size_x, m_last_size_y);
@@ -133,6 +135,13 @@
m_canvas.add_item(m_group_lines);
m_group_lines->lower(); //Make sure that the lines are below the tables.
+ //Respond to changes of window size,
+ //so we always make the canvas bounds big enough:
+ m_scrolledwindow_canvas->get_hadjustment()->signal_changed().connect(
+ sigc::mem_fun(*this, &Dialog_RelationshipsOverview::on_scroll_value_changed) );
+ m_scrolledwindow_canvas->get_vadjustment()->signal_changed().connect(
+ sigc::mem_fun(*this, &Dialog_RelationshipsOverview::on_scroll_value_changed) );
+
setup_context_menu();
}
@@ -511,5 +520,33 @@
}
}
+
+void Dialog_RelationshipsOverview::on_scroll_value_changed()
+{
+ if(!m_scrolledwindow_canvas)
+ return;
+
+ double width = m_scrolledwindow_canvas->get_hadjustment()->get_page_size();
+ double height = m_scrolledwindow_canvas->get_vadjustment()->get_page_size();
+ double x = m_scrolledwindow_canvas->get_hadjustment()->get_value();
+ double y = m_scrolledwindow_canvas->get_vadjustment()->get_value();
+
+ //Make sure that the canvas bounds are as big as the scrollable area:
+ double old_left = 0;
+ double old_top = 0;
+ double old_right = 0;
+ double old_bottom = 0;
+ m_canvas.get_bounds(old_left, old_top, old_right, old_bottom);
+
+ const double old_height = old_bottom - old_top;
+ const double old_width = old_right - old_left;
+
+ if( (width > old_width) ||
+ (height > old_height) )
+ {
+ m_canvas.set_bounds(0, 0, width, height);
+ }
+}
+
} //namespace Glom
Modified: trunk/glom/relationships_overview/dialog_relationships_overview.h
==============================================================================
--- trunk/glom/relationships_overview/dialog_relationships_overview.h (original)
+++ trunk/glom/relationships_overview/dialog_relationships_overview.h Wed Nov 26 10:42:02 2008
@@ -29,6 +29,7 @@
#include <gtkmm/uimanager.h>
#include <gtkmm/menubar.h>
#include <gtkmm/printoperation.h>
+#include <gtkmm/scrolledwindow.h>
#include <gtkmm/toggleaction.h>
#include <libglademm.h>
#include <goocanvasmm/canvas.h>
@@ -71,6 +72,8 @@
void on_context_menu_edit_fields(const Glib::RefPtr<CanvasGroupDbTable>& table);
void on_context_menu_edit_relationships(const Glib::RefPtr<CanvasGroupDbTable>& table);
+ void on_scroll_value_changed();
+
Glib::RefPtr<CanvasGroupDbTable> get_table_group(const Glib::ustring& table_name);
Glib::RefPtr<Gtk::UIManager> m_refUIManager;
@@ -80,6 +83,7 @@
bool m_modified;
CanvasEditable m_canvas;
+ Gtk::ScrolledWindow* m_scrolledwindow_canvas;
//typedef std::map<Glib::RefPtr<Goocanvas::Item>, TableView*> type_map_item_tables;
//type_map_item_tables m_tables;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]