home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The World of Computer Software
/
World_Of_Computer_Software-02-385-Vol-1of3.iso
/
g
/
gina15.zip
/
demos
/
gredit
/
ViewObjectDraw
< prev
Wrap
Text File
|
1992-02-27
|
1KB
|
50 lines
// This may look like C code, but it is really -*- C++ -*-
// Module : ViewObjectDrawer.C Version 1.2
// LastSCCS : 2/26/92 16:37:02
// LastEdit : "Fri Feb 21 09:30:00 1992"
// Description :
// Author :
// Copyright : GMD Schloss Birlinghoven
ViewObjectDrawer::
ViewObjectDrawer( GnView *view, int x, int y )
: GnMouseDownCommand( view->get_document(), view, x, y )
{
view_object = 0;
}
void ViewObjectDrawer ::
constrain_mouse( int &x, int &y )
{
x = MAX( x, start_x + 2 );
y = MAX( y, start_y + 2 );
}
void ViewObjectDrawer ::
doit()
{
constrain_mouse(last_x, last_y);
int wid = ABS(last_x - start_x);
int hei = ABS(last_y - start_y);
create_view_object(wid, hei);
view_object->
setGC_line_width(((GraphicEditorView *)view)->GetDefaultLineWidth());
view_object->install(view, start_x, start_y);
}
void ViewObjectDrawer ::
undoit()
{
view_object->deinstall();
}
void ViewObjectDrawer ::
redoit()
{
view_object->install(view, start_x, start_y);
}