Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

Viewport Class Reference

#include <viewport.h>

Inheritance diagram for Viewport:

Display List of all members.

Public Methods

void FastDraw (void)
void Done (void)
 Viewport (Viewport *parent, int x1, int y1, int x2, int y2)
 Viewport (void)
void SetColor (int c)
void SetBkColor (int c)
void SetFillStyle (int pat, int col)
void SetLineStyle (int st, unsigned pat, int thick)
void SetTextStyle (int fnt, int dir, int size)
void SetTextJustify (int hor, int ver)
int TextHeight (char *s)
int TextWidth (char *s)
int GetBkColor (void)
int GetColor (void)
int GetMaxColor (void)
int GetMaxX (void)
int GetMaxY (void)
int GetX (void)
int GetY (void)
int TransX (int x)
int TransY (int y)
bool InBounds (int x, int y)
void Bar (int x1, int y1, int x2, int y2)
void Circle (int x, int y, int r)
void Clear ()
void FillEllipse (int x, int y, int xr, int yr)
void FloodFill (int x, int y, int border)
void GetImage (int x1, int y1, int x2, int y2, void far *img)
unsigned GetPixel (int x, int y)
void Line (int x1, int y1, int x2, int y2)
void LineRel (int dx, int dy)
void LineTo (int x, int y)
void MoveRel (int dx, int dy)
void MoveTo (int x, int y)
void OutText (char *s)
void OutTextXY (int x, int y, char *s)
void PutImage (int x, int y, void far *img, int op)
void PutPixel (int x, int y, int clr)
void Rectangle (int x1, int y1, int x2, int y2)

Protected Methods

void Install (void)
void SwitchTo (void)
void DoDraw (void)
void DoneDraw (void)

Protected Attributes

ViewSettings SView
ColorSettings SColor
FillSettings SFill
LineSettings SLine
TextSettings SText
Position SPos
Viewport * Parent

Static Protected Attributes

Viewport * Context = NULL
int Fast = 0

Constructor & Destructor Documentation

Viewport::Viewport Viewport *    parent,
int    x1,
int    y1,
int    x2,
int    y2
 

Definition at line 23 of file viewport.c.

References Install(), Parent, SView, ViewSettings::X1, ViewSettings::X2, ViewSettings::Y1, and ViewSettings::Y2.

00024 : SView (x1, y1, x2, y2)
00025 {
00026   Parent = parent;
00027   if (Parent)
00028   {
00029     SView.X1 += Parent->SView.X1;
00030     SView.Y1 += Parent->SView.Y1;
00031     SView.X2 += Parent->SView.X1;
00032     SView.Y2 += Parent->SView.Y1;
00033   }
00034   Install ();
00035 }

Viewport::Viewport void   
 

Definition at line 37 of file viewport.c.

References Install(), and Parent.

00038 {
00039   Parent = NULL;
00040   Install ();
00041 }


Member Function Documentation

void Viewport::Bar int    x1,
int    y1,
int    x2,
int    y2
[inline]
 

Definition at line 158 of file viewport.h.

References DoDraw(), DoneDraw(), and SwitchTo().

Referenced by CheckBox::Draw(), PushButton::Draw(), CheckBox::empty_box(), Window::Erase(), CheckBox::Erase(), and PushButton::Erase().

00159     { SwitchTo (); DoDraw (); bar (x1, y1, x2, y2); DoneDraw ();}

void Viewport::Circle int    x,
int    y,
int    r
[inline]
 

Definition at line 160 of file viewport.h.

References DoDraw(), DoneDraw(), and SwitchTo().

Referenced by Nodes::animate_frame(), and CheckBox::animate_frame().

00161     { SwitchTo (); DoDraw (); circle (x, y, r); DoneDraw ();}

void Viewport::Clear  
 

Definition at line 56 of file viewport.c.

References ColorSettings::BG, Context, DoDraw(), DoneDraw(), SColor, SPos, SView, SwitchTo(), Position::X, ViewSettings::X2, Position::Y, and ViewSettings::Y2.

Referenced by PlayerWindow::Clear(), Window::Draw(), TextWin::Draw(), PlayerWindow::Draw(), MapWindow::Draw(), KeyWindow::Draw(), InfoWindow::Draw(), Window::DrawTitle(), UserInterface::Intro(), and UserInterface::UFWOOM().

00057 {
00058   SwitchTo ();
00059   DoDraw ();
00060   setfillstyle (SOLID_FILL, SColor.BG);
00061   bar (0, 0, SView.X2, SView.Y2);
00062   DoneDraw ();
00063   SPos.X = SPos.Y = 0;
00064   Context = NULL;
00065 }

void Viewport::DoDraw void    [inline, protected]
 

Definition at line 112 of file viewport.h.

References Fast.

Referenced by Bar(), Circle(), Clear(), FillEllipse(), FloodFill(), Line(), LineRel(), LineTo(), OutText(), OutTextXY(), PutImage(), PutPixel(), and Rectangle().

00112 { if (!Fast) Mouse.Hide (); }

void Viewport::Done void    [inline]
 

Definition at line 117 of file viewport.h.

References Fast.

Referenced by Nodes::animate_frame(), CheckBox::animate_frame(), PushButton::depress_button(), Group::disable_proc(), Window::Draw(), TextWin::Draw(), PlayerWindow::Draw(), Nodes::Draw(), MapWindow::Draw(), KeyWindow::Draw(), InfoWindow::Draw(), Group::Draw(), CheckBox::Draw(), PushButton::Draw(), Nodes::empty_box(), CheckBox::empty_box(), Group::enable_proc(), Group::Erase(), CheckBox::Erase(), Nodes::fill_box(), CheckBox::fill_box(), and PushButton::redraw().

00117 { Fast--; if (!Fast) Mouse.Show (); }

void Viewport::DoneDraw void    [inline, protected]
 

Definition at line 113 of file viewport.h.

References Fast.

Referenced by Bar(), Circle(), Clear(), FillEllipse(), FloodFill(), Line(), LineRel(), LineTo(), OutText(), OutTextXY(), PutImage(), PutPixel(), and Rectangle().

00113 { if (!Fast) Mouse.Show (); }

void Viewport::FastDraw void    [inline]
 

Definition at line 116 of file viewport.h.

References Fast.

Referenced by Nodes::animate_frame(), CheckBox::animate_frame(), PushButton::depress_button(), Group::disable_proc(), Window::Draw(), TextWin::Draw(), PlayerWindow::Draw(), Nodes::Draw(), MapWindow::Draw(), KeyWindow::Draw(), InfoWindow::Draw(), Group::Draw(), CheckBox::Draw(), PushButton::Draw(), Nodes::empty_box(), CheckBox::empty_box(), Group::enable_proc(), Group::Erase(), CheckBox::Erase(), Nodes::fill_box(), CheckBox::fill_box(), and PushButton::redraw().

00116 { if (!Fast) Mouse.Hide (); Fast++; }

void Viewport::FillEllipse int    x,
int    y,
int    xr,
int    yr
[inline]
 

Definition at line 163 of file viewport.h.

References DoDraw(), DoneDraw(), and SwitchTo().

Referenced by Nodes::Draw(), CheckBox::Draw(), Nodes::empty_box(), CheckBox::empty_box(), Nodes::fill_box(), and CheckBox::fill_box().

00164     { SwitchTo (); DoDraw (); fillellipse (x, y, xr, yr); DoneDraw ();}

void Viewport::FloodFill int    x,
int    y,
int    border
[inline]
 

Definition at line 165 of file viewport.h.

References DoDraw(), DoneDraw(), and SwitchTo().

00166     { SwitchTo (); DoDraw (); floodfill (x, y, border); DoneDraw ();}

int Viewport::GetBkColor void    [inline]
 

Definition at line 145 of file viewport.h.

References ColorSettings::BG.

Referenced by Window::Erase(), CheckBox::Erase(), PushButton::Erase(), Nodes::Init(), and CheckBox::Init().

00145 { return SColor.BG; }

int Viewport::GetColor void    [inline]
 

Definition at line 146 of file viewport.h.

References ColorSettings::FG.

00146 { return SColor.FG; }

void Viewport::GetImage int    x1,
int    y1,
int    x2,
int    y2,
void far *    img
[inline]
 

Definition at line 167 of file viewport.h.

References SwitchTo().

Referenced by PushButton::name_button(), and PopUpWin::PrepScreen().

00168     { SwitchTo (); getimage (x1, y1, x2, y2, img); }

int Viewport::GetMaxColor void    [inline]
 

Definition at line 147 of file viewport.h.

00147 { return Screen.GetMaxColor (); }

int Viewport::GetMaxX void    [inline]
 

Definition at line 148 of file viewport.h.

References ViewSettings::X1, and ViewSettings::X2.

Referenced by UserInterface::AboutButton(), TextWin::Draw(), InfoWindow::Draw(), Window::DrawTitle(), InBounds(), CPanelWindow::Init(), UserInterface::Intro(), MessageWin(), PushButton::name_button(), MapWindow::Scale(), UserInterface::ShowSpyMoves(), UserInterface::TransPop(), and UserInterface::UFWOOM().

00148 { return (SView.X2 - SView.X1); }

int Viewport::GetMaxY void    [inline]
 

Definition at line 149 of file viewport.h.

References ViewSettings::Y1, and ViewSettings::Y2.

Referenced by UserInterface::AboutButton(), InBounds(), UserInterface::Intro(), MessageWin(), PushButton::name_button(), MapWindow::Scale(), UserInterface::ShowSpyMoves(), UserInterface::TransPop(), and UserInterface::UFWOOM().

00149 { return (SView.Y2 - SView.Y1); }

unsigned Viewport::GetPixel int    x,
int    y
[inline]
 

Definition at line 169 of file viewport.h.

References SwitchTo().

00170     { SwitchTo (); return getpixel (x, y); }

int Viewport::GetX void    [inline]
 

Definition at line 150 of file viewport.h.

References Position::X.

00150 { return SPos.X; }

int Viewport::GetY void    [inline]
 

Definition at line 151 of file viewport.h.

References Position::Y.

00151 { return SPos.Y; }

bool Viewport::InBounds int    x,
int    y
 

Definition at line 85 of file viewport.c.

References GetMaxX(), and GetMaxY().

00086 {
00087   return (bool) ((x >= 0) && (x <= GetMaxX()) &&
00088      (y >= 0) && (y <= GetMaxY()));
00089 }

void Viewport::Install void    [protected]
 

Definition at line 44 of file viewport.c.

References Context, Position::Install(), TextSettings::Install(), LineSettings::Install(), FillSettings::Install(), ColorSettings::Install(), ViewSettings::Install(), SColor, SFill, SLine, SPos, SText, and SView.

Referenced by SwitchTo(), and Viewport().

00045 {
00046   SView.Install ();
00047   SColor.Install ();
00048   SFill.Install ();
00049   SLine.Install ();
00050   SText.Install ();
00051   SPos.Install ();
00052   Context = this;
00053 }

void Viewport::Line int    x1,
int    y1,
int    x2,
int    y2
[inline]
 

Definition at line 171 of file viewport.h.

References DoDraw(), DoneDraw(), and SwitchTo().

Referenced by MapWindow::ConnectNode(), PushButton::depress_button(), CheckBox::draw_check(), PushButton::draw_shadows(), and Window::DrawTitle().

00172     { SwitchTo (); DoDraw (); line (x1, y1, x2, y2); DoneDraw ();}

void Viewport::LineRel int    dx,
int    dy
[inline]
 

Definition at line 173 of file viewport.h.

References DoDraw(), DoneDraw(), Position::Save(), and SwitchTo().

00174     { SwitchTo (); DoDraw (); linerel (dx, dy); DoneDraw (); SPos.Save (); }

void Viewport::LineTo int    x,
int    y
[inline]
 

Definition at line 175 of file viewport.h.

References DoDraw(), DoneDraw(), Position::Save(), and SwitchTo().

00176     { SwitchTo (); DoDraw (); lineto (x, y); DoneDraw (); SPos.Save (); }

void Viewport::MoveRel int    dx,
int    dy
[inline]
 

Definition at line 177 of file viewport.h.

References Position::Save(), and SwitchTo().

Referenced by TextWin::Draw().

00178     { SwitchTo (); moverel (dx, dy);  SPos.Save (); }

void Viewport::MoveTo int    x,
int    y
[inline]
 

Definition at line 179 of file viewport.h.

References Position::Save(), and SwitchTo().

Referenced by TextWin::Draw().

00180     { SwitchTo (); moveto (x, y);  SPos.Save (); }

void Viewport::OutText char *    s [inline]
 

Definition at line 181 of file viewport.h.

References DoDraw(), DoneDraw(), and SwitchTo().

Referenced by TextWin::Draw().

00182     { SwitchTo (); DoDraw (); outtext (s); DoneDraw ();}

void Viewport::OutTextXY int    x,
int    y,
char *    s
[inline]
 

Definition at line 183 of file viewport.h.

References DoDraw(), DoneDraw(), and SwitchTo().

Referenced by UserInterface::AboutButton(), InfoWindow::Draw(), PlayerWindow::DrawInfo(), Window::DrawTitle(), UserInterface::Intro(), CheckBox::name_button(), PushButton::name_button(), UserInterface::ShowSpyMoves(), and UserInterface::UFWOOM().

00184     { SwitchTo (); DoDraw (); outtextxy (x, y, s); DoneDraw ();}

void Viewport::PutImage int    x,
int    y,
void far *    img,
int    op
[inline]
 

Definition at line 185 of file viewport.h.

References DoDraw(), DoneDraw(), and SwitchTo().

Referenced by PopUpWin::Erase(), and PushButton::name_button().

00186     { SwitchTo (); DoDraw (); putimage (x, y, img, op); DoneDraw ();}

void Viewport::PutPixel int    x,
int    y,
int    clr
[inline]
 

Definition at line 187 of file viewport.h.

References DoDraw(), DoneDraw(), and SwitchTo().

00188     { SwitchTo (); DoDraw (); putpixel (x, y, clr); DoneDraw ();}

void Viewport::Rectangle int    x1,
int    y1,
int    x2,
int    y2
[inline]
 

Definition at line 189 of file viewport.h.

References DoDraw(), DoneDraw(), and SwitchTo().

Referenced by CheckBox::animate_frame(), CheckBox::Draw(), PushButton::draw_frame(), Window::DrawBorder(), and PushButton::name_button().

00190     { SwitchTo (); DoDraw (); rectangle (x1, y1, x2, y2); DoneDraw ();}

void Viewport::SetBkColor int    c [inline]
 

Definition at line 126 of file viewport.h.

References ColorSettings::BG.

Referenced by Window::Init(), MapWindow::Init(), KeyWindow::Init(), InfoWindow::Init(), CPanelWindow::Init(), UserInterface::Intro(), and UserInterface::UFWOOM().

00126 { SColor.BG = c;  Context = NULL; }

void Viewport::SetColor int    c [inline]
 

Definition at line 125 of file viewport.h.

References ColorSettings::FG.

Referenced by Nodes::animate_frame(), CheckBox::animate_frame(), MapWindow::ConnectNode(), PushButton::depress_button(), TextWin::Draw(), Nodes::Draw(), InfoWindow::Draw(), CheckBox::Draw(), PushButton::draw_frame(), PushButton::draw_shadows(), Window::DrawBorder(), PlayerWindow::DrawInfo(), Window::DrawTitle(), Nodes::empty_box(), CheckBox::empty_box(), Nodes::fill_box(), CheckBox::fill_box(), Window::Init(), MapWindow::Init(), KeyWindow::Init(), InfoWindow::Init(), CPanelWindow::Init(), UserInterface::Intro(), CheckBox::name_button(), PushButton::name_button(), UserInterface::ShowSpyMoves(), and UserInterface::UFWOOM().

00125 { SColor.FG = c;  Context = NULL; }

void Viewport::SetFillStyle int    pat,
int    col
[inline]
 

Definition at line 127 of file viewport.h.

References FillSettings::Color, and FillSettings::Pattern.

Referenced by Nodes::Draw(), CheckBox::Draw(), PushButton::Draw(), Nodes::empty_box(), CheckBox::empty_box(), Window::Erase(), CheckBox::Erase(), PushButton::Erase(), Nodes::fill_box(), and CheckBox::fill_box().

00128     { SFill.Pattern = pat;  SFill.Color = col;  Context = NULL; }

void Viewport::SetLineStyle int    st,
unsigned    pat,
int    thick
[inline]
 

Definition at line 129 of file viewport.h.

References LineSettings::Pattern, LineSettings::Style, and LineSettings::Thickness.

Referenced by Nodes::animate_frame(), CheckBox::animate_frame(), MapWindow::ConnectNode(), CheckBox::draw_check(), PushButton::draw_frame(), and Window::DrawBorder().

00130     { SLine.Style = st;  SLine.Pattern = pat;  SLine.Thickness = thick;
00131       Context = NULL; }

void Viewport::SetTextJustify int    hor,
int    ver
[inline]
 

Definition at line 135 of file viewport.h.

References TextSettings::HJust, and TextSettings::VJust.

Referenced by UserInterface::AboutButton(), TextWin::Draw(), PlayerWindow::DrawInfo(), Window::Init(), MapWindow::Init(), KeyWindow::Init(), InfoWindow::Init(), CPanelWindow::Init(), UserInterface::Intro(), and PushButton::name_button().

00136     { SText.HJust = hor;  SText.VJust = ver;
00137       Context = NULL; }

void Viewport::SetTextStyle int    fnt,
int    dir,
int    size
[inline]
 

Definition at line 132 of file viewport.h.

References TextSettings::CharSize, TextSettings::Direction, and TextSettings::Font.

Referenced by UserInterface::AboutButton(), TextWin::CalcDim(), TextWin::Draw(), InfoWindow::Draw(), PlayerWindow::DrawInfo(), Window::Init(), MapWindow::Init(), KeyWindow::Init(), InfoWindow::Init(), CPanelWindow::Init(), UserInterface::Intro(), CheckBox::name_button(), PushButton::name_button(), CheckBox::set_constants(), PushButton::set_constants(), and UserInterface::UFWOOM().

00133     { SText.Font = fnt;  SText.Direction = dir;  SText.CharSize = size;
00134       Context = NULL; }

void Viewport::SwitchTo void    [inline, protected]
 

Definition at line 109 of file viewport.h.

References Install().

Referenced by Bar(), Circle(), Clear(), FillEllipse(), FloodFill(), GetImage(), GetPixel(), Line(), LineRel(), LineTo(), MoveRel(), MoveTo(), OutText(), OutTextXY(), PutImage(), PutPixel(), Rectangle(), TextHeight(), and TextWidth().

00109 { if (Context != this) Install (); }

int Viewport::TextHeight char *    s [inline]
 

Definition at line 141 of file viewport.h.

References SwitchTo().

Referenced by TextWin::CalcDim(), CheckBox::set_constants(), and PushButton::set_constants().

00142     { SwitchTo ();  return textheight (s); }

int Viewport::TextWidth char *    s [inline]
 

Definition at line 143 of file viewport.h.

References SwitchTo().

Referenced by TextWin::CalcDim(), InfoWindow::Draw(), CheckBox::set_constants(), and PushButton::set_constants().

00144     { SwitchTo ();  return textwidth (s);  }

int Viewport::TransX int    x
 

Definition at line 68 of file viewport.c.

References Parent, SView, and ViewSettings::X1.

Referenced by Display::Dispatch().

00069 {
00070   if (!Parent)
00071     return x;
00072   else
00073     return (x - (Parent->TransX (SView.X1)));
00074 }

int Viewport::TransY int    y
 

Definition at line 76 of file viewport.c.

References Parent, SView, and ViewSettings::Y1.

Referenced by Display::Dispatch().

00077 {
00078   if (!Parent)
00079     return y;
00080   else
00081     return (y - (Parent->TransY (SView.Y1)));
00082 }


Member Data Documentation

Viewport * Viewport::Context = NULL [static, protected]
 

Definition at line 15 of file viewport.c.

Referenced by Clear(), and Install().

int Viewport::Fast = 0 [static, protected]
 

Definition at line 16 of file viewport.c.

Referenced by DoDraw(), Done(), DoneDraw(), and FastDraw().

Viewport* Viewport::Parent [protected]
 

Definition at line 105 of file viewport.h.

Referenced by TransX(), TransY(), and Viewport().

ColorSettings Viewport::SColor [protected]
 

Definition at line 100 of file viewport.h.

Referenced by Clear(), and Install().

FillSettings Viewport::SFill [protected]
 

Definition at line 101 of file viewport.h.

Referenced by Install().

LineSettings Viewport::SLine [protected]
 

Definition at line 102 of file viewport.h.

Referenced by Install().

Position Viewport::SPos [protected]
 

Definition at line 104 of file viewport.h.

Referenced by Clear(), and Install().

TextSettings Viewport::SText [protected]
 

Definition at line 103 of file viewport.h.

Referenced by Install().

ViewSettings Viewport::SView [protected]
 

Definition at line 99 of file viewport.h.

Referenced by Clear(), Install(), TransX(), TransY(), and Viewport().


The documentation for this class was generated from the following files:
Generated on Sun Jul 6 23:07:18 2003 for Scotland Yard by doxygen1.2.15