|
fltk 1.3.0rc3
About: FLTK (Fast Light Tool Kit) is a cross-platform C++ GUI toolkit for UNIX/Linux (X11), Microsoft Windows, and MacOS X. Release candidate.
SfR Fresh Dox: fltk-1.3.0rc3-source.tar.gz ("inofficial" and yet experimental doxygen-generated source code documentation) ![]() |
00001 // 00002 // "$Id$" 00003 // 00004 // FLUID print panel for the Fast Light Tool Kit (FLTK). 00005 // 00006 // Copyright 1998-2010 by Bill Spitzak and others. 00007 // 00008 // This library is free software; you can redistribute it and/or 00009 // modify it under the terms of the GNU Library General Public 00010 // License as published by the Free Software Foundation; either 00011 // version 2 of the License, or (at your option) any later version. 00012 // 00013 // This library is distributed in the hope that it will be useful, 00014 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00016 // Library General Public License for more details. 00017 // 00018 // You should have received a copy of the GNU Library General Public 00019 // License along with this library; if not, write to the Free Software 00020 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 00021 // USA. 00022 // 00023 // Please report all bugs and problems on the following page: 00024 // 00025 // http://www.fltk.org/str.php 00026 // 00027 00028 // generated by Fast Light User Interface Designer (fluid) version 1.0300 00029 00030 #include "print_panel.h" 00031 #include <stdio.h> 00032 #include <stdlib.h> 00033 #include "../src/flstring.h" 00034 #include <FL/Fl_Preferences.H> 00035 extern Fl_Preferences fluid_prefs; 00036 00037 Fl_Double_Window *print_panel=(Fl_Double_Window *)0; 00038 00039 Fl_Group *print_panel_controls=(Fl_Group *)0; 00040 00041 Fl_Choice *print_choice=(Fl_Choice *)0; 00042 00043 static void cb_print_choice(Fl_Choice*, void*) { 00044 print_update_status(); 00045 } 00046 00047 Fl_Button *print_properties=(Fl_Button *)0; 00048 00049 static void cb_print_properties(Fl_Button*, void*) { 00050 print_properties_panel->show(); 00051 } 00052 00053 Fl_Box *print_status=(Fl_Box *)0; 00054 00055 Fl_Round_Button *print_all=(Fl_Round_Button *)0; 00056 00057 static void cb_print_all(Fl_Round_Button*, void*) { 00058 print_from->deactivate(); 00059 print_to->deactivate(); 00060 } 00061 00062 Fl_Round_Button *print_pages=(Fl_Round_Button *)0; 00063 00064 static void cb_print_pages(Fl_Round_Button*, void*) { 00065 print_from->activate(); 00066 print_to->activate(); 00067 } 00068 00069 Fl_Round_Button *print_selection=(Fl_Round_Button *)0; 00070 00071 static void cb_print_selection(Fl_Round_Button*, void*) { 00072 print_from->deactivate(); 00073 print_to->deactivate(); 00074 } 00075 00076 Fl_Int_Input *print_from=(Fl_Int_Input *)0; 00077 00078 Fl_Int_Input *print_to=(Fl_Int_Input *)0; 00079 00080 Fl_Spinner *print_copies=(Fl_Spinner *)0; 00081 00082 static void cb_print_copies(Fl_Spinner*, void*) { 00083 if (print_copies->value() == 1) { 00084 print_collate_button->deactivate(); 00085 print_collate_group[0]->deactivate(); 00086 print_collate_group[1]->deactivate(); 00087 } else { 00088 print_collate_button->activate(); 00089 print_collate_group[0]->activate(); 00090 print_collate_group[1]->activate(); 00091 }; 00092 } 00093 00094 Fl_Check_Button *print_collate_button=(Fl_Check_Button *)0; 00095 00096 static void cb_print_collate_button(Fl_Check_Button*, void*) { 00097 int i = print_collate_button->value() != 0; 00098 print_collate_group[i]->show(); 00099 print_collate_group[1 - i]->hide(); 00100 } 00101 00102 Fl_Group *print_collate_group[2]={(Fl_Group *)0}; 00103 00104 static void cb_Cancel(Fl_Button*, void*) { 00105 print_panel->hide(); 00106 } 00107 00108 Fl_Progress *print_progress=(Fl_Progress *)0; 00109 00110 Fl_Double_Window *print_properties_panel=(Fl_Double_Window *)0; 00111 00112 static void cb_print_properties_panel(Fl_Double_Window*, void*) { 00113 print_properties_panel->hide(); 00114 print_update_status(); 00115 } 00116 00117 Fl_Choice *print_page_size=(Fl_Choice *)0; 00118 00119 Fl_Menu_Item menu_print_page_size[] = { 00120 {"Letter", 0, 0, 0, 0, FL_NORMAL_LABEL, 0, 14, 0}, 00121 {"A4", 0, 0, 0, 0, FL_NORMAL_LABEL, 0, 14, 0}, 00122 {0,0,0,0,0,0,0,0,0} 00123 }; 00124 00125 #include <FL/Fl_Pixmap.H> 00126 static const char *idata_print_color[] = { 00127 "24 24 17 1", 00128 " \tc None", 00129 ".\tc #FFFF00", 00130 "+\tc #C8FF00", 00131 "@\tc #00FF00", 00132 "#\tc #FFC800", 00133 "$\tc #FF0000", 00134 "%\tc #00FFFF", 00135 "&\tc #000000", 00136 "*\tc #FF00FF", 00137 "=\tc #00FFC8", 00138 "-\tc #FF00C8", 00139 ";\tc #00C800", 00140 ">\tc #C80000", 00141 ",\tc #0000C8", 00142 "\'\tc #0000FF", 00143 ")\tc #00C8FF", 00144 "!\tc #C800FF", 00145 " ...... ", 00146 " .......... ", 00147 " ............ ", 00148 " .............. ", 00149 " .............. ", 00150 " ................ ", 00151 " ................ ", 00152 " ................ ", 00153 " +@@@@@@+#$$$$$$# ", 00154 " %@@@@@@@&&$$$$$$$* ", 00155 " %%@@@@@@&&&&$$$$$$** ", 00156 " %%%=@@@@&&&&&&$$$$-*** ", 00157 " %%%%@@@;&&&&&&>$$$**** ", 00158 "%%%%%%@@&&&&&&&&$$******", 00159 "%%%%%%%@&&&&&&&&$*******", 00160 "%%%%%%%%,&&&&&&,********", 00161 "%%%%%%%%\'\'\'\'\'\'\'\'********", 00162 "%%%%%%%%\'\'\'\'\'\'\'\'********", 00163 "%%%%%%%%\'\'\'\'\'\'\'\'********", 00164 " %%%%%%%)\'\'\'\'\'\'!******* ", 00165 " %%%%%%%%\'\'\'\'\'\'******** ", 00166 " %%%%%%%%\'\'\'\'******** ", 00167 " %%%%%%%%\'\'******** ", 00168 " %%%%%% ****** " 00169 }; 00170 static Fl_Pixmap image_print_color(idata_print_color); 00171 00172 static const char *idata_print_gray[] = { 00173 "24 24 17 1", 00174 " \tc None", 00175 ".\tc #E3E3E3", 00176 "+\tc #D2D2D2", 00177 "@\tc #969696", 00178 "#\tc #C2C2C2", 00179 "$\tc #4C4C4C", 00180 "%\tc #B2B2B2", 00181 "&\tc #000000", 00182 "*\tc #696969", 00183 "=\tc #ACACAC", 00184 "-\tc #626262", 00185 ";\tc #767676", 00186 ">\tc #3C3C3C", 00187 ",\tc #161616", 00188 "\'\tc #1C1C1C", 00189 ")\tc #929292", 00190 "!\tc #585858", 00191 " ...... ", 00192 " .......... ", 00193 " ............ ", 00194 " .............. ", 00195 " .............. ", 00196 " ................ ", 00197 " ................ ", 00198 " ................ ", 00199 " +@@@@@@+#$$$$$$# ", 00200 " %@@@@@@@&&$$$$$$$* ", 00201 " %%@@@@@@&&&&$$$$$$** ", 00202 " %%%=@@@@&&&&&&$$$$-*** ", 00203 " %%%%@@@;&&&&&&>$$$**** ", 00204 "%%%%%%@@&&&&&&&&$$******", 00205 "%%%%%%%@&&&&&&&&$*******", 00206 "%%%%%%%%,&&&&&&,********", 00207 "%%%%%%%%\'\'\'\'\'\'\'\'********", 00208 "%%%%%%%%\'\'\'\'\'\'\'\'********", 00209 "%%%%%%%%\'\'\'\'\'\'\'\'********", 00210 " %%%%%%%)\'\'\'\'\'\'!******* ", 00211 " %%%%%%%%\'\'\'\'\'\'******** ", 00212 " %%%%%%%%\'\'\'\'******** ", 00213 " %%%%%%%%\'\'******** ", 00214 " %%%%%% ****** " 00215 }; 00216 static Fl_Pixmap image_print_gray(idata_print_gray); 00217 00218 Fl_Button *print_output_mode[4]={(Fl_Button *)0}; 00219 00220 static void cb_Save(Fl_Return_Button*, void*) { 00221 print_properties_panel->hide(); 00222 00223 char name[1024]; 00224 int val; 00225 const char *printer = (const char *)print_choice->menu()[print_choice->value()].user_data(); 00226 00227 snprintf(name, sizeof(name), "%s/page_size", printer); 00228 fluid_prefs.set(name, print_page_size->value()); 00229 00230 snprintf(name, sizeof(name), "%s/output_mode", printer); 00231 for (val = 0; val < 4; val ++) { 00232 if (print_output_mode[val]->value()) break; 00233 } 00234 fluid_prefs.set(name, val); 00235 } 00236 00237 static void cb_Cancel1(Fl_Button*, void*) { 00238 print_properties_panel->hide(); 00239 print_update_status(); 00240 } 00241 00242 static void cb_Use(Fl_Button*, void*) { 00243 print_properties_panel->hide(); 00244 } 00245 00246 Fl_Double_Window* make_print_panel() { 00247 { print_panel = new Fl_Double_Window(465, 235, "Print"); 00248 { print_panel_controls = new Fl_Group(10, 10, 447, 216); 00249 { print_choice = new Fl_Choice(113, 10, 181, 25, "Printer:"); 00250 print_choice->down_box(FL_BORDER_BOX); 00251 print_choice->labelfont(1); 00252 print_choice->callback((Fl_Callback*)cb_print_choice); 00253 print_choice->when(FL_WHEN_CHANGED); 00254 } // Fl_Choice* print_choice 00255 { print_properties = new Fl_Button(294, 10, 105, 25, "Properties..."); 00256 print_properties->callback((Fl_Callback*)cb_print_properties); 00257 } // Fl_Button* print_properties 00258 { print_status = new Fl_Box(111, 41, 288, 17, "printer/job status"); 00259 print_status->align(Fl_Align(68|FL_ALIGN_INSIDE)); 00260 } // Fl_Box* print_status 00261 { Fl_Group* o = new Fl_Group(10, 86, 227, 105, "Print Range"); 00262 o->box(FL_THIN_DOWN_BOX); 00263 o->labelfont(1); 00264 o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); 00265 { print_all = new Fl_Round_Button(20, 96, 38, 25, "All"); 00266 print_all->type(102); 00267 print_all->down_box(FL_ROUND_DOWN_BOX); 00268 print_all->value(1); 00269 print_all->callback((Fl_Callback*)cb_print_all); 00270 } // Fl_Round_Button* print_all 00271 { print_pages = new Fl_Round_Button(20, 126, 64, 25, "Pages"); 00272 print_pages->type(102); 00273 print_pages->down_box(FL_ROUND_DOWN_BOX); 00274 print_pages->callback((Fl_Callback*)cb_print_pages); 00275 } // Fl_Round_Button* print_pages 00276 { print_selection = new Fl_Round_Button(20, 156, 82, 25, "Selection"); 00277 print_selection->type(102); 00278 print_selection->down_box(FL_ROUND_DOWN_BOX); 00279 print_selection->callback((Fl_Callback*)cb_print_selection); 00280 } // Fl_Round_Button* print_selection 00281 { print_from = new Fl_Int_Input(136, 126, 28, 25, "From:"); 00282 print_from->type(2); 00283 print_from->textfont(4); 00284 print_from->deactivate(); 00285 } // Fl_Int_Input* print_from 00286 { print_to = new Fl_Int_Input(199, 126, 28, 25, "To:"); 00287 print_to->type(2); 00288 print_to->textfont(4); 00289 print_to->deactivate(); 00290 } // Fl_Int_Input* print_to 00291 o->end(); 00292 } // Fl_Group* o 00293 { Fl_Group* o = new Fl_Group(247, 86, 210, 105, "Copies"); 00294 o->box(FL_THIN_DOWN_BOX); 00295 o->labelfont(1); 00296 o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); 00297 { print_copies = new Fl_Spinner(321, 96, 45, 25, "# Copies:"); 00298 print_copies->callback((Fl_Callback*)cb_print_copies); 00299 print_copies->when(FL_WHEN_CHANGED); 00300 } // Fl_Spinner* print_copies 00301 { print_collate_button = new Fl_Check_Button(376, 96, 64, 25, "Collate"); 00302 print_collate_button->down_box(FL_DOWN_BOX); 00303 print_collate_button->callback((Fl_Callback*)cb_print_collate_button); 00304 print_collate_button->when(FL_WHEN_CHANGED); 00305 print_collate_button->deactivate(); 00306 } // Fl_Check_Button* print_collate_button 00307 { print_collate_group[0] = new Fl_Group(257, 131, 191, 50); 00308 print_collate_group[0]->deactivate(); 00309 { Fl_Box* o = new Fl_Box(287, 141, 30, 40, "1"); 00310 o->box(FL_BORDER_BOX); 00311 o->color(FL_BACKGROUND2_COLOR); 00312 o->labelsize(11); 00313 o->align(Fl_Align(FL_ALIGN_BOTTOM_RIGHT|FL_ALIGN_INSIDE)); 00314 o->deactivate(); 00315 } // Fl_Box* o 00316 { Fl_Box* o = new Fl_Box(272, 136, 30, 40, "1"); 00317 o->box(FL_BORDER_BOX); 00318 o->color(FL_BACKGROUND2_COLOR); 00319 o->labelsize(11); 00320 o->align(Fl_Align(FL_ALIGN_BOTTOM_RIGHT|FL_ALIGN_INSIDE)); 00321 o->deactivate(); 00322 } // Fl_Box* o 00323 { Fl_Box* o = new Fl_Box(257, 131, 30, 40, "1"); 00324 o->box(FL_BORDER_BOX); 00325 o->color(FL_BACKGROUND2_COLOR); 00326 o->labelsize(11); 00327 o->align(Fl_Align(FL_ALIGN_BOTTOM_RIGHT|FL_ALIGN_INSIDE)); 00328 o->deactivate(); 00329 } // Fl_Box* o 00330 { Fl_Box* o = new Fl_Box(352, 141, 30, 40, "2"); 00331 o->box(FL_BORDER_BOX); 00332 o->color(FL_BACKGROUND2_COLOR); 00333 o->labelsize(11); 00334 o->align(Fl_Align(FL_ALIGN_BOTTOM_RIGHT|FL_ALIGN_INSIDE)); 00335 o->deactivate(); 00336 } // Fl_Box* o 00337 { Fl_Box* o = new Fl_Box(337, 136, 30, 40, "2"); 00338 o->box(FL_BORDER_BOX); 00339 o->color(FL_BACKGROUND2_COLOR); 00340 o->labelsize(11); 00341 o->align(Fl_Align(FL_ALIGN_BOTTOM_RIGHT|FL_ALIGN_INSIDE)); 00342 o->deactivate(); 00343 } // Fl_Box* o 00344 { Fl_Box* o = new Fl_Box(322, 131, 30, 40, "2"); 00345 o->box(FL_BORDER_BOX); 00346 o->color(FL_BACKGROUND2_COLOR); 00347 o->labelsize(11); 00348 o->align(Fl_Align(FL_ALIGN_BOTTOM_RIGHT|FL_ALIGN_INSIDE)); 00349 o->deactivate(); 00350 } // Fl_Box* o 00351 { Fl_Box* o = new Fl_Box(417, 141, 30, 40, "3"); 00352 o->box(FL_BORDER_BOX); 00353 o->color(FL_BACKGROUND2_COLOR); 00354 o->labelsize(11); 00355 o->align(Fl_Align(FL_ALIGN_BOTTOM_RIGHT|FL_ALIGN_INSIDE)); 00356 o->deactivate(); 00357 } // Fl_Box* o 00358 { Fl_Box* o = new Fl_Box(402, 136, 30, 40, "3"); 00359 o->box(FL_BORDER_BOX); 00360 o->color(FL_BACKGROUND2_COLOR); 00361 o->labelsize(11); 00362 o->align(Fl_Align(FL_ALIGN_BOTTOM_RIGHT|FL_ALIGN_INSIDE)); 00363 o->deactivate(); 00364 } // Fl_Box* o 00365 { Fl_Box* o = new Fl_Box(387, 131, 30, 40, "3"); 00366 o->box(FL_BORDER_BOX); 00367 o->color(FL_BACKGROUND2_COLOR); 00368 o->labelsize(11); 00369 o->align(Fl_Align(FL_ALIGN_BOTTOM_RIGHT|FL_ALIGN_INSIDE)); 00370 o->deactivate(); 00371 } // Fl_Box* o 00372 print_collate_group[0]->end(); 00373 } // Fl_Group* print_collate_group[0] 00374 { print_collate_group[1] = new Fl_Group(257, 131, 191, 50); 00375 print_collate_group[1]->hide(); 00376 print_collate_group[1]->deactivate(); 00377 { Fl_Box* o = new Fl_Box(287, 141, 30, 40, "3"); 00378 o->box(FL_BORDER_BOX); 00379 o->color(FL_BACKGROUND2_COLOR); 00380 o->labelsize(11); 00381 o->align(Fl_Align(FL_ALIGN_BOTTOM_RIGHT|FL_ALIGN_INSIDE)); 00382 } // Fl_Box* o 00383 { Fl_Box* o = new Fl_Box(272, 136, 30, 40, "2"); 00384 o->box(FL_BORDER_BOX); 00385 o->color(FL_BACKGROUND2_COLOR); 00386 o->labelsize(11); 00387 o->align(Fl_Align(FL_ALIGN_BOTTOM_RIGHT|FL_ALIGN_INSIDE)); 00388 } // Fl_Box* o 00389 { Fl_Box* o = new Fl_Box(257, 131, 30, 40, "1"); 00390 o->box(FL_BORDER_BOX); 00391 o->color(FL_BACKGROUND2_COLOR); 00392 o->labelsize(11); 00393 o->align(Fl_Align(FL_ALIGN_BOTTOM_RIGHT|FL_ALIGN_INSIDE)); 00394 } // Fl_Box* o 00395 { Fl_Box* o = new Fl_Box(352, 141, 30, 40, "3"); 00396 o->box(FL_BORDER_BOX); 00397 o->color(FL_BACKGROUND2_COLOR); 00398 o->labelsize(11); 00399 o->align(Fl_Align(FL_ALIGN_BOTTOM_RIGHT|FL_ALIGN_INSIDE)); 00400 } // Fl_Box* o 00401 { Fl_Box* o = new Fl_Box(337, 136, 30, 40, "2"); 00402 o->box(FL_BORDER_BOX); 00403 o->color(FL_BACKGROUND2_COLOR); 00404 o->labelsize(11); 00405 o->align(Fl_Align(FL_ALIGN_BOTTOM_RIGHT|FL_ALIGN_INSIDE)); 00406 } // Fl_Box* o 00407 { Fl_Box* o = new Fl_Box(322, 131, 30, 40, "1"); 00408 o->box(FL_BORDER_BOX); 00409 o->color(FL_BACKGROUND2_COLOR); 00410 o->labelsize(11); 00411 o->align(Fl_Align(FL_ALIGN_BOTTOM_RIGHT|FL_ALIGN_INSIDE)); 00412 } // Fl_Box* o 00413 { Fl_Box* o = new Fl_Box(417, 141, 30, 40, "3"); 00414 o->box(FL_BORDER_BOX); 00415 o->color(FL_BACKGROUND2_COLOR); 00416 o->labelsize(11); 00417 o->align(Fl_Align(FL_ALIGN_BOTTOM_RIGHT|FL_ALIGN_INSIDE)); 00418 } // Fl_Box* o 00419 { Fl_Box* o = new Fl_Box(402, 136, 30, 40, "2"); 00420 o->box(FL_BORDER_BOX); 00421 o->color(FL_BACKGROUND2_COLOR); 00422 o->labelsize(11); 00423 o->align(Fl_Align(FL_ALIGN_BOTTOM_RIGHT|FL_ALIGN_INSIDE)); 00424 } // Fl_Box* o 00425 { Fl_Box* o = new Fl_Box(387, 131, 30, 40, "1"); 00426 o->box(FL_BORDER_BOX); 00427 o->color(FL_BACKGROUND2_COLOR); 00428 o->labelsize(11); 00429 o->align(Fl_Align(FL_ALIGN_BOTTOM_RIGHT|FL_ALIGN_INSIDE)); 00430 } // Fl_Box* o 00431 print_collate_group[1]->end(); 00432 } // Fl_Group* print_collate_group[1] 00433 o->end(); 00434 } // Fl_Group* o 00435 { Fl_Return_Button* o = new Fl_Return_Button(309, 201, 70, 25, "Print"); 00436 o->callback((Fl_Callback*)print_cb); 00437 } // Fl_Return_Button* o 00438 { Fl_Button* o = new Fl_Button(389, 201, 68, 25, "Cancel"); 00439 o->callback((Fl_Callback*)cb_Cancel); 00440 } // Fl_Button* o 00441 print_panel_controls->end(); 00442 } // Fl_Group* print_panel_controls 00443 { print_progress = new Fl_Progress(10, 203, 289, 21); 00444 print_progress->selection_color((Fl_Color)4); 00445 print_progress->hide(); 00446 } // Fl_Progress* print_progress 00447 print_panel->set_modal(); 00448 print_panel->end(); 00449 } // Fl_Double_Window* print_panel 00450 { print_properties_panel = new Fl_Double_Window(290, 130, "Printer Properties"); 00451 print_properties_panel->callback((Fl_Callback*)cb_print_properties_panel); 00452 { print_page_size = new Fl_Choice(110, 10, 80, 25, "Page Size:"); 00453 print_page_size->down_box(FL_BORDER_BOX); 00454 print_page_size->labelfont(1); 00455 print_page_size->menu(menu_print_page_size); 00456 } // Fl_Choice* print_page_size 00457 { Fl_Group* o = new Fl_Group(110, 45, 170, 40, "Output Mode:"); 00458 o->labelfont(1); 00459 o->align(Fl_Align(FL_ALIGN_LEFT)); 00460 { print_output_mode[0] = new Fl_Button(110, 45, 30, 40); 00461 print_output_mode[0]->type(102); 00462 print_output_mode[0]->box(FL_BORDER_BOX); 00463 print_output_mode[0]->down_box(FL_BORDER_BOX); 00464 print_output_mode[0]->value(1); 00465 print_output_mode[0]->color(FL_BACKGROUND2_COLOR); 00466 print_output_mode[0]->selection_color(FL_FOREGROUND_COLOR); 00467 print_output_mode[0]->image(image_print_color); 00468 } // Fl_Button* print_output_mode[0] 00469 { print_output_mode[1] = new Fl_Button(150, 50, 40, 30); 00470 print_output_mode[1]->type(102); 00471 print_output_mode[1]->box(FL_BORDER_BOX); 00472 print_output_mode[1]->down_box(FL_BORDER_BOX); 00473 print_output_mode[1]->color(FL_BACKGROUND2_COLOR); 00474 print_output_mode[1]->selection_color(FL_FOREGROUND_COLOR); 00475 print_output_mode[1]->image(image_print_color); 00476 } // Fl_Button* print_output_mode[1] 00477 { print_output_mode[2] = new Fl_Button(200, 45, 30, 40); 00478 print_output_mode[2]->type(102); 00479 print_output_mode[2]->box(FL_BORDER_BOX); 00480 print_output_mode[2]->down_box(FL_BORDER_BOX); 00481 print_output_mode[2]->color(FL_BACKGROUND2_COLOR); 00482 print_output_mode[2]->selection_color(FL_FOREGROUND_COLOR); 00483 print_output_mode[2]->image(image_print_gray); 00484 } // Fl_Button* print_output_mode[2] 00485 { print_output_mode[3] = new Fl_Button(240, 50, 40, 30); 00486 print_output_mode[3]->type(102); 00487 print_output_mode[3]->box(FL_BORDER_BOX); 00488 print_output_mode[3]->down_box(FL_BORDER_BOX); 00489 print_output_mode[3]->color(FL_BACKGROUND2_COLOR); 00490 print_output_mode[3]->selection_color(FL_FOREGROUND_COLOR); 00491 print_output_mode[3]->image(image_print_gray); 00492 } // Fl_Button* print_output_mode[3] 00493 o->end(); 00494 } // Fl_Group* o 00495 { Fl_Return_Button* o = new Fl_Return_Button(123, 95, 79, 25, "Save"); 00496 o->callback((Fl_Callback*)cb_Save); 00497 } // Fl_Return_Button* o 00498 { Fl_Button* o = new Fl_Button(212, 95, 68, 25, "Cancel"); 00499 o->callback((Fl_Callback*)cb_Cancel1); 00500 } // Fl_Button* o 00501 { Fl_Button* o = new Fl_Button(60, 95, 53, 25, "Use"); 00502 o->callback((Fl_Callback*)cb_Use); 00503 } // Fl_Button* o 00504 print_properties_panel->set_modal(); 00505 print_properties_panel->end(); 00506 } // Fl_Double_Window* print_properties_panel 00507 return print_properties_panel; 00508 } 00509 void print_cb(Fl_Return_Button *, void *); 00510 00511 void print_load() { 00512 FILE *lpstat; 00513 char line[1024], name[1024], *nptr, qname[2048], *qptr, defname[1024]; 00514 int i; 00515 00516 if (print_choice->size() > 1) { 00517 for (i = 1; print_choice->text(i); i ++) { 00518 free(print_choice->menu()[i].user_data()); 00519 } 00520 } 00521 00522 print_choice->clear(); 00523 print_choice->add("Print To File", 0, 0, 0, FL_MENU_DIVIDER); 00524 print_choice->value(0); 00525 00526 defname[0] = '\0'; 00527 00528 if ((lpstat = popen("LC_MESSAGES=C LANG=C lpstat -p -d", "r")) != NULL) { 00529 while (fgets(line, sizeof(line), lpstat)) { 00530 if (!strncmp(line, "printer ", 8) && 00531 sscanf(line + 8, "%s", name) == 1) { 00532 for (nptr = name, qptr = qname; *nptr; *qptr++ = *nptr++) { 00533 if (*nptr == '/') *qptr++ = '\\'; 00534 } 00535 *qptr = '\0'; 00536 00537 print_choice->add(qname, 0, 0, (void *)strdup(name), 0); 00538 } else if (!strncmp(line, "system default destination: ", 28)) { 00539 if (sscanf(line + 28, "%s", defname) != 1) defname[0] = '\0'; 00540 } 00541 } 00542 pclose(lpstat); 00543 } 00544 00545 if (defname[0]) { 00546 for (i = 1; print_choice->text(i); i ++) { 00547 if (!strcmp((char *)print_choice->menu()[i].user_data(), defname)) { 00548 print_choice->value(i); 00549 break; 00550 } 00551 } 00552 } else if (print_choice->size() > 2) print_choice->value(1); 00553 00554 00555 print_update_status(); 00556 } 00557 00558 void print_update_status() { 00559 FILE *lpstat; 00560 char command[1024]; 00561 static char status[1024]; 00562 const char *printer = (const char *)print_choice->menu()[print_choice->value()].user_data(); 00563 00564 if (print_choice->value()) { 00565 snprintf(command, sizeof(command), "lpstat -p '%s'", printer); 00566 if ((lpstat = popen(command, "r")) != NULL) { 00567 if (fgets(status, sizeof(status), lpstat)==0) { /* ignore */ } 00568 pclose(lpstat); 00569 } else strcpy(status, "printer status unavailable"); 00570 } else status[0] = '\0'; 00571 00572 print_status->label(status); 00573 00574 char name[1024]; 00575 int val; 00576 00577 snprintf(name, sizeof(name), "%s/page_size", printer); 00578 fluid_prefs.get(name, val, 0); 00579 print_page_size->value(val); 00580 00581 snprintf(name, sizeof(name), "%s/output_mode", printer); 00582 fluid_prefs.get(name, val, 0); 00583 print_output_mode[val]->setonly(); 00584 } 00585 00586 // 00587 // End of "$Id$". 00588 //