Back to index

easystroke  0.5.5.1
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
Shape Class Reference

#include <shape.h>

Inheritance diagram for Shape:
Inheritance graph
[legend]
Collaboration diagram for Shape:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 Shape ()
virtual void timeout ()
virtual ~Shape ()
void draw (Point p)
void start (Point p)
void end ()

Protected Member Functions

bool remove_timeout ()
void set_timeout (int ms)

Private Member Functions

virtual void draw (Point p, Point q)
virtual void start_ ()
virtual void end_ ()
void clear ()

Private Attributes

Window win

Detailed Description

Definition at line 22 of file shape.h.


Constructor & Destructor Documentation

Definition at line 23 of file shape.cc.

             {
       int w = gdk_screen_width();
       int h = gdk_screen_height();
       Gdk::Color col = prefs.color.get().color;
       unsigned long bg = ((col.get_red()/257)<<16) + ((col.get_green()/257)<<8) + col.get_blue()/257;
       win = XCreateSimpleWindow(dpy, ROOT, 0, 0, w, h, 0, CopyFromParent, bg);
       XSetWindowAttributes attr;
       attr.override_redirect = True;
       XChangeWindowAttributes(dpy, win, CWOverrideRedirect, &attr);

       clear();
}

Here is the call graph for this function:

Shape::~Shape ( ) [virtual]

Definition at line 79 of file shape.cc.

              {
       XDestroyWindow(dpy, win);
}

Member Function Documentation

void Shape::clear ( ) [private]

Definition at line 75 of file shape.cc.

                  {
       XShapeCombineRectangles(dpy, win, ShapeBounding, 0, 0, NULL, 0, ShapeSet, YXBanded);
}

Here is the caller graph for this function:

void Shape::draw ( Point  p,
Point  q 
) [private, virtual]

Implements Trace.

Definition at line 36 of file shape.cc.

                                 {
       int px = (int)p.x, py = (int)p.y, qx = (int)q.x, qy = (int)q.y;
       int width = prefs.trace_width.get();
       int x = (MIN(px, qx) - width);
       int y = (MIN(py, qy) - width);
       int w = (ABS(px - qx) + 2*width);
       int h = (ABS(py - qy) + 2*width);
       Pixmap pm = XCreatePixmap(dpy, DefaultRootWindow(dpy), w, h, 1);

       XGCValues gcv;
       gcv.foreground = 0;
       gcv.line_width = width;
       gcv.cap_style = CapRound;
       GC gc = XCreateGC(dpy, pm, GCCapStyle | GCForeground | GCLineWidth, &gcv);
       XFillRectangle(dpy, pm, gc, 0, 0, w, h);
       XSetForeground(dpy, gc, 1);
       XDrawLine(dpy, pm, gc, px-x, py-y, qx-x, qy-y);
       XFreeGC(dpy, gc);

       XShapeCombineMask(dpy, win, ShapeBounding, x, y, pm, ShapeUnion);
       XFreePixmap(dpy, pm);
}

Here is the call graph for this function:

void Trace::draw ( Point  p) [inline, inherited]

Definition at line 38 of file trace.h.

{ draw(last, p); last = p; }

Here is the call graph for this function:

Here is the caller graph for this function:

void Trace::end ( ) [inherited]

Definition at line 781 of file main.cc.

                {
       if (!active)
              return;
       active = false;
       XFixesShowCursor(dpy, ROOT);
       end_();
}

Here is the call graph for this function:

void Shape::end_ ( ) [private, virtual]

Implements Trace.

Definition at line 65 of file shape.cc.

                 {
       XUnmapWindow(dpy, win);
       set_timeout(10);
}

Here is the call graph for this function:

bool Timeout::remove_timeout ( ) [inline, inherited]

Definition at line 32 of file util.h.

                             {
              if (c) {
                     c->disconnect();
                     c = 0;
                     return true;
              }
              return false;
       }

Here is the caller graph for this function:

void Timeout::set_timeout ( int  ms) [inline, inherited]

Definition at line 40 of file util.h.

                                {
              remove_timeout();
              connection = Glib::signal_timeout().connect(sigc::mem_fun(*this, &Timeout::to), ms);
              c = &connection;
       }

Here is the call graph for this function:

Here is the caller graph for this function:

void Trace::start ( Trace::Point  p) [inherited]

Definition at line 774 of file main.cc.

                              {
       last = p;
       active = true;
       XFixesHideCursor(dpy, ROOT);
       start_();
}

Here is the call graph for this function:

void Shape::start_ ( ) [private, virtual]

Implements Trace.

Definition at line 59 of file shape.cc.

                   {
       if (remove_timeout())
              clear();
       XMapRaised(dpy, win);
}

Here is the call graph for this function:

void Shape::timeout ( ) [virtual]

Reimplemented from Trace.

Definition at line 70 of file shape.cc.

                    {
       clear();
       XFlush(dpy);
}

Here is the call graph for this function:


Member Data Documentation

Window Shape::win [private]

Definition at line 23 of file shape.h.


The documentation for this class was generated from the following files: