Laxkit  0.0.7.1
freehandinterface.h
1 //
2 //
3 // The Laxkit, a windowing toolkit
4 // Please consult http://laxkit.sourceforge.net about where to send any
5 // correspondence about this software.
6 //
7 // This library is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU Library General Public
9 // License as published by the Free Software Foundation; either
10 // version 2 of the License, or (at your option) any later version.
11 //
12 // This library is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 // Library General Public License for more details.
16 //
17 // You should have received a copy of the GNU Library General Public
18 // License along with this library; if not, write to the Free Software
19 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 //
21 // Copyright (C) 2004-2007,2011,2014 by Tom Lechner
22 //
23 #ifndef _LAX_FREEHANDINTERFACE_H
24 #define _LAX_FREEHANDINTERFACE_H
25 
26 #include <lax/interfaces/aninterface.h>
27 #include <lax/interfaces/linestyle.h>
28 
29 namespace LaxInterfaces {
30 
31 
32 enum FreehandEditorStyles {
33  FREEHAND_Till_Closed =(1<<0), //mouse down drag out a line, up and clicking adds points
34  FREEHAND_Coordinates =(1<<1), //Construct Coordinate points
35  FREEHAND_Flatpoints =(1<<2), //Create a list of flatpoints
36  FREEHAND_Path =(1<<3), //Create a PathsData
37  FREEHAND_ScrollWindow=(1<<4), //scroll viewport if off screen
38  FREEHAND_MAX
39 };
40 
41 class RawPoint {
42  public:
43  flatpoint p;
44  clock_t time;
45  double pressure;
46  double tiltx,tilty;
47  RawPoint(flatpoint pp) { p=pp; time=0; pressure=0; tiltx=tilty=0; }
48 };
49 
51 
53 {
54  protected:
55  char showdecs;
56  int mx,my;
57  LineStyle linestyle;
58  //Laxkit::ShortcutHandler *sc;
59 
60  int findLine(int id);
61 
62  virtual int send(int i);
63 
64  public:
65  unsigned int freehand_style;
66  double mindist;
67  Laxkit::ScreenColor linecolor;
68  Laxkit::ScreenColor pointcolor;
69 
71  Laxkit::NumStack<int> deviceids;
72 
73  FreehandInterface(anInterface *nowner, int nid,Laxkit::Displayer *ndp);
74  virtual ~FreehandInterface();
75  virtual anInterface *duplicate(anInterface *dup);
76  const char *Name();
77  const char *whattype() { return "FreehandInterface"; }
78  const char *whatdatatype() { return NULL; } // is creation only
79  //virtual Laxkit::ShortcutHandler *GetShortcuts();
80  //virtual int PerformAction(int actionnumber);
81 
82  virtual int UseThis(Laxkit::anObject *nlinestyle,unsigned int mask=0);
83  virtual int InterfaceOn();
84  virtual int InterfaceOff();
85  virtual void Clear(SomeData *d);
86  virtual int Refresh();
87  virtual int MouseMove(int x,int y,unsigned int state, const Laxkit::LaxMouse *d);
88  virtual int LBDown(int x,int y,unsigned int state,int count, const Laxkit::LaxMouse *d);
89  virtual int LBUp(int x,int y,unsigned int state, const Laxkit::LaxMouse *d);
90  //virtual int WheelUp (int x,int y,unsigned int state,int count, const Laxkit::LaxMouse *d);
91  //virtual int WheelDown(int x,int y,unsigned int state,int count, const Laxkit::LaxMouse *d);
92  //virtual int CharInput(unsigned int ch, const char *buffer,int len,unsigned int state, const Laxkit::LaxKeyboard *d);
93  //virtual int KeyUp(unsigned int ch,unsigned int state, const Laxkit::LaxKeyboard *d);
94 
95 };
96 
97 } // namespace LaxInterfaces
98 
99 #endif
100 

Mon Feb 17 2014 11:52:56, Laxkit