~ubuntu-branches/ubuntu/quantal/glom/quantal

« back to all changes in this revision

Viewing changes to glom/libglom/data_structure/layout/layoutitem_line.cc

  • Committer: Bazaar Package Importer
  • Author(s): Iain Lane
  • Date: 2009-01-11 17:12:01 UTC
  • mfrom: (1.1.39 upstream)
  • Revision ID: james.westby@ubuntu.com-20090111171201-0ov9zh1fxfueshxc
Tags: 1.8.5-0ubuntu1
* New upstream release (LP: #256701), fixes LP bugs: 
  + Clear the text in property dialogs for text items (LP: #309147)
  + Don't crash when showing and then hiding the grid (LP: #303453)
  + Temporarily remember the sort order so it is the same when navigating 
    away and back (LP: #303422)
  + Use the list's sort order for the top-level records in the report 
    (LP: #303425)
  + Users/Groups: Disable drag-and-drop for the treeview, because it is
    useless and confusing (LP: #299573)
  + Import: Sort the fields list alphabetically (LP: #306593)
  + delete primary key make unusuable the database (LP: #299549)
  + Spanish translate incomplete (LP: #299556)
  + import date format error (LP: #299591)
  + can't delete data from table list view (LP: #299853)
  + Field definition: default value not saved (LP: #299896)
  + reports crashing (LP: #300054)
  + Year error with date fields (LP: #300057)
  + list view: 2 records added instead of 1 (LP: #300819)
* debian/control: Refreshed dependencies for libglom-dev.
* debian/control: Updated build-deps to match configure checks. goocavnasmm
  build-dep bumped to version without .la files.
* debian/rules: Don't delete the directory containing the templates.
* debian/control, debian/rules, debian/glom-doc.*: Split out
  arch-independent manual and examples into separate package glom-doc, which
  is now recommended by glom (glom will still work if they're not available)
* debian/copyright: Rewritten to new machine-readable format. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Glom
 
2
 *
 
3
 * Copyright (C) 2006 Murray Cumming
 
4
 *
 
5
 * This program is free software; you can redistribute it and/or
 
6
 * modify it under the terms of the GNU General Public License as
 
7
 * published by the Free Software Foundation; either version 2 of the
 
8
 * License, or (at your option) any later version.
 
9
 *
 
10
 * This program is distributed in the hope that it will be useful, but
 
11
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
13
 * General Public License for more details.
 
14
 *
 
15
 * You should have received a copy of the GNU General Public
 
16
 * License along with this program; if not, write to the
 
17
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 
18
 * Boston, MA 02111-1307, USA.
 
19
 */
 
20
 
 
21
#include "layoutitem_line.h"
 
22
#include <glom/libglom/utils.h>
 
23
#include <glibmm/i18n.h>
 
24
 
 
25
namespace Glom
 
26
{
 
27
 
 
28
LayoutItem_Line::LayoutItem_Line()
 
29
: m_start_x(0),
 
30
  m_start_y(0),
 
31
  m_end_x(0),
 
32
  m_end_y(0)
 
33
{
 
34
  m_translatable_item_type = TRANSLATABLE_TYPE_INVALID; //There is no text in this to translate.
 
35
}
 
36
 
 
37
LayoutItem_Line::LayoutItem_Line(const LayoutItem_Line& src)
 
38
: LayoutItem(src),
 
39
  m_start_x(src.m_start_x),
 
40
  m_start_y(src.m_start_y),
 
41
  m_end_x(src.m_end_x),
 
42
  m_end_y(src.m_end_y)
 
43
{
 
44
}
 
45
 
 
46
LayoutItem_Line::~LayoutItem_Line()
 
47
{
 
48
}
 
49
 
 
50
LayoutItem* LayoutItem_Line::clone() const
 
51
{
 
52
  return new LayoutItem_Line(*this);
 
53
}
 
54
 
 
55
bool LayoutItem_Line::operator==(const LayoutItem_Line& src) const
 
56
{
 
57
  bool result = LayoutItem::operator==(src) && 
 
58
                (m_start_x == src.m_start_x) && 
 
59
                (m_start_y == src.m_start_y) && 
 
60
                (m_end_x == src.m_end_x) && 
 
61
                (m_end_y == src.m_end_y);
 
62
 
 
63
  return result;
 
64
}
 
65
 
 
66
//Avoid using this, for performance:
 
67
LayoutItem_Line& LayoutItem_Line::operator=(const LayoutItem_Line& src)
 
68
{
 
69
  LayoutItem::operator=(src);
 
70
 
 
71
  m_start_x = src.m_start_x;
 
72
  m_start_y = src.m_start_y;
 
73
  m_end_x = src.m_end_x;
 
74
  m_end_y = src.m_end_y;
 
75
 
 
76
  return *this;
 
77
}
 
78
 
 
79
Glib::ustring LayoutItem_Line::get_part_type_name() const
 
80
{
 
81
  //Note to translators: This is a straight line, not a database row.
 
82
  return _("Line");
 
83
}
 
84
 
 
85
Glib::ustring LayoutItem_Line::get_report_part_id() const
 
86
{
 
87
  return "line"; //We reuse this for this node.
 
88
}
 
89
 
 
90
void LayoutItem_Line::get_coordinates(double& start_x, double& start_y, double& end_x, double& end_y) const
 
91
{
 
92
  start_x = m_start_x;
 
93
  start_y = m_start_y;
 
94
  end_x = m_end_x;
 
95
  end_y = m_end_y;
 
96
}
 
97
 
 
98
void LayoutItem_Line::set_coordinates(double start_x, double start_y, double end_x, double end_y)
 
99
{
 
100
  m_start_x = start_x;
 
101
  m_start_y = start_y;
 
102
  m_end_x = end_x;
 
103
  m_end_y = end_y;
 
104
 
 
105
  //Set the x,y,height,width too, 
 
106
  //for generic code that deals with that API:
 
107
  set_print_layout_position(m_start_x, m_start_y, (m_end_x - m_start_x), (m_end_y - m_start_y));
 
108
}
 
109
 
 
110
} //namespace Glom
 
111