notepad::CNPoint Class Reference

#include <notepad_point.h>

Public Member Functions

 ~CNPoint ()
 CNPoint (const CNPoint &)
CNPointoperator= (const CNPoint &)
 CNPoint (int an_X, int a_Y)
 CNPoint (const ScbPoint &p)
ScbPoint deviceView ()
ScbPoint windowView ()
ScbPoint storageView ()

Static Public Member Functions

static void setRotation (np_rotation aRotation)
static void setClipBorder (int border)
static void setBorders (int left, int right, int top, int bottom)
static void setScreen (int w, int h)

Detailed Description

Definition at line 38 of file notepad_point.h.


Constructor & Destructor Documentation

notepad::CNPoint::~CNPoint (  ) 

Definition at line 41 of file notepad_point.cpp.

00042     {
00043     }

notepad::CNPoint::CNPoint ( const CNPoint src  ) 

Definition at line 45 of file notepad_point.cpp.

00046     {
00047         x = src.x;
00048         y = src.y;
00049     }

notepad::CNPoint::CNPoint ( int  an_X,
int  a_Y 
)

Definition at line 59 of file notepad_point.cpp.

References notepad::NP_ANTICLOCKWISE, notepad::NP_CLOCKWISE, and notepad::NP_PORTRAIT.

00061         :
00062             x(0),
00063             y(0)
00064     {
00065         //LOGPRINTF("X = %d, Y = %d", an_X, a_Y);
00066 
00067         if ( rotation == NP_PORTRAIT )
00068         {
00069             x = an_X + left_border;
00070             y = a_Y + top_border;
00071         }
00072         else if ( rotation == NP_CLOCKWISE) 
00073         {
00074             x = a_Y + top_border;
00075             y = screen_width - an_X - left_border;
00076         }
00077         else if ( rotation == NP_ANTICLOCKWISE) 
00078         {
00079             x = screen_height - a_Y - bottom_border;
00080             y = an_X + left_border;
00081         }
00082 
00083         clipToMaxBorder();
00084  
00085         // Post: instance inv. holds: x and y delta coordinates
00086         //LOGPRINTF("this->x = %d, this->y = %d", x,y);
    }

notepad::CNPoint::CNPoint ( const ScbPoint p  ) 

Definition at line 89 of file notepad_point.cpp.

References _ScbPoint::x, and _ScbPoint::y.

00091         :
00092             x(0),
00093             y(0)
00094     {
00095         x = p.x + left_border;
00096         y = p.y + top_border; 
    }


Member Function Documentation

ScbPoint notepad::CNPoint::deviceView (  ) 

Definition at line 99 of file notepad_point.cpp.

References _ScbPoint::x, and _ScbPoint::y.

Referenced by notepad::CNotepadDoc::on_scribble_begin(), notepad::CNotepadDoc::on_scribble_end(), and notepad::CNotepadDoc::on_scribble_move().

00100     {
00101         ScbPoint p = {0,0};
00102         p.x = x;
00103         p.y = y;
00104         return p;
00105     }

Here is the caller graph for this function:

CNPoint & notepad::CNPoint::operator= ( const CNPoint rhs  ) 

Definition at line 51 of file notepad_point.cpp.

00052     {
00053         x = rhs.x;
00054         y = rhs.y;
00055         return *this;
00056     }

void notepad::CNPoint::setBorders ( int  left,
int  right,
int  top,
int  bottom 
) [static]

Definition at line 154 of file notepad_point.cpp.

References CNMAX.

00155     {
00156         max_border = 0;
00157 
00158         left_border = left;
00159         right_border = right;
00160         top_border = top;
00161         bottom_border = bottom;
00162 
00163         max_border = CNMAX(max_border, left_border);
00164         max_border = CNMAX(max_border, right_border);
00165         max_border = CNMAX(max_border, top_border);
00166         max_border = CNMAX(max_border, bottom_border);
00167     }

void notepad::CNPoint::setClipBorder ( int  border  )  [static]

Definition at line 169 of file notepad_point.cpp.

Referenced by notepad::CNotepadWindow::set_rotation().

00170     {
00171         max_border = border+1; // just 1px within
00172     }

Here is the caller graph for this function:

void notepad::CNPoint::setRotation ( np_rotation  aRotation  )  [static]

Definition at line 137 of file notepad_point.cpp.

References LOGPRINTF, and notepad::NP_PORTRAIT.

Referenced by notepad::CNotepadWindow::set_rotation().

00138     {
00139         // there are only 4 relevant transitions.
00140         // others do not happen (e.g. landscape clockwise to landscape anticlockwise
00141         if (rotation == NP_PORTRAIT)
00142         {
00143             if (aRotation != rotation )
00144             {
00145                 int temp = screen_width;
00146                 screen_width = screen_height;
00147                 screen_height = temp;
00148             }
00149         }
00150         rotation = aRotation;
00151         LOGPRINTF("width = %d, height = %d, left = %d, right = %d, top = %d, bottom = %d", screen_width, screen_height, left_border, right_border, top_border, bottom_border);
00152     }

Here is the caller graph for this function:

void notepad::CNPoint::setScreen ( int  w,
int  h 
) [static]

Definition at line 174 of file notepad_point.cpp.

Referenced by notepad::CNotepadWindow::set_rotation().

00175     {
00176         CNPoint::screen_width = w;
00177         CNPoint::screen_height = h;
00178     }

Here is the caller graph for this function:

ScbPoint notepad::CNPoint::storageView (  ) 

Definition at line 129 of file notepad_point.cpp.

References _ScbPoint::x, and _ScbPoint::y.

Referenced by notepad::CNotepadDoc::on_erase_begin(), notepad::CNotepadDoc::on_erase_end(), notepad::CNotepadDoc::on_erase_move(), notepad::CNotepadDoc::on_scribble_begin(), notepad::CNotepadDoc::on_scribble_end(), and notepad::CNotepadDoc::on_scribble_move().

00130     {
00131         ScbPoint p = {0,0};
00132         p.x = x - left_border;
00133         p.y = y - top_border;
00134         return p;
00135     }

Here is the caller graph for this function:

ScbPoint notepad::CNPoint::windowView (  ) 

Definition at line 108 of file notepad_point.cpp.

References notepad::NP_ANTICLOCKWISE, notepad::NP_CLOCKWISE, notepad::NP_PORTRAIT, _ScbPoint::x, and _ScbPoint::y.

00109     {
00110         ScbPoint p = {0,0};
00111         if ( rotation == NP_PORTRAIT )
00112         {
00113             p.x = x - left_border;
00114             p.y = y - top_border;
00115         }
00116         else if ( rotation == NP_CLOCKWISE) 
00117         {
00118             p.x = screen_width - y - left_border;
00119             p.y = x - top_border;
00120         }
00121         else if ( rotation == NP_ANTICLOCKWISE) 
00122         {
00123             p.x = y - left_border;
00124             p.y = screen_height - bottom_border - x;
00125         }
00126         return p;
00127     }


The documentation for this class was generated from the following files:
Generated by  doxygen 1.6.2-20100208