1 /* -*- c++ -*-
2 FILE: Macro.h
3 RCS REVISION: $Revision: 1.18 $
4 
5 COPYRIGHT: (c) 1999 -- 2003 Melinda Green, Don Hatch, and Jay Berkenbilt - Superliminal Software
6 
7 LICENSE: Free to use and modify for non-commercial purposes as long as the
8     following conditions are adhered to:
9     1) Obvious credit for the source of this code and the designs it embodies
10        are clearly made, and
11     2) Ports and derived versions of 4D Magic Cube programs are not distributed
12        without the express written permission of the authors.
13 
14 DESCRIPTION:
15     This class implements the Macro itself.  Most interaction with
16     Macros is done through the MacroManager class.
17 */
18 
19 #ifndef MACRO_H
20 #define MACRO_H
21 
22 #include "MagicCube.h"
23 #include <stdio.h>
24 
25 class History;
26 class MacroManager;
27 class Preferences;
28 class PolygonManager4D;
29 
30 // MAXREFS would be better as a member of Macro, but this seems to
31 // cause compilation problems on some platforms.
32 const int MAXREFS = 3;
33 
34 class Macro
35 {
36 public:
37 
38 
39     Macro(char* name, int nrefs, int refs[MAXREFS][4],
40           Preferences& prefs, PolygonManager4D* polymgr);
41     ~Macro();
42 
43     void setUIData(void* ui_data);
44     void* getUIData();
45     void setName(char* name);
46     char* getName();
47     void setRefs(int nrefs, int refs[MAXREFS][4]);
48 
49     void addMove(struct stickerspec* sticker, int direction, int slicesmask);
50     // Returns true on success, false if at end of the macro
51     bool getMove(int dir_in, int det, int mat[4][4],
52                  struct stickerspec* grip,
53                  int* dir_out, int* slicesmask);
54 
55     void goToBeginning();
56     void goToEnd();
57 
58     // Returns true if successful
59     bool get4dMatThatRotatesThese3ToMy3(int ref0[4], int ref1[4], int ref2[4],
60                                         int mat[4][4]);
61 
62     void dump(FILE* fp);
63     bool readHistory(FILE* fp);
64 
65 private:
66     char *name;
67     int nrefs;                  // number of reference stickerspec
68     int refs[MAXREFS][NDIMS];
69     PolygonManager4D* polymgr;
70     History* moves;
71     void* ui_data;
72 };
73 
74 #endif
75 
76 // Local Variables:
77 // c-basic-offset: 4
78 // c-comment-only-line-offset: 0
79 // c-file-offsets: ((defun-block-intro . +) (block-open . 0) (substatement-open . 0) (statement-cont . +) (statement-case-open . +4) (arglist-intro . +) (arglist-close . +) (inline-open . 0))
80 // indent-tabs-mode: nil
81 // End:
82