16 #include "msdevstudio/MSconfig.h"
31 #include <qapplication.h>
32 #include <qclipboard.h>
36 #if QT_VERSION < 0x040000
37 #include <qdragobject.h>
39 #include <qpaintdevicemetrics.h>
42 #include <q3dragobject.h>
43 #include <QtGui/QMouseEvent>
44 #include <QtGui/QPixmap>
45 #include <QtGui/QResizeEvent>
46 #include <QtGui/QPrintDialog>
48 #include <q3paintdevicemetrics.h>
53 #include <qsettings.h>
54 #include <qstatusbar.h>
79 { QPrinter::A4, QPrinter::B5, QPrinter::Letter,
80 QPrinter::Legal, QPrinter::Executive,
81 QPrinter::A0, QPrinter::A1, QPrinter::A2, QPrinter::A3,
82 QPrinter::A5, QPrinter::A6, QPrinter::A7, QPrinter::A8,
83 QPrinter::A9, QPrinter::B0, QPrinter::B1,
84 QPrinter::B10, QPrinter::B2, QPrinter::B3, QPrinter::B4,
85 QPrinter::B6, QPrinter::B7, QPrinter::B8, QPrinter::B9,
86 QPrinter::C5E, QPrinter::Comm10E,
87 QPrinter::DLE, QPrinter::Folio, QPrinter::Ledger,
88 QPrinter::Tabloid, QPrinter::Custom, QPrinter::NPageSize };
96 QPrinter::Landscape };
113 #if QT_VERSION < 0x040000
115 const char * name, Qt::WFlags f)
119 const char * name,
Qt::WFlags f)
120 : Q3CanvasView ( c, parent, name, f ),
122 m_scale_factor ( 1.0 ),
123 m_printer_bounds ( false ),
124 m_ignore_margin ( false ),
127 m_zoom_mode = false ;
129 m_canvas = canvas ();
130 m_canvas->setUpdatePeriod ( 30 );
132 if ( s_printer == 0 )
137 calcPrinterMetrics ( s_printer );
139 m_canvas->resize ( m_apage_w, m_apage_h );
144 int pb = settings.
readNumEntry ( s_app_key +
"Canvas/Margin", 0 );
145 bool yes = ( pb == 1 ) ?
true :
false;
146 showPrinterMargins ( yes );
162 assert( pagesize < QPrinter::NPageSize );
165 const int orientation
167 QPrinter::Portrait );
168 assert( orientation == 0 || orientation == 1 );
174 assert( color == 0 || color == 1 );
212 #if QT_VERSION < 0x040000
216 iter = itemList.begin();
218 while( iter != itemList.end() )
232 Q3CanvasItemList itemList =
m_canvas -> allItems ();
234 Q3ValueListIterator< Q3CanvasItem * > iter;
235 iter = itemList.begin();
237 while( iter != itemList.end() )
239 Q3CanvasItem * item = *iter++;
244 Q3CanvasRectangle * rect
245 =
dynamic_cast< Q3CanvasRectangle *
>( item );
261 #if QT_VERSION < 0x040000
265 Q3CanvasRectangle * rect
271 rect ->moveBy ( dx, dy );
273 QColor color (
"lightGray" );
274 QPen pen ( color, 1, Qt::DashLine );
275 rect -> setPen ( pen );
291 if(
s_printer -> orientation() == QPrinter::Portrait )
308 #if QT_VERSION < 0x040000
311 Q3PaintDeviceMetrics metrics ( device );
313 int dpix = metrics.logicalDpiX ();
314 int dpiy = metrics.logicalDpiY ();
320 m_apage_h = static_cast <
int > ( m_apage_h * dpiy / 25.4 );
322 if(
s_printer -> orientation() == QPrinter::Landscape )
336 #if QT_VERSION < 0x040000
354 #if QT_VERSION < 0x040000
355 std::vector < QCanvasItem * > &
357 std::vector < Q3CanvasItem * > &
367 #if QT_VERSION < 0x040000
370 addSelectedItem ( Q3CanvasItem * item )
374 if ( ! item->isSelected() )
376 m_selected_list.push_back ( item );
384 #if QT_VERSION < 0x040000
388 vector < QCanvasItem * > ::iterator last
390 removeSelectedItem ( Q3CanvasItem * item )
392 if ( item->isSelected() ) {
393 vector < Q3CanvasItem * > ::iterator last
395 = std::remove ( m_selected_list.begin(),
396 m_selected_list.end(), item );
397 m_selected_list.erase ( last, m_selected_list.end() );
404 #ifdef ITERATOR_MEMBER_DEFECT
407 #if QT_VERSION < 0x040000
408 vector < QCanvasItem * > ::const_iterator first
412 vector < Q3CanvasItem * > ::const_iterator first
414 Q3CanvasItem * item = *first++;
416 QRect rect = item->boundingRect();
420 QRect r = item->boundingRect ();
434 #if QT_VERSION < 0x040000
435 vector < QCanvasItem * > ::const_iterator first =
m_items.begin();
436 double max_z = (*first) -> z ();
439 view =
dynamic_cast<QtView*
> (*first);
446 while ( first !=
m_items.end () ) {
449 vector < Q3CanvasItem * > ::const_iterator first =
m_items.begin();
450 double max_z = (*first) -> z ();
453 view =
dynamic_cast<QtView*
> (*first);
459 while ( first !=
m_items.end () ) {
460 Q3CanvasItem * item = *first;
462 double z = item -> z ();
465 view =
dynamic_cast<QtView*
> (item);
472 max_z = std::max ( max_z, z );
482 #if QT_VERSION < 0x040000
483 vector < QCanvasItem * > ::iterator first =
m_items.begin();
484 while ( first !=
m_items.end() ) {
487 vector < Q3CanvasItem * > ::iterator first =
m_items.begin();
488 while ( first !=
m_items.end() ) {
489 Q3CanvasItem * item = *first++;
491 if ( item->isSelected() )
continue;
492 item->setVisible ( yes );
498 #if QT_VERSION < 0x040000
501 vector < QCanvasItem * > ::iterator first =
m_items.begin ();
502 while ( first !=
m_items.end () ) {
507 vector < Q3CanvasItem * > ::iterator first =
m_items.begin ();
508 while ( first !=
m_items.end () ) {
509 Q3CanvasItem * item = *first++;
511 if ( item != target ) {
512 if ( item -> collidesWith ( target ) ) {
513 if ( item -> selected () == false ) {
514 item -> setSelected (
true );
526 #ifdef ITERATOR_MEMBER_DEFECT
529 #if QT_VERSION < 0x040000
536 Q3CanvasItem * item = *first++;
538 item->setSelected ( state );
555 #if QT_VERSION < 0x040000
556 #ifdef MEMFUN1_DEFECT
564 #ifdef MEMFUN1_DEFECT
566 bind2nd ( mem_fun1 ( &Q3CanvasItem::setSelected ), yes ) );
569 bind2nd ( mem_fun ( &Q3CanvasItem::setSelected ), yes ) );
584 #if QT_VERSION < 0x040000
591 Q3CanvasItem * item = *first++;
593 item->setSelected (
true );
603 #if QT_VERSION < 0x040000
606 const Q3CanvasItem * item = ce -> item ();
613 #if QT_VERSION < 0x040000
620 QRect rect = item->boundingRect ();
621 int x = 0, y = 0, w = 0, h = 0;
622 rect.
rect( & x, & y, & w, & h );
623 #if QT_VERSION < 0x040000
624 QCanvasView::ensureVisible ( x, y, w, h );
626 Q3CanvasView::ensureVisible ( x, y, w, h );
633 #if QT_VERSION < 0x040000
647 const QtView* view =
dynamic_cast<const QtView*
> (item);
649 item->setZ( z + 101.0);
651 item -> setZ ( z + 1.0 );
658 #if QT_VERSION < 0x040000
666 qApp -> postEvent (
this, event );
676 #if QT_VERSION < 0x040000
679 if ( items.empty () )
return;
682 vector < QCanvasItem * >:: const_iterator first = items.begin ();
683 while ( first != items.end () ) {
688 #ifdef MEMFUN1_DEFECT
689 for_each ( items.begin(), items.end(),
692 for_each ( items.begin(), items.end(),
700 if ( items.empty () )
return;
703 vector < Q3CanvasItem * >:: const_iterator first = items.begin ();
704 while ( first != items.end () ) {
705 Q3CanvasItem * item = *first++;
706 item->setActive ( yes );
709 #ifdef MEMFUN1_DEFECT
710 for_each ( items.begin(), items.end(),
711 bind2nd ( mem_fun1 ( &Q3CanvasItem::setActive ), yes ) );
713 for_each ( items.begin(), items.end(),
714 bind2nd ( mem_fun ( &Q3CanvasItem::setActive ), yes ) );
726 #if QT_VERSION < 0x040000
735 #if QT_VERSION < 0x040000
740 QRect rect = sel_item->boundingRect ();
742 view->
setX ( rect.
x() );
743 view->setY ( rect.
y() );
748 view->setSelected (
true );
760 #if QT_VERSION < 0x040000
761 if ( e->
state() == Qt::ShiftButton &&
762 e->
state() == Qt::ControlButton )
return;
764 if ( ( e -> modifiers () & Qt::ShiftModifier ) &&
765 ( e -> modifiers() & Qt::ControlModifier ) )
return;
769 #if QT_VERSION < 0x040000
771 QCanvasItemList::Iterator it = l.begin();
775 Q3CanvasItemList::Iterator it = l.begin();
776 Q3CanvasItem * selItem = 0;
778 for ( ; it!=l.end(); ++it) {
780 #if QT_VERSION < 0x040000
781 vector < QCanvasItem * > ::const_iterator first
783 vector < Q3CanvasItem * > ::const_iterator first
786 if ( first !=
m_items.end () ) {
796 if ( selItem == 0 ) {
799 #if QT_VERSION < 0x040000
800 if ( e->
state() != Qt::ControlButton ) {
802 if ( ( e -> modifiers() & Qt::ControlModifier ) == 0 ) {
818 if (e->
button() == Qt::LeftButton)
823 #if QT_VERSION < 0x040000
826 if (( e -> modifiers () & Qt::ShiftModifier ) &&( !
getZoomMode()))
829 if ( selItem -> isSelected () ) {
836 #if QT_VERSION < 0x040000
837 else if ( e->
state() == Qt::ControlButton )
839 else if ( e -> modifiers() & Qt::ControlModifier )
853 #if QT_VERSION < 0x040000
854 vector < QCanvasItem * > ::const_iterator first
856 vector < Q3CanvasItem * > ::const_iterator first
884 if ( e->
button() == Qt::RightButton ||
885 e->
state() == Qt::RightButton )
890 const QtView* view =
dynamic_cast<const QtView*
> (selItem);
892 selItem->setZ( z + 101.0);
894 selItem -> setZ ( z + 1.0 );
911 #if QT_VERSION < 0x040000
915 Q3CanvasRectangle * rect
916 = dynamic_cast <Q3CanvasRectangle *> (
selectedItem() );
920 int clickMargin = 10;
924 if ( ( p.
x() < rect->x() + clickMargin ) &&
925 ( p.
y() < rect->y() + clickMargin ) )
930 if ( ( p.
x() < ( rect->x() + (rect->width() / 2) + clickMargin ) ) &&
931 ( p.
x() > ( rect->x() + (rect->width() / 2) - clickMargin ) ) &&
932 ( p.
y() < rect->y() + clickMargin ) )
937 if ( ( p.
x() > ( rect->x() + rect->width() - clickMargin ) ) &&
938 ( p.
y() < rect->y() + clickMargin ) )
943 if ( ( p.
x() < rect->x() + clickMargin ) &&
944 ( p.
y() < ( rect->y() + (rect->height() / 2) + clickMargin ) ) &&
945 ( p.
y() > ( rect->y() + (rect->height() / 2) - clickMargin ) ) )
950 if ( ( p.
x() > ( rect->x() + rect->width() - clickMargin ) ) &&
951 ( p.
y() < ( rect->y() + (rect->height() / 2) + clickMargin ) ) &&
952 ( p.
y() > ( rect->y() + (rect->height() / 2) - clickMargin ) ) )
957 if ( ( p.
x() < rect->x() + clickMargin ) &&
958 ( p.
y() > rect->y() + rect->height() - clickMargin ) )
963 if ( ( p.
x() < ( rect->x() + (rect->width() / 2) + clickMargin ) ) &&
964 ( p.
x() > ( rect->x() + (rect->width() / 2) - clickMargin ) ) &&
965 ( p.
y() > rect->y() + rect->height() - clickMargin ) )
970 if ( ( p.
x() > ( rect->x() + rect->width() - clickMargin ) ) &&
971 ( p.
y() > ( rect->y() + rect->height() - clickMargin ) ) )
980 #if QT_VERSION < 0x040000
983 vector < QCanvasItem * > ::iterator last
987 vector < Q3CanvasItem * > ::iterator last
995 #if QT_VERSION < 0x040000
1007 #if QT_VERSION < 0x040000
1010 remove ( Q3CanvasItem * item )
1024 #if QT_VERSION < 0x040000
1027 hide ( Q3CanvasItem * item )
1040 #if QT_VERSION < 0x040000
1041 vector < QCanvasItem * >:: iterator it =
m_items.begin();
1043 vector < Q3CanvasItem * >:: iterator it =
m_items.begin();
1045 for ( ; it !=
m_items.end(); ++it ) {
1046 if ( *it )
delete *it;
1074 #if QT_VERSION < 0x040000
1080 Q3CanvasRectangle * rect
1081 = dynamic_cast <Q3CanvasRectangle *> ( selItem );
1093 float new_x = rect -> x();
1094 float new_y = rect -> y();
1095 float new_w = rect -> width ();
1096 float new_h = rect -> height ();
1117 new_w = new_h * aspect;
1119 new_w = std::max ( new_w, 20.0f );
1120 new_h = std::max ( new_h, 20.0f );
1122 if (view) view -> setDrawRect ( new_x, new_y, new_w, new_h );
1123 if (gv) gv -> setDrawRect ( new_x, new_y, new_w, new_h );
1125 rect->setEnabled (
true );
1136 new_w += aspect * d_y;
1137 new_x -= 0.5 * aspect * d_y;
1140 new_w = std::max ( new_w, 20.0f );
1141 new_h = std::max ( new_h, 20.0f );
1143 if (view) view -> setDrawRect ( new_x, p_y, new_w, new_h );
1144 if (gv) gv -> setDrawRect ( new_x, p_y, new_w, new_h );
1146 rect->setEnabled (
true );
1157 new_w = aspect * new_h;
1160 new_w = std::max ( new_w, 20.0f );
1161 new_h = std::max ( new_h, 20.0f );
1163 if (view) view -> setDrawRect ( new_x, new_y, new_w, new_h );
1164 if (gv) gv->setDrawRect ( new_x, new_y, new_w, new_h );
1166 rect->setEnabled (
true );
1177 new_h += d_x / aspect;
1178 new_w = new_h * aspect;
1181 new_w = std::max ( new_w, 20.0f );
1182 new_h = std::max ( new_h, 20.0f );
1184 if (view) view -> setDrawRect ( new_x, new_y, new_w, new_h );
1185 if (gv) gv -> setDrawRect ( new_x, new_y, new_w, new_h );
1187 rect->setEnabled (
true );
1198 new_h -= d_x / aspect;
1199 new_w = new_h * aspect;
1202 new_w = std::max ( new_w, 20.0f );
1203 new_h = std::max ( new_h, 20.0f );
1205 if (view) view -> setDrawRect ( new_x, new_y, new_w, new_h );
1206 if (gv) gv -> setDrawRect ( new_x, new_y, new_w, new_h );
1208 rect->setEnabled (
true );
1221 new_w = new_h * aspect;
1224 new_w = std::max ( new_w, 20.0f );
1225 new_h = std::max ( new_h, 20.0f );
1227 if (view) view -> setDrawRect ( new_x, new_y, new_w, new_h );
1228 if (gv) gv -> setDrawRect ( new_x, new_y, new_w, new_h );
1230 rect->setEnabled (
true );
1241 new_w = new_h * aspect;
1242 new_x += 0.5 * aspect * d_y;
1244 new_w = std::max ( new_w, 20.0f );
1245 new_h = std::max ( new_h, 20.0f );
1247 if (view) view -> setDrawRect ( new_x, new_y, new_w, new_h );
1248 if (gv) gv -> setDrawRect ( new_x, new_y, new_w, new_h );
1250 rect->setEnabled (
true );
1262 new_w = aspect * new_h;
1265 new_w = std::max ( new_w, 20.0f );
1266 new_h = std::max ( new_h, 20.0f );
1268 if (view) view -> setDrawRect ( new_x, new_y, new_w, new_h );
1269 if (gv) gv -> setDrawRect ( new_x, new_y, new_w, new_h );
1271 rect->setEnabled (
true );
1309 #if QT_VERSION < 0x040000
1331 if ( item -> x () < margin_x ) item -> setX ( margin_x + 1 );
1332 if ( item -> y () < margin_y ) item -> setY ( margin_y + 1 );
1334 if (
m_items.empty () )
return;
1336 double deltax = 1.05 * item -> width ();
1337 double deltay = 1.05 * item -> height ();
1341 QRect brect = item->boundingRect ();
1347 item->setY ( new_y );
1351 #if QT_VERSION < 0x040000
1352 vector < QCanvasItem * >:: iterator it =
m_items.begin();
1354 vector < Q3CanvasItem * >:: iterator it =
m_items.begin();
1356 bool collides =
false;
1358 for ( ; it !=
m_items.end(); ++it ) {
1359 if ( (*it)->collidesWith ( item ) ) {
1365 if ( !collides )
break;
1366 if ( item -> x() + deltax + item -> width () < max_width ) {
1367 item -> moveBy ( deltax, 0 );
1370 item -> setX ( margin_x + 1 );
1371 item -> moveBy ( 0, deltay );
1380 #if QT_VERSION < 0x040000
1383 add ( Q3CanvasItem * item )
1390 item->setSelected (
false );
1393 QRect area = item -> boundingRect ();
1402 #if QT_VERSION < 0x040000
1405 paste ( Q3CanvasItem * item )
1409 #if QT_VERSION < 0x040000
1412 Q3CanvasItemList items = item->collisions (
true );
1414 unsigned int count = items.count ();
1417 item->moveBy ( 10., 10. );
1423 #if QT_VERSION < 0x040000
1429 QRect brect = item->boundingRect ();
1451 resizeContents (
m_apage_w, m_apage_h );
1466 #if QT_VERSION < 0x040000
1471 matrix.scale( 4./3., 4./3. );
1483 #if QT_VERSION < 0x040000
1488 matrix.scale( 3./4., 3./4. );
1497 #if QT_VERSION < 0x040000
1514 QPrinter::PageSize page_size =
s_printer -> pageSize ();
1523 #if QT_VERSION < 0x040000
1527 QPrintDialog dialog (
s_printer,
this );
1528 bool yes = ( dialog.exec () == QDialog::Accepted );
1544 if ( yes ==
false )
return;
1554 const QString name = filename.c_str();
1555 s_printer -> setOutputFileName ( name );
1567 bool ok = painter.
begin ( printer );
1572 painter.
scale ( scale, scale );
1576 while ( page_y < m_canvas->height() ) {
1578 #if QT_VERSION < 0x040000
1584 if ( items.empty () ) {
1590 if ( page_y != 0 ) printer->
newPage();
1615 updateScrollBars ();
1626 updateScrollBars ();
1646 painter.
begin ( pixmap );
1647 painter.translate ( -rect.
x(), -rect.
y() );
1660 QString fn ( filename.c_str() );
1661 string::size_type i = filename.find_last_of (
'.' );
1662 string suffix ( filename.substr ( i + 1 ) );
1663 transform ( suffix.begin(), suffix.end(),
1664 suffix.begin(), toupper );
1665 if ( suffix ==
"JPG" ) suffix =
"JPEG";
1667 pixmap -> save ( fn, suffix.c_str() );
1677 QImage image = pixmap -> convertToImage ();
1688 #if QT_VERSION < 0x040000
1691 Q3ImageDrag * image_drag =
new Q3ImageDrag ( image );
1694 cb -> setData ( image_drag );
1706 QWidget * view_port = viewport ();
1707 view_port -> setMouseTracking ( TRUE );
1711 QWidget * view_port = viewport ();
1712 view_port -> setMouseTracking ( FALSE );
1753 #if QT_VERSION < 0x040000
1771 #if QT_VERSION < 0x040000
1789 #if QT_VERSION < 0X040000
1796 #if QT_VERSION < 0x040000
1798 QCanvasItemList::Iterator it = item_list.begin();
1801 Q3CanvasItemList::Iterator it = item_list.begin();
1808 item->moveBy(dx,dy);
1811 for ( ; it !=item_list.end(); ++it ) {
1812 const QtView * view = dynamic_cast <
const QtView * > ( *it);
1816 (*it)->moveBy(dx,dy);
void initPrinter()
Initializes the printer settings from the saved settings.
void clearSelectedList()
De-selects all items, making the selection list empty.
void addPage()
Adds a page to the canvas.
The base class for the PlotterBase hierarchy.
void addToItemList(QCanvasItem *item)
setWorldMatrix(const QWMatrix &wm)
std::vector< QCanvasItem * > & getSelectedItems()
Return the vector of selected items.
The class of derived from GroupViewBase, QtViewImp and QCanvasRectangle for drawing a grouped view on...
QPoint m_zoom_start
The starting point of a mouse drag.for zoom.
hippodraw::FigureEditor class interface and nested class implementation
const QString & getAppKey() const
Returns a reference the application's QSettings key.
hippodraw::CanvasWindow class interface.
void placeGraph(QCanvasRectangle *)
Moves the QCanvasRectangle object to place on the canvas where it will not collide with existing QCan...
void hide(QCanvasItem *item)
Removes the item from the canvas but not destroys it.
bool m_isMouseDown
The flag of mouse down or not, used when moving multiple plots.
hippodraw::PickTable class interface
int m_apage_w
The actual Page width in Postscript points.
void addSelectedItem(QCanvasItem *item)
Add an item to the selected list.
QCanvasItem * m_preSelected
The view item which is preselected when left mouse button down.
bool m_printer_bounds
A flag to indicate if rectangle display usable printer boundary should be displayed or not...
scale(double sx, double sy)
void leaveEvent(QEvent *)
Grabs the event when mouse cursor leaves the widget.
std::vector< QCanvasItem * > m_selected_list
The list of currently selected QCanvasItem objects.
void whereClicked()
Finds which knob on the selected item was clicked.
The class of derived from ViewBase and QCanvasRectangle for drawing on a QCanvas. ...
collisions(const QPoint &p) const
void contentsMouseMoveEvent(QMouseEvent *, double aspect)
Moves or re-sizes the selected QCanvasItem object.
An Qt event class which wraps a QCanvasItem to be processed by the event.
void ensureVisible(const QCanvasItem *item)
Scrolls the canvas, if needed, so the QCanvasItem item is visible.
int m_upage_h
The usable Page height in Postscript points.
PlotterBase * getPlotter() const
Returns the plotter used by this view.
insertSearchPath(System s, const QString &path)
const QString & getRegistry() const
Returns a reference to the application's registry.
QCanvasItem * getRightItem()
Get the QCanvasItem clicked by right mouse button.
void resizeCanvasToFit(QCanvasItem *item)
Re-sizes the canvas if necessary so that the item is on the canvas.
QCanvasItem * m_rightItem
The view item which is clicked with right mouse button when contentsMousePressEvent() happens...
double maximumZ() const
Returns the largest Z value of all the items on the canvas.
void setZoomMode(bool flag)
Sets the zoom mode to flag.
rect(int *x, int *y, int *w, int *h) const
virtual PlotterBase * getParentPlotter() const
Returns the parent plotter.
hippodraw::PlotterBase class interface.
void showPrinterMargins(bool on)
Sets showing the printer margins on or off.
QCanvas * m_canvas
The canvas object.
QPoint m_mouse_down
The point of a mouse down, used when moving multiple plots.
static QPrinter::ColorMode indexToColorMode[]
An array to allow conversion of integer to enumeration.
void savePrinterSettings()
Saves the printer setting with QSettings.
void saveSelectedAsPixmap(const std::string &filename)
Save the selected objects as Pixmap image file filename.
QImage createImage(const QRect &rectange) const
Creates and returns a QImage from the area defined on the canvas.
QCanvasItem * selectedItem() const
Returns the selected QCanvasItem.
bool m_ignore_margin
a flag set to true if the printer margins should be ignored when adding a plot to the canvas...
intp size(numeric::array arr)
void setSelectedItem(QCanvasItem *)
Set the selected QCanvasItem.
void mouseMoveMultiItem(QMouseEvent *e)
Move more than one items in the Canvas.
void viewZoomOut()
Reduces the view of the canvas.
virtual void controlMousePressEvent()=0
Handles details of mouse press event with shift key pressed.
static QString s_registry
The QSettings Windows registry key.
QPixmap * createPixmap(const QRect &rectangle) const
Creates and returns a new QPixmap from the area defined on the canvas.
setOverrideCursor(const QCursor &cursor, bool replace=FALSE)
static void setAppKey(const std::string &)
Sets the QSettings application key.
bool isSingleItemSelected() const
Returns true if just one item is selected, else returns false.
virtual void print()
Prints the view to the printer.
void viewZoomIn()
Enlarges the view of the canvas.
void removeSelectedItem(QCanvasItem *item)
Removes an item from the selection list.
static QPrinter * s_printer
The single QPrinter instance.
virtual void contentsMousePressEvent(QMouseEvent *)
void movePlotterWithText(QCanvasItem *item, float dx, float dy)
Move a plotter with all its targetted text plotters.
void setUnselectedVisible(bool yes)
Sets the unselected items to visible or not.
writeEntry(const QString &key, bool value)
virtual void customEvent(QCustomEvent *event)
The receiver of Qt custom events.
bool m_zoom_mode
Set to true if zoom Mode is enabled.
void contentsMouseReleaseEvent(QMouseEvent *)
Handles details of mouse release, right button.
onCanvas(int x, int y) const
void saveAreaAsPixmap(const QRect &area, const std::string &filename)
Saves the area area as pixmap to file filename.
void paste(QCanvasItem *item)
Adds the item to the canvas.
readNumEntry(const QString &key, int def=0, bool *ok=0) const
int m_apage_h
The actual Page height in Postscript points.
setOrientation(Orientation orientation)
double m_scale_factor
The scale factor.
void setPrinterSettings()
Set the default printer settings.
void setSelectedFlags()
Set the selected flags.
virtual bool isTextPlotter() const
Return true if it's a text plotter.
void viewZoomReset()
Returns the view to normal size.
This class implements additional QCanvasView functionality.
void removeFromItemList(QCanvasItem *item)
Removes the item from list of items on the canvas.
void makeVisible(const QCanvasItem *item)
Scrolls the canvas, if needed, so the QCanvasItem item is visible.
void setLocked(bool flag)
Sets the selected QCanvasItem to be locked in size and position.
void calcPrinterMetrics(QPaintDevice *)
Calculate the size of a page by using the printer metrics.
std::vector< QCanvasItem * > m_items
The list of view items on the canvas.
void add(QCanvasItem *item)
Adds the item to the canvas.
QPoint m_moving_start
The starting point of a mouse drag.
void resizeEvent(QResizeEvent *e)
Re-sizes the QCanvas in response to parent window receiving QResizeEvent.
void setSelectedItems(bool state)
Sets the selected items to selection state state.
translate(double dx, double dy)
setPageSize(PageSize newPageSize)
static QString s_app_key
The QSettings application key for searching for setting.
void placeGraphOnSelected(QCanvasRectangle *item)
Adds the item on top of the currently selected item.
void scaleBy(double factor)
Scales the size of the images by factor.
void addPageMargin(int x, int y)
Adds page margin.
QRect getSelectedBounds() const
Returns a QRect that enclosed the selected QCanvasItem objects.
static QPrinter::PageSize indexToPageSize[]
An array to allow conversion of integer to enumeration.
setColorMode(ColorMode newColorMode)
bool getZoomMode() const
Returns the bool indicating whether zoom mode is enabled or not.
static QPrinter::Orientation indexToOrientation[]
An array to allow conversion of integer to enumeration.
void clear()
Removes all items from canvas and destroy them.
begin(const QPaintDevice *pd, bool unclipped=FALSE)
void setAllSelected(bool flag=true)
Sets selection flag on all QCanvasItem objects.
drawArea(const QRect &clip, QPainter *painter, bool dbuf=FALSE)
void copySelectedToClipboard()
Adds selected items to system clipboard.
Location m_whereClicked
Location where the mouse cursor clicked the object.
hippodraw::QtGroupView class interface
void enterEvent(QEvent *)
Grabs the event when mouse cursor enters the widget.
void setCollidingSelected(const QCanvasItem *target)
Sets all QCanvasItems that collide with target to selected state.
inverseWorldMatrix() const
virtual void notifyObservers()=0
Notifies Observer objects, if any, that something has changed.
int m_upage_w
The usable Page width in Postscript points.