Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.85 KB | None | 0 0
  1.  
  2.  
  3. // int Print(int X, int Y,const char *bufik, int F);
  4.  
  5. int k;
  6.  
  7. int _ADD(int);
  8.  
  9. struct Graph_OUT //-------------------------------------------------------------------------------------------
  10. {
  11. int x, x2, // Коородината для TextOut
  12. y, y2, // Коородината для TextOut
  13. L, // Кол-во символом
  14. status;
  15. char *addr;
  16.  
  17. Graph_OUT *LAST,
  18. *NEXT;
  19.  
  20. static char *Last_addr;
  21. static int Deleted;
  22. static int Last_Slovo;
  23. static int i;
  24. static char base[4096];
  25.  
  26. static RECT rect;
  27.  
  28. static int Chek(int, int, int, Graph_OUT *newelem);
  29. static int Chek_Del();
  30. static int ADD_Slovo(int, int, const char*);
  31.  
  32. int add(char *buf);
  33.  
  34. } *First = 0,
  35. *Tail;
  36.  
  37.  
  38. //-------------------------------------------------------------------------------------------
  39. // Справочная информация КЛАССА
  40. //-------------------------------------------------------------------------------------------
  41. int Graph_OUT:: Deleted = 0;
  42. int Graph_OUT::Last_Slovo = 0;
  43. int Graph_OUT:: i = 0;
  44.  
  45. char Graph_OUT:: base[4096];
  46.  
  47. char *Graph_OUT::Last_addr = base;
  48.  
  49. RECT Graph_OUT::rect;
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56. //---------------------------------------------------------------------
  57. // Если новая строка перекрывает старую, то старую строку стираем
  58. //---------------------------------------------------------------------
  59.  
  60. int Graph_OUT::Chek(int X, int Y, int X2, Graph_OUT *newelem)
  61. {
  62. Graph_OUT *pre_OB;
  63. L_x1: int _L = 0; // в этой переменной будет накапливаться смещение адреса начала слов
  64. int k = 1;
  65. Graph_OUT *n = First;
  66. while(n)
  67. {
  68. k++;
  69. if(n -> status == 1)
  70. {
  71. n -> addr -= _L;
  72. if(!_L)
  73. {
  74. if(abs(Y - n->y) < 13)
  75. {
  76. if(X >= n->x && X <= n->x2) goto L_01;
  77. if(X2 >= n->x && X2 <= n -> x2)
  78. {
  79. L_01: n -> status = -555; // -555 - (ожидание) стереть надпись || (x >= Slovo[i].x && x <= Slovo[i].x2))
  80. SetRect( &rect, n -> x,
  81. n -> y,
  82. n -> x2, // ширина надписи в пикселях
  83. n -> y2); // Высота строки
  84. InvalidateRect(hWnd, &rect, 1);
  85. //---------------------------------------------------------------------------------------------
  86. _L += n -> L;
  87.  
  88. memcpy(n->addr, n->addr + _L, Last_addr - n->addr + _L);
  89.  
  90. Last_addr -= n->L;
  91. newelem->addr -= n -> L;
  92. }
  93. }
  94. }
  95. }n = n -> LAST;
  96. } if(_L) goto L_x1;
  97. }
  98.  
  99. //-------------------------------------------------------------------------------------------//
  100.  
  101.  
  102. int Graph_OUT::Chek_Del()
  103. {
  104. Graph_OUT *n = First;
  105. Graph_OUT *old_OB,
  106. *pre_OB;
  107. while(n)
  108. {
  109. if(n -> status == 0)
  110. {
  111. pre_OB = n -> LAST;
  112.  
  113. if(n == First) First = pre_OB;
  114.  
  115. else old_OB -> LAST = n -> LAST;
  116.  
  117. pre_OB -> NEXT = n -> NEXT;
  118. delete n;
  119. Deleted ++;
  120. return 0;
  121. }
  122. old_OB = n;
  123. n = n -> LAST;
  124. }
  125. }
  126.  
  127.  
  128.  
  129. //**************************************================================================================================
  130. //======================================================================================================================
  131.  
  132.  
  133. int Graph_OUT::ADD_Slovo(int X, int Y, const char *buf)
  134. {
  135.  
  136. Graph_OUT *newelem = new Graph_OUT;
  137. //************************
  138. newelem -> x = X;
  139. newelem -> y = Y;
  140. GetTextExtentPoint32(hdc, buf, lstrlen(buf), &sz); // ----------------- ---- Отобразить строку на экране
  141. newelem -> x2 = X + sz.cx;
  142. newelem -> y2 = Y + sz.cy;
  143. newelem -> L = strlen(buf);
  144. newelem -> addr = Last_addr;
  145. Last_addr += newelem -> L;
  146. memcpy(newelem -> addr, buf, newelem -> L);
  147.  
  148. newelem -> status = 1;
  149. Chek(X, Y, newelem -> x2, newelem);
  150. SetRect(&rect, X,
  151. Y,
  152. newelem -> x2, // ширина надписи в пикселях
  153. newelem -> y2); // Высота строки
  154.  
  155. InvalidateRect(hWnd, &rect, 1); //----------------------------------------------------------------------
  156. Last_Slovo++;
  157. //************************
  158. newelem -> LAST = 0;
  159.  
  160. if(First)
  161. {
  162. newelem -> NEXT = Tail; // Запоминаем (впередистоящего)за кем стоим в очереди
  163. Tail -> LAST = newelem; // а впередистоящий (оборачивается и...) запоминает нас
  164. Tail = newelem; // объявляем себя последними в очереди
  165. }
  166. else // Если создаём первый элемент
  167. {
  168. newelem -> NEXT = 0; // впередистоящего нет ( заглушка = 0 )
  169. First = Tail = newelem; // первый элемент является и самым последним одновременно
  170.  
  171. }
  172. //********************************************************************************************************************
  173. Chek_Del();
  174. return 0;
  175. }
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185. int _Print(int X, int Y,const char *bufik, int F)
  186. {
  187. if (IsIconic(hWnd)) return -1;
  188. char buf[170],
  189. bug[11];
  190.  
  191. itoa(F, bug, 10);
  192.  
  193. strcpy(buf, bufik);
  194. strcat(buf, bug); // ___________________________________________ Склеили всё в одну мтроку: "buf"
  195. Graph_OUT::ADD_Slovo(X, Y, buf);
  196. }
  197.  
  198.  
  199. int _Print(int X, int Y,const char *bufik, double F)
  200. {
  201. if (IsIconic(hWnd)) return -1;
  202.  
  203. char buf[170],
  204. bug[12];
  205. gcvt (F, 11, bug);
  206. strcpy(buf, bufik);
  207. strcat(buf, bug); // ___________________________________________ Склеили всё в одну мтроку: "buf"
  208. Graph_OUT::ADD_Slovo(X, Y, buf);
  209. }
  210.  
  211.  
  212. int _Print(int X, int Y,const char *bufik)
  213. {
  214. if (IsIconic(hWnd)) return -1;
  215. Graph_OUT::ADD_Slovo(X, Y, bufik);
  216. }
  217.  
  218.  
  219.  
  220.  
  221.  
  222.  
  223. int Draw_OUT()
  224. {
  225. hdc = BeginPaint(hWnd, &paintStruct);
  226.  
  227.  
  228.  
  229. if(hdc)
  230. {
  231. TextOut(hdc, 100, 100, "kjsdjsljlj JLKJLKJ 12323470", 30);
  232. Graph_OUT *n = First; //*n = First;
  233. k = 0;
  234. while(n)
  235. {
  236. k++;
  237.  
  238. Transit[1][k] = (int)n -> addr;
  239. Transit[2][k] = n -> L;
  240. Transit[3][k] = n -> x;
  241. Transit[4][k] = n -> y;
  242. Transit[5][k] = n -> status;
  243. Transit[6][k] = (int)n;
  244. Transit[7][k] = (int)n -> NEXT;
  245. Transit[8][k] = (int)n -> LAST;
  246. Transit[5][k+1] = 0;
  247. Transit[6][k+1] = 0;
  248. Transit[7][k+1] = 0;
  249. Transit[8][k+1] = 0;
  250. if(n -> status == -555) n -> status = 0;
  251. if(n -> status == 1)
  252. {
  253. TextOut( hdc, // if(Graph_OUT::Last_Slovo == 1) 26, 320, Graph_OUT::base, strlen(Graph_OUT::base));
  254. n -> x,
  255. n -> y,
  256. n -> addr,
  257. n -> L );
  258. }
  259. n = n -> LAST;
  260. }
  261.  
  262. };
  263.  
  264. EndPaint(hWnd, &paintStruct);
  265. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement