KEDModel2DEditor.h 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. #pragma once
  2. #include <Knopf.h>
  3. #include <Array.h>
  4. #include <Punkt.h>
  5. #include <Bild.h>
  6. #include <Model2D.h>
  7. #include <DateiDialog.h>
  8. using namespace Framework;
  9. namespace Model2DEditor
  10. {
  11. class VertexData
  12. {
  13. private:
  14. Vec2< float > vertex;
  15. Vertex textur;
  16. bool selected;
  17. bool sichtbar;
  18. int ref;
  19. public:
  20. // Konstruktor
  21. VertexData( Vec2< float > v, Punkt t );
  22. // nicht constant
  23. void nachLinks( float num );
  24. void nachOben( float num );
  25. void saveTextur( Punkt tPos, Punkt tGr );
  26. void select( Punkt p1, Punkt p2 );
  27. void deSelect();
  28. void setAuswahl( bool ausw );
  29. void setSichtbar( bool s );
  30. // constant
  31. bool istSichtbar() const;
  32. bool istAusgewählt() const;
  33. Vec2< float > getPos() const;
  34. Vertex getTPos() const;
  35. // Reference Counting
  36. VertexData *getThis();
  37. VertexData *release();
  38. };
  39. class PolygonData
  40. {
  41. private:
  42. RCArray< VertexData > *vd;
  43. Text name;
  44. bool sichtbar;
  45. int ref;
  46. public:
  47. // Konstruktor
  48. PolygonData( Polygon2D &pg );
  49. // Destruktor
  50. ~PolygonData();
  51. // nicht constant
  52. void addVertex( Vec2< float >v, Punkt t );
  53. void removeVertex( int num );
  54. void nachLinks( float num );
  55. void nachOben( float num );
  56. void saveTextur( Punkt tPos, Punkt tGr );
  57. void select( Punkt p1, Punkt p2 );
  58. void deSelect();
  59. void setSichtbar( bool s );
  60. void setName( const char *name );
  61. // constant
  62. const char *getName() const;
  63. bool istSichtbar() const;
  64. VertexData *zVertex( int num ) const;
  65. int getVertexAnzahl() const;
  66. void getM2( Polygon2D &pd, bool textur ) const;
  67. // Reference Counting
  68. PolygonData *getThis();
  69. PolygonData *release();
  70. };
  71. class Data
  72. {
  73. private:
  74. RCArray< PolygonData > *pd;
  75. Bild *textur;
  76. Punkt tPos;
  77. bool rTextur;
  78. int sp;
  79. int ref;
  80. public:
  81. // Konstruktor
  82. Data( Model2DData *mdl );
  83. // Destruktor
  84. ~Data();
  85. // nicht constant
  86. void addPolygon();
  87. void removePolygon( int num );
  88. void selectPolygon( int num );
  89. void nachLinks( float num );
  90. void nachOben( float num );
  91. void tNachLinks( int num );
  92. void tNachOben( int num );
  93. void setRTextur( bool rt );
  94. void saveTextur();
  95. void setTextur( Bild *t );
  96. void select( Punkt p1, Punkt p2 );
  97. void deSelect();
  98. // constant
  99. PolygonData *zPolygon( int num ) const;
  100. int getPolygonAnzahl() const;
  101. int getSelectedPolygon() const;
  102. Model2DData *getM2() const;
  103. Bild *zTextur() const;
  104. Punkt getTPos() const;
  105. // Reference Counting
  106. Data *getThis();
  107. Data *release();
  108. };
  109. class EditorListe : public Zeichnung
  110. {
  111. private:
  112. LRahmen *ram;
  113. VScrollBar *scroll;
  114. Data *data;
  115. Array< bool > ausgeklappt;
  116. Schrift *schrift;
  117. TextFeld *pName;
  118. int ref;
  119. public:
  120. // Konstruktor
  121. EditorListe( Schrift *zSchrift );
  122. // Destruktor
  123. ~EditorListe();
  124. // nicht constant
  125. void setDataZ( Data *d );
  126. void doMausEreignis( MausEreignis &me ) override;
  127. void doTastaturEreignis( TastaturEreignis &te ) override;
  128. bool tick( double zeit ) override;
  129. void render( Bild &zRObj ) override;
  130. // Reference Counting
  131. EditorListe *getThis();
  132. EditorListe *release();
  133. };
  134. class Editor2D : public Zeichnung
  135. {
  136. private:
  137. Punkt pos;
  138. Punkt offs;
  139. Data *data;
  140. LRahmen *ram;
  141. LRahmen *select;
  142. Schrift *schrift;
  143. Punkt mausPos;
  144. Vertex addV;
  145. bool mausIn;
  146. float größe;
  147. int ref;
  148. public:
  149. // Konstruktor
  150. Editor2D( Schrift *zSchrift );
  151. // Destruktor
  152. ~Editor2D();
  153. // nicht constant
  154. void setDataZ( Data *d );
  155. void doMausEreignis( MausEreignis &me ) override;
  156. void doTastaturEreignis( TastaturEreignis &te ) override;
  157. bool tick( double zeit ) override;
  158. void render( Bild &zRObj ) override;
  159. // Reference Counting
  160. Editor2D *getThis();
  161. Editor2D *release();
  162. };
  163. class GUI : public Zeichnung
  164. {
  165. private:
  166. Knopf *speichern;
  167. Knopf *abbrechen;
  168. Editor2D *editor;
  169. EditorListe *liste;
  170. KontrollKnopf *textur;
  171. Knopf *texturLaden;
  172. Knopf *texturVerknüpfen;
  173. DateiDialogTh *importDialog;
  174. Data *data;
  175. bool sichtbar;
  176. unsigned char alpha;
  177. int aktion;
  178. int ref;
  179. public:
  180. // Konstruktor
  181. GUI( Schrift *zSchrifto );
  182. // Destruktor
  183. ~GUI();
  184. // nicht constant
  185. void setSichtbar( bool s );
  186. void setModel( Model2DData *data );
  187. void doMausEreignis( MausEreignis &me ) override;
  188. void doTastaturEreignis( TastaturEreignis &te ) override;
  189. bool tick( double zeit ) override;
  190. void render( Bild &zRObj ) override;
  191. int getAktion();
  192. // const
  193. Model2DData *getM2Data() const;
  194. // Reference Counting
  195. GUI *getThis();
  196. GUI *release();
  197. };
  198. }