File: drgeo_macro.h

package info (click to toggle)
drgeo 1.1.0-1.2
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 8,340 kB
  • ctags: 2,481
  • sloc: cpp: 22,807; sh: 11,294; lisp: 1,285; makefile: 378; ansic: 343
file content (86 lines) | stat: -rw-r--r-- 2,027 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#ifndef DRGEO_MACRO_H
#define DRGEO_MACRO_H

#include <glib.h>

#include "drgeo_figure.h"
#include "macro.h"


enum drgeoMacroMode
{
  drgeoMacroStartMode,
  drgeoMacroInputMode,
  drgeoMacroOutputMode,
  drgeoMacroDescriptionMode,
  drgeoMacroFinishMode
};

class drgeoMacroBuilder
{
  // This class is used to create new macros.

private:
  char *name, *description;
  class drgeoFigure *figure;
  class liste_elem input, output;
  drgeoMacroMode mode;

  // the macro and its kernels
  // return the position of the item kernel in the macro-construction
  // reurn -1 if i can't compute the kernel (this item doesn't have
  // parent in the macro tree
  int kernel_position (macro & M, geometricObject * fig);


public:
  // Constructor.
    drgeoMacroBuilder (drgeoFigure * figure);
   ~drgeoMacroBuilder ();
  void setMode (drgeoMacroMode mode);
  drgeoMacroMode getMode ();
  // Macro input parameters management.
  void addInput (geometricObject * item);
  void clearInput ();

  // Macro output parameters management.
  void addOutput (geometricObject * item);
  void clearOutput ();

  // Add to the current list (input or output).
  void add (geometricObject * item);

  // Name and description of the macro about to be created.
  void setName (const gchar *name);
  gchar *getName ();
  void setDescription (gchar *description);
  gchar *getDescription ();

  // Check that everything is correct, before going for the macro
  // creation.
  bool checkParameters ();

  // Macro creation.
  macro *createMacro ();

};

class drgeoMacroPlayer
{
private:
  class drgeoFigure * figure;
  class macro *selectedMacro;
  // we use the drgeoFigure::selection list to store
  // the selected element
public:
    bool itemsUnderMouseForMacro (drgeoPoint & mouse,
				  liste_elem & underMouse);
    drgeoMacroPlayer (drgeoFigure * figure);
   ~drgeoMacroPlayer ();
  bool setMacro (const char *macroName);
  void setDescription (gchar *description);
  gchar *getDescription ();
  void add (geometricObject * item);
};

#endif