Advertisement
Guest User

Untitled

a guest
Nov 16th, 2019
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.84 KB | None | 0 0
  1. /*#include<iostream>
  2. #include <FL/Fl.H>
  3. #include <FL/Fl_Window.H>
  4. #include <FL/Fl_Box.H>
  5.  
  6. #include <FL/Fl_Button.H>
  7. #include <FL/Fl_Int_Input.H>
  8. #include <FL/Fl_Value_Input.H>
  9. #include <FL/Fl_Int_Input.H>
  10. #include <FL/fl_ask.H>
  11. Fl_Int_Input* input[5];
  12. Fl_Value_Input* input1[5];
  13. using namespace std;
  14. void beepcb(Fl_Widget*)
  15. {
  16. fl_beep();
  17. fflush(stdout);
  18. int h = input[1]->(int)value();
  19. Fl_Window* spiral = new Fl_Window(input[1]->(int)value(), input[2]->value);
  20. spiral->end();
  21. spiral->show();
  22. }
  23. void drawnew(Fl_Widget*, void*)
  24. {
  25. }
  26.  
  27. int main(int argc, char **argv)
  28. {
  29. Fl_Window *window = new Fl_Window(330,250);
  30. //Fl_Box *box = new Fl_Box(20,40,300,100,"Hello, World!");
  31. //box->box(FL_UP_BOX);
  32. //box->labelsize(36);
  33. //box->labeltype(FL_SHADOW_LABEL);
  34. #pragma region Input
  35.  
  36. int y = 10;
  37.  
  38. input[0] = new Fl_Int_Input(100, y, 200, 30, "SpiralName:"); y += 35;
  39. input[0]->tooltip("Spiral Name input field (F1)");
  40. input[0]->shortcut(FL_F + 1);
  41. // input[0]->cursor_color(FL_SELECTION_COLOR);
  42. // input[0]->maximum_size(20);
  43. // input[0]->static_value("this is a testgarbage");
  44. input[1] = new Fl_Int_Input(100, y, 200, 30, "Win_Height:"); y += 35;
  45. input[1]->tooltip("Input field for Window Height (F2)");
  46. input[1]->shortcut(FL_F + 2);
  47.  
  48. input[2] = new Fl_Int_Input(100, y, 200, 30, "Win_Weight:"); y += 35;
  49. input[2]->tooltip("Input field for Window Weight (F3)");
  50. input[2]->shortcut(FL_F + 3);
  51.  
  52. input[3] = new Fl_Int_Input(100, y, 200, 30, "Spiral_H:"); y += 35;
  53. input[3]->tooltip("Input field for Spiral H (F4)");
  54. input[3]->shortcut(FL_F + 4);
  55.  
  56. input[4] = new Fl_Int_Input(100, y, 200, 30, "Spiral_T:"); y += 35;
  57. input[4]->tooltip("Input field for Spiral Degree (T) (F5)");
  58. input[4]->shortcut(FL_F + 5);
  59.  
  60. Fl_Button* b1 = new Fl_Button(150, y, 100, 30, "&Draw!");
  61. b1->callback(beepcb);
  62.  
  63. #pragma endregion
  64.  
  65.  
  66.  
  67. window->end();
  68. window->show(argc, argv);
  69. return Fl::run();
  70. }*/
  71. #define _USE_MATH_DEFINES
  72. #include <iostream>
  73. #include <math.h>
  74. #include <FL/Fl.H>
  75. #include <FL/Fl_Double_Window.H>
  76. Fl_Double_Window* SS = (Fl_Double_Window*)0;
  77. Fl_Double_Window* SD = (Fl_Double_Window*)0;
  78. #include <FL/Fl_Int_Input.H>
  79. #include <FL/Fl_Float_Input.H>
  80.  
  81. Fl_Int_Input* WH = (Fl_Int_Input*)0;
  82. Fl_Int_Input* WW = (Fl_Int_Input*)0;
  83. Fl_Int_Input* H = (Fl_Int_Input*)0;
  84. Fl_Float_Input* T = (Fl_Float_Input*)0;
  85. #include <FL/Fl_Button.H>
  86. #include <FL/fl_ask.H>
  87. Fl_Button* Dbut = (Fl_Button*)0;
  88. Fl_Button* DBS[1000]; //объявление массива DBS
  89. #include "inactive.h"
  90.  
  91. int A = 1;
  92. int B = 1;
  93. //122
  94.  
  95.  
  96.  
  97. static void cb_Dbut(Fl_Button*, void*)
  98. {
  99. fl_beep();
  100. fflush(stdout);
  101.  
  102. A = atoi(WH->value());
  103. B = atoi(WW->value());
  104. if (A < 400 || B < 400)
  105. {
  106. A = 400; B = 400;
  107. }
  108. if (A > 800 || B > 800)
  109. {
  110. A = 800; B = 800;
  111. }
  112.  
  113.  
  114. SD = new Fl_Double_Window(1 * A, 1 * B, "Spiral");
  115.  
  116.  
  117. A /= 2;
  118. B /= 2;
  119.  
  120. //printf("fsf");
  121. //fflush(stdout);
  122. static double p, h,
  123. t,
  124. x, y;
  125. //printf("fsf2");
  126. //fflush(stdout);
  127. sscanf(H->value(), "%lf", &h);
  128. if (h > 20)
  129. h = 20;
  130. else if (h < 0.1)
  131. h = 0.1;
  132. //printf("fsf3");
  133. //fflush(stdout);
  134. sscanf(T->value(), "%lf", &t);
  135. if (t > 1)
  136. t = 1;
  137. else if (t <0.1)
  138. t= 0.1;
  139. /*h = atoi(H->value());
  140. t = atoi(T->value());
  141. */
  142. //printf("fs243");
  143. //fflush(stdout);
  144.  
  145. const char C/*[]*/ = 'a';// "abcdefghijklmnopqrstuvwxyz";
  146. for (short i = 0; i < 1000; i++,C) {
  147. int b = 0;
  148. p = (h / M_2_PI) * t * i;
  149.  
  150. x = p * cos(t * i);
  151. y = p * sin(t * i);
  152. DBS[i] = new Fl_Button(x + A, y + B, 15, 15, &C);
  153. /*DBS[i]->box(FL_PLASTIC_UP_BOX);
  154. DBS[i]->labelcolor(FL_GRAY0);*/
  155. DBS[i]->deactivate();
  156. b++;
  157. if (b == 26)
  158. b = 0;
  159. }
  160.  
  161.  
  162. SD->end();
  163. SD->show();
  164.  
  165. }
  166.  
  167.  
  168. int main(int argc, char** argv) {
  169.  
  170. int y = 10;
  171. { SS = new Fl_Double_Window(330, 250, "Spiral Settings");
  172.  
  173. {
  174. WH = new Fl_Int_Input(100, y, 200, 30, "Win_Height:"); y += 35;
  175. WH->tooltip("Input field for Window Height (Min: 400/Max: 1000)(F1)");
  176. WH->shortcut(FL_F + 1);
  177. } // Fl_Int_Input* o
  178. {
  179. WW = new Fl_Int_Input(100, y, 200, 30, "Win_Weight:"); y += 35;
  180. WW->tooltip("Input field for Window Weight (Min: 400/Max: 1000) (F2)");
  181. WW->shortcut(FL_F + 2);
  182. } // Fl_Int_Input* o
  183. {
  184. H = new Fl_Int_Input(100, y, 200, 30, "Spiral_H:"); y += 35;
  185. H->tooltip("Input field for Spiral (Min: 1/Max: 20) H (F3)");
  186. H->shortcut(FL_F + 3);
  187. }
  188. {
  189. T = new Fl_Float_Input(100, y, 200, 30, "Spiral_T:"); y += 35;
  190. T->tooltip("Input field for Spiral degree (Min: 0.1/Max: 0.5) (T) (F4)");
  191. T->shortcut(FL_F + 4);
  192. }
  193. {
  194. Dbut = new Fl_Button(100, y, 200, 30, "Draw!");
  195. Dbut->tooltip("To draw a spiral press (F5)");
  196. Dbut->shortcut(FL_F + 5);
  197. Dbut->callback((Fl_Callback*)cb_Dbut);
  198. } // Fl_Button* Dbut
  199. SS->end();
  200. }
  201. SS->show(argc, argv);
  202. return Fl::run();
  203. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement