You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

371 lines
11KB

  1. # data file for the Fltk User Interface Designer (fluid)
  2. version 1.0107
  3. header_name {.h}
  4. code_name {.cxx}
  5. comment {//
  6. // "$Id$"
  7. //
  8. // FLUID print panel for the Fast Light Tool Kit (FLTK).
  9. //
  10. // Copyright 1998-2010 by Bill Spitzak and others.
  11. //
  12. // This library is free software; you can redistribute it and/or
  13. // modify it under the terms of the GNU Library General Public
  14. // License as published by the Free Software Foundation; either
  15. // version 2 of the License, or (at your option) any later version.
  16. //
  17. // This library is distributed in the hope that it will be useful,
  18. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  20. // Library General Public License for more details.
  21. //
  22. // You should have received a copy of the GNU Library General Public
  23. // License along with this library; if not, write to the Free Software
  24. // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
  25. // USA.
  26. //
  27. // Please report all bugs and problems on the following page:
  28. //
  29. // http://www.fltk.org/str.php
  30. //
  31. } {in_source in_header
  32. }
  33. decl {\#include <stdio.h>} {}
  34. decl {\#include <stdlib.h>} {}
  35. decl {\#include "../src/flstring.h"} {}
  36. decl {\#include <FL/Fl_Preferences.H>} {}
  37. decl {extern Fl_Preferences fluid_prefs;} {}
  38. Function {make_print_panel()} {open
  39. } {
  40. Fl_Window print_panel {
  41. label Print open
  42. xywh {342 21 465 235} type Double modal visible
  43. } {
  44. Fl_Group print_panel_controls {open
  45. xywh {10 10 447 216}
  46. } {
  47. Fl_Choice print_choice {
  48. label {Printer:}
  49. callback {print_update_status();} open
  50. xywh {113 10 181 25} down_box BORDER_BOX labelfont 1 when 1
  51. } {}
  52. Fl_Button print_properties {
  53. label {Properties...}
  54. callback {print_properties_panel->show();}
  55. xywh {294 10 105 25}
  56. }
  57. Fl_Box print_status {
  58. label {printer/job status}
  59. xywh {111 41 288 17} align 84
  60. }
  61. Fl_Group {} {
  62. label {Print Range} open
  63. xywh {10 86 227 105} box THIN_DOWN_BOX labelfont 1 align 5
  64. } {
  65. Fl_Round_Button print_all {
  66. label All
  67. callback {print_from->deactivate();
  68. print_to->deactivate();}
  69. xywh {20 96 38 25} type Radio down_box ROUND_DOWN_BOX value 1
  70. }
  71. Fl_Round_Button print_pages {
  72. label Pages
  73. callback {print_from->activate();
  74. print_to->activate();}
  75. xywh {20 126 64 25} type Radio down_box ROUND_DOWN_BOX
  76. }
  77. Fl_Round_Button print_selection {
  78. label Selection
  79. callback {print_from->deactivate();
  80. print_to->deactivate();}
  81. xywh {20 156 82 25} type Radio down_box ROUND_DOWN_BOX
  82. }
  83. Fl_Input print_from {
  84. label {From:}
  85. xywh {136 126 28 25} type Int textfont 4 deactivate
  86. }
  87. Fl_Input print_to {
  88. label {To:}
  89. xywh {199 126 28 25} type Int textfont 4 deactivate
  90. }
  91. }
  92. Fl_Group {} {
  93. label Copies open
  94. xywh {247 86 210 105} box THIN_DOWN_BOX labelfont 1 align 5
  95. } {
  96. Fl_Spinner print_copies {
  97. label {\# Copies:}
  98. callback {if (print_copies->value() == 1) {
  99. print_collate_button->deactivate();
  100. print_collate_group[0]->deactivate();
  101. print_collate_group[1]->deactivate();
  102. } else {
  103. print_collate_button->activate();
  104. print_collate_group[0]->activate();
  105. print_collate_group[1]->activate();
  106. }} selected
  107. xywh {321 96 45 25} when 1
  108. }
  109. Fl_Check_Button print_collate_button {
  110. label Collate
  111. callback {int i = print_collate_button->value() != 0;
  112. print_collate_group[i]->show();
  113. print_collate_group[1 - i]->hide();}
  114. xywh {376 96 64 25} down_box DOWN_BOX when 1 deactivate
  115. }
  116. Fl_Group {print_collate_group[0]} {
  117. xywh {257 131 191 50} deactivate
  118. } {
  119. Fl_Box {} {
  120. label 1
  121. xywh {287 141 30 40} box BORDER_BOX color 7 labelsize 11 align 26 deactivate
  122. }
  123. Fl_Box {} {
  124. label 1
  125. xywh {272 136 30 40} box BORDER_BOX color 7 labelsize 11 align 26 deactivate
  126. }
  127. Fl_Box {} {
  128. label 1
  129. xywh {257 131 30 40} box BORDER_BOX color 7 labelsize 11 align 26 deactivate
  130. }
  131. Fl_Box {} {
  132. label 2
  133. xywh {352 141 30 40} box BORDER_BOX color 7 labelsize 11 align 26 deactivate
  134. }
  135. Fl_Box {} {
  136. label 2
  137. xywh {337 136 30 40} box BORDER_BOX color 7 labelsize 11 align 26 deactivate
  138. }
  139. Fl_Box {} {
  140. label 2
  141. xywh {322 131 30 40} box BORDER_BOX color 7 labelsize 11 align 26 deactivate
  142. }
  143. Fl_Box {} {
  144. label 3
  145. xywh {417 141 30 40} box BORDER_BOX color 7 labelsize 11 align 26 deactivate
  146. }
  147. Fl_Box {} {
  148. label 3
  149. xywh {402 136 30 40} box BORDER_BOX color 7 labelsize 11 align 26 deactivate
  150. }
  151. Fl_Box {} {
  152. label 3
  153. xywh {387 131 30 40} box BORDER_BOX color 7 labelsize 11 align 26 deactivate
  154. }
  155. }
  156. Fl_Group {print_collate_group[1]} {
  157. xywh {257 131 191 50} hide deactivate
  158. } {
  159. Fl_Box {} {
  160. label 3
  161. xywh {287 141 30 40} box BORDER_BOX color 7 labelsize 11 align 26
  162. }
  163. Fl_Box {} {
  164. label 2
  165. xywh {272 136 30 40} box BORDER_BOX color 7 labelsize 11 align 26
  166. }
  167. Fl_Box {} {
  168. label 1
  169. xywh {257 131 30 40} box BORDER_BOX color 7 labelsize 11 align 26
  170. }
  171. Fl_Box {} {
  172. label 3
  173. xywh {352 141 30 40} box BORDER_BOX color 7 labelsize 11 align 26
  174. }
  175. Fl_Box {} {
  176. label 2
  177. xywh {337 136 30 40} box BORDER_BOX color 7 labelsize 11 align 26
  178. }
  179. Fl_Box {} {
  180. label 1
  181. xywh {322 131 30 40} box BORDER_BOX color 7 labelsize 11 align 26
  182. }
  183. Fl_Box {} {
  184. label 3
  185. xywh {417 141 30 40} box BORDER_BOX color 7 labelsize 11 align 26
  186. }
  187. Fl_Box {} {
  188. label 2
  189. xywh {402 136 30 40} box BORDER_BOX color 7 labelsize 11 align 26
  190. }
  191. Fl_Box {} {
  192. label 1
  193. xywh {387 131 30 40} box BORDER_BOX color 7 labelsize 11 align 26
  194. }
  195. }
  196. }
  197. Fl_Return_Button {} {
  198. label Print
  199. callback print_cb
  200. xywh {309 201 70 25}
  201. }
  202. Fl_Button {} {
  203. label Cancel
  204. callback {print_panel->hide();}
  205. xywh {389 201 68 25}
  206. }
  207. }
  208. Fl_Progress print_progress {
  209. xywh {10 203 289 21} selection_color 4 hide
  210. }
  211. }
  212. Fl_Window print_properties_panel {
  213. label {Printer Properties}
  214. callback {print_properties_panel->hide();
  215. print_update_status();} open
  216. xywh {340 213 290 130} type Double modal visible
  217. } {
  218. Fl_Choice print_page_size {
  219. label {Page Size:}
  220. xywh {110 10 80 25} down_box BORDER_BOX labelfont 1
  221. } {
  222. MenuItem {} {
  223. label Letter
  224. xywh {0 0 35 25}
  225. }
  226. MenuItem {} {
  227. label A4
  228. xywh {0 0 35 25}
  229. }
  230. }
  231. Fl_Group {} {
  232. label {Output Mode:} open
  233. xywh {110 45 170 40} labelfont 1 align 4
  234. } {
  235. Fl_Button {print_output_mode[0]} {
  236. image {pixmaps/print_color.xpm} xywh {110 45 30 40} type Radio box BORDER_BOX down_box BORDER_BOX value 1 color 7 selection_color 0
  237. }
  238. Fl_Button {print_output_mode[1]} {
  239. image {pixmaps/print_color.xpm} xywh {150 50 40 30} type Radio box BORDER_BOX down_box BORDER_BOX color 7 selection_color 0
  240. }
  241. Fl_Button {print_output_mode[2]} {
  242. image {pixmaps/print_gray.xpm} xywh {200 45 30 40} type Radio box BORDER_BOX down_box BORDER_BOX color 7 selection_color 0
  243. }
  244. Fl_Button {print_output_mode[3]} {
  245. image {pixmaps/print_gray.xpm} xywh {240 50 40 30} type Radio box BORDER_BOX down_box BORDER_BOX color 7 selection_color 0
  246. }
  247. }
  248. Fl_Return_Button {} {
  249. label Save
  250. callback {print_properties_panel->hide();
  251. char name[1024];
  252. int val;
  253. const char *printer = (const char *)print_choice->menu()[print_choice->value()].user_data();
  254. snprintf(name, sizeof(name), "%s/page_size", printer);
  255. fluid_prefs.set(name, print_page_size->value());
  256. snprintf(name, sizeof(name), "%s/output_mode", printer);
  257. for (val = 0; val < 4; val ++) {
  258. if (print_output_mode[val]->value()) break;
  259. }
  260. fluid_prefs.set(name, val);}
  261. xywh {123 95 79 25}
  262. }
  263. Fl_Button {} {
  264. label Cancel
  265. callback {print_properties_panel->hide();
  266. print_update_status();}
  267. xywh {212 95 68 25}
  268. }
  269. Fl_Button {} {
  270. label Use
  271. callback {print_properties_panel->hide();}
  272. xywh {60 95 53 25}
  273. }
  274. }
  275. }
  276. decl {void print_cb(Fl_Return_Button *, void *);} {public
  277. }
  278. Function {print_load()} {open return_type void
  279. } {
  280. code {FILE *lpstat;
  281. char line[1024], name[1024], *nptr, qname[2048], *qptr, defname[1024];
  282. int i;
  283. if (print_choice->size() > 1) {
  284. for (i = 1; print_choice->text(i); i ++) {
  285. free(print_choice->menu()[i].user_data());
  286. }
  287. }
  288. print_choice->clear();
  289. print_choice->add("Print To File", 0, 0, 0, FL_MENU_DIVIDER);
  290. print_choice->value(0);
  291. defname[0] = '\\0';
  292. if ((lpstat = popen("LC_MESSAGES=C LANG=C lpstat -p -d", "r")) != NULL) {
  293. while (fgets(line, sizeof(line), lpstat)) {
  294. if (!strncmp(line, "printer ", 8) &&
  295. sscanf(line + 8, "%s", name) == 1) {
  296. for (nptr = name, qptr = qname; *nptr; *qptr++ = *nptr++) {
  297. if (*nptr == '/') *qptr++ = '\\\\';
  298. }
  299. *qptr = '\\0';
  300. print_choice->add(qname, 0, 0, (void *)strdup(name), 0);
  301. } else if (!strncmp(line, "system default destination: ", 28)) {
  302. if (sscanf(line + 28, "%s", defname) != 1) defname[0] = '\\0';
  303. }
  304. }
  305. pclose(lpstat);
  306. }
  307. if (defname[0]) {
  308. for (i = 1; print_choice->text(i); i ++) {
  309. if (!strcmp((char *)print_choice->menu()[i].user_data(), defname)) {
  310. print_choice->value(i);
  311. break;
  312. }
  313. }
  314. } else if (print_choice->size() > 2) print_choice->value(1);
  315. print_update_status();} {}
  316. }
  317. Function {print_update_status()} {open return_type void
  318. } {
  319. code {FILE *lpstat;
  320. char command[1024];
  321. static char status[1024];
  322. const char *printer = (const char *)print_choice->menu()[print_choice->value()].user_data();
  323. if (print_choice->value()) {
  324. snprintf(command, sizeof(command), "lpstat -p '%s'", printer);
  325. if ((lpstat = popen(command, "r")) != NULL) {
  326. if (fgets(status, sizeof(status), lpstat)==0) { /* ignore */ }
  327. pclose(lpstat);
  328. } else strcpy(status, "printer status unavailable");
  329. } else status[0] = '\\0';
  330. print_status->label(status);
  331. char name[1024];
  332. int val;
  333. snprintf(name, sizeof(name), "%s/page_size", printer);
  334. fluid_prefs.get(name, val, 0);
  335. print_page_size->value(val);
  336. snprintf(name, sizeof(name), "%s/output_mode", printer);
  337. fluid_prefs.get(name, val, 0);
  338. print_output_mode[val]->setonly();} {}
  339. }
  340. comment {
  341. //
  342. // End of "$Id$".
  343. //} {in_source in_header
  344. }