Printing support for FLUID...
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@4150 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
parent
e12e37c5f9
commit
bcadb07bb2
3
CHANGES
3
CHANGES
@ -2,6 +2,9 @@ CHANGES IN FLTK 1.1.7
|
||||
|
||||
- Documentation fixes (STR #648, STR #692, STR #730, STR
|
||||
#744, STR #745)
|
||||
- FLUID now supports printing of windows.
|
||||
- Fixed inactive drawing of border, embossed, and
|
||||
engraved box types.
|
||||
- Added Fl_Spinner widget (another combination of
|
||||
existing widgets in a header file)
|
||||
- FLUID now provides support for UI templates.
|
||||
|
@ -35,6 +35,7 @@
|
||||
# include <FL/Fl_Group.H>
|
||||
# include <FL/Fl_Input.H>
|
||||
# include <FL/Fl_Repeat_Button.H>
|
||||
# include <stdio.h>
|
||||
# include <stdlib.h>
|
||||
|
||||
|
||||
|
@ -39,6 +39,7 @@ CPPFILES = \
|
||||
file.cxx \
|
||||
fluid.cxx \
|
||||
function_panel.cxx \
|
||||
print_panel.cxx \
|
||||
template_panel.cxx \
|
||||
undo.cxx \
|
||||
widget_panel.cxx
|
||||
|
354
fluid/fluid.cxx
354
fluid/fluid.cxx
@ -46,6 +46,9 @@
|
||||
#include "alignment_panel.h"
|
||||
#include "function_panel.h"
|
||||
#include "template_panel.h"
|
||||
#ifndef WIN32
|
||||
# include "print_panel.h"
|
||||
#endif // !WIN32
|
||||
|
||||
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||
# include <direct.h>
|
||||
@ -826,6 +829,355 @@ void manual_cb(Fl_Widget *, void *) {
|
||||
show_help("index.html");
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
// Load and show the print dialog...
|
||||
void print_menu_cb(Fl_Widget *, void *) {
|
||||
#ifdef WIN32
|
||||
fl_message("Sorry, printing is not yet implemented on Windows...");
|
||||
}
|
||||
#else
|
||||
if (!print_panel) make_print_panel();
|
||||
|
||||
print_load();
|
||||
|
||||
print_selection->deactivate();
|
||||
|
||||
for (Fl_Type *t = Fl_Type::first; t; t = t->next) {
|
||||
if (t->selected && t->is_window()) {
|
||||
print_selection->activate();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
print_all->setonly();
|
||||
print_all->do_callback();
|
||||
|
||||
print_panel->show();
|
||||
}
|
||||
|
||||
// Actually print...
|
||||
void print_cb(Fl_Return_Button *, void *) {
|
||||
FILE *outfile; // Output file or pipe to print command
|
||||
char command[1024]; // Print command
|
||||
int copies; // Collated copies
|
||||
int first, last; // First and last page
|
||||
int page; // Current page
|
||||
int winpage; // Current window page
|
||||
int num_pages; // Number of pages
|
||||
Fl_Type *t; // Current widget
|
||||
int num_windows; // Number of windows
|
||||
Fl_Window_Type *windows[1000]; // Windows to print
|
||||
|
||||
// Show progress, deactivate controls...
|
||||
print_panel_controls->deactivate();
|
||||
print_progress->show();
|
||||
|
||||
// Figure out how many pages we'll have to print...
|
||||
if (print_collate_button->value()) copies = print_copies->value();
|
||||
else copies = 1;
|
||||
|
||||
if (print_pages->value()) {
|
||||
// Get from and to page numbers...
|
||||
if ((first = atoi(print_from->value())) < 1) first = 1;
|
||||
if ((last = atoi(print_to->value())) < 1) last = 1000;
|
||||
|
||||
if (first > last) {
|
||||
// Swap first/last page
|
||||
page = first;
|
||||
first = last;
|
||||
last = page;
|
||||
}
|
||||
} else {
|
||||
// Print everything...
|
||||
first = 1;
|
||||
last = 1000;
|
||||
}
|
||||
|
||||
for (t = Fl_Type::first, num_windows = 0, winpage = 0; t; t = t->next) {
|
||||
if (t->is_window()) {
|
||||
winpage ++;
|
||||
windows[num_windows] = (Fl_Window_Type *)t;
|
||||
|
||||
if (print_all->value()) num_windows ++;
|
||||
else if (print_pages->value() && winpage >= first &&
|
||||
winpage <= last) num_windows ++;
|
||||
else if (print_selection->value() && t->selected) num_windows ++;
|
||||
}
|
||||
}
|
||||
|
||||
num_pages = num_windows * copies;
|
||||
|
||||
print_progress->minimum(0);
|
||||
print_progress->maximum(num_pages);
|
||||
print_progress->value(0);
|
||||
Fl::check();
|
||||
|
||||
// Get the base filename...
|
||||
const char *basename = strrchr(filename, '/');
|
||||
if (basename) basename ++;
|
||||
else basename = filename;
|
||||
|
||||
// Open the print stream...
|
||||
if (print_choice->value()) {
|
||||
// Pipe the output into the lp command...
|
||||
snprintf(command, sizeof(command), "lp -s -d %s -n %d -t '%s' -o media=%s",
|
||||
print_choice->text(print_choice->value()),
|
||||
print_collate_button->value() ? 1 : print_copies->value(),
|
||||
basename, print_page_size->text(print_page_size->value()));
|
||||
outfile = popen(command, "w");
|
||||
} else {
|
||||
// Print to file...
|
||||
fl_ok = "Print";
|
||||
const char *outname = fl_file_chooser("Print To", "PostScript (*.ps)", NULL);
|
||||
fl_ok = "OK";
|
||||
|
||||
if (outname) outfile = fopen(outname, "w");
|
||||
}
|
||||
|
||||
if (outfile) {
|
||||
// Figure out the page size and margins...
|
||||
int width, length; // Size of page
|
||||
int left, bottom, // Bottom lefthand corner
|
||||
right, top; // Top righthand corner
|
||||
|
||||
if (print_page_size->value()) {
|
||||
// A4
|
||||
width = 595;
|
||||
length = 842;
|
||||
} else {
|
||||
// Letter
|
||||
width = 612;
|
||||
length = 792;
|
||||
}
|
||||
|
||||
int output_mode;
|
||||
for (output_mode = 0; output_mode < 4; output_mode ++) {
|
||||
if (print_output_mode[output_mode]->value()) break;
|
||||
}
|
||||
|
||||
if (output_mode & 1) {
|
||||
// Landscape
|
||||
left = 36;
|
||||
bottom = 18;
|
||||
right = length - 36;
|
||||
top = width - 18;
|
||||
} else {
|
||||
// Portrait
|
||||
left = 18;
|
||||
bottom = 36;
|
||||
right = width - 18;
|
||||
top = length - 36;
|
||||
}
|
||||
|
||||
// Get the time and date...
|
||||
time_t curtime = time(NULL);
|
||||
struct tm *curdate = localtime(&curtime);
|
||||
char date[1024];
|
||||
|
||||
strftime(date, sizeof(date), "%c", curdate);
|
||||
|
||||
// Write the prolog...
|
||||
fprintf(outfile,
|
||||
"%%!PS-Adobe-3.0\n"
|
||||
"%%%%BoundingBox: 18 36 %d %d\n"
|
||||
"%%%%Pages: %d\n"
|
||||
"%%%%LanguageLevel: 1\n"
|
||||
"%%%%DocumentData: Clean7Bit\n"
|
||||
"%%%%DocumentNeededResources: font Helvetica\n"
|
||||
"%%%%Creator: FLUID %.4f\n"
|
||||
"%%%%CreationDate: %s\n"
|
||||
"%%%%Title: (%s)\n"
|
||||
"%%%%EndComments\n"
|
||||
"%%%%BeginSetup\n"
|
||||
"%%%%BeginFeature: *PageSize %s\n"
|
||||
"languagelevel 1 ne {\n"
|
||||
" <</PageSize[%d %d]/ImagingBBox null>>setpagedevice\n"
|
||||
"} {\n"
|
||||
" %s\n"
|
||||
"} ifelse\n"
|
||||
"%%%%EndFeature\n"
|
||||
"%%%%EndSetup\n",
|
||||
width - 18, length - 36,
|
||||
num_pages,
|
||||
FL_VERSION,
|
||||
date,
|
||||
basename,
|
||||
print_page_size->text(print_page_size->value()),
|
||||
width, length,
|
||||
print_page_size->value() ? "a4tray" : "lettertray");
|
||||
|
||||
// Print each of the windows...
|
||||
char progress[255]; // Progress text
|
||||
int copy; // Current copy
|
||||
|
||||
for (copy = 0, page = 0; copy < copies; copy ++) {
|
||||
for (winpage = 0; winpage < num_pages; winpage ++) {
|
||||
// Start next page...
|
||||
page ++;
|
||||
sprintf(progress, "Printing page %d/%d...", page, num_pages);
|
||||
print_progress->value(page);
|
||||
print_progress->label(progress);
|
||||
Fl::check();
|
||||
|
||||
// Add common page stuff...
|
||||
fprintf(outfile,
|
||||
"%%%%Page: %d %d\n"
|
||||
"gsave\n",
|
||||
page, page);
|
||||
|
||||
if (output_mode & 1) {
|
||||
// Landscape...
|
||||
fprintf(outfile, "%d 0 translate 90 rotate\n", width);
|
||||
}
|
||||
|
||||
// Draw header...
|
||||
fprintf(outfile,
|
||||
"0 setgray\n"
|
||||
"/Helvetica findfont 14 scalefont setfont\n"
|
||||
"%d %d moveto (%s) show\n"
|
||||
"%.1f %d moveto (%s) dup stringwidth pop -0.5 mul 0 rmoveto show\n"
|
||||
"%d %d moveto (%d) dup stringwidth pop neg 0 rmoveto show\n",
|
||||
left, top - 15, basename,
|
||||
0.5 * (left + right), top - 15, date,
|
||||
right, top - 15, winpage + 1);
|
||||
|
||||
// Get window image...
|
||||
uchar *pixels; // Window image data
|
||||
int w, h; // Window image dimensions
|
||||
float ww, hh; // Scaled size
|
||||
float border; // Width of 1 pixel
|
||||
float llx, lly, // Lower-lefthand corner
|
||||
urx, ury; // Upper-righthand corner
|
||||
|
||||
pixels = windows[winpage]->read_image(w, h);
|
||||
|
||||
// Figure out the window size, first at 100 PPI and then scaled
|
||||
// down if that is too big...
|
||||
ww = w * 72.0 / 100.0;
|
||||
hh = h * 72.0 / 100.0;
|
||||
|
||||
if (ww > (right - left)) {
|
||||
ww = right - left;
|
||||
hh = h * ww / w;
|
||||
}
|
||||
|
||||
if (hh > (top - bottom - 36)) {
|
||||
hh = top - bottom;
|
||||
ww = w * hh / h;
|
||||
}
|
||||
|
||||
border = ww / w;
|
||||
|
||||
// Position the window in the center...
|
||||
llx = 0.5 * (right - left - ww);
|
||||
lly = 0.5 * (top - bottom - hh);
|
||||
urx = 0.5 * (right - left + ww);
|
||||
ury = 0.5 * (top - bottom + hh);
|
||||
|
||||
// Draw a simulated window border...
|
||||
if (output_mode & 2) {
|
||||
fputs("0.25 setgray\n", outfile);
|
||||
} else {
|
||||
fputs("0.1 0.2 0.6 setrgbcolor\n", outfile);
|
||||
}
|
||||
|
||||
fprintf(outfile,
|
||||
"newpath %.2f %.2f %.2f 180 90 arcn\n" // Top left
|
||||
"%.2f 0 rlineto\n" // Top
|
||||
"%.2f %.2f %.2f 90 0 arcn\n" // Top right
|
||||
"0 -%.2f rlineto\n" // Right
|
||||
"%.2f %.2f %.2f 0 -90 arcn\n" // Bottom right
|
||||
"-%.2f 0 rlineto\n" // Bottom
|
||||
"%.2f %.2f %.2f -90 -180 arcn\n" // Bottom left
|
||||
"closepath fill\n", // Left + fill
|
||||
llx + 12 * border, ury, 16 * border,
|
||||
ww - 8 * border,
|
||||
urx - 12 * border, ury, 16 * border,
|
||||
hh,
|
||||
urx, lly, 4 * border,
|
||||
ww - 4 * border,
|
||||
llx, lly, 4 * border);
|
||||
|
||||
if (windows[winpage]->label()) {
|
||||
// Add window title...
|
||||
fprintf(outfile,
|
||||
"1 setgray\n"
|
||||
"/Helvetica findfont %.2f scalefont setfont\n"
|
||||
"%.2f %.2f moveto\n"
|
||||
"(%s) dup stringwidth pop -0.5 mul 0 rmoveto show\n",
|
||||
12 * border,
|
||||
0.5 * (llx + urx), ury + 4 * border,
|
||||
windows[winpage]->label());
|
||||
}
|
||||
|
||||
fprintf(outfile,
|
||||
"gsave\n"
|
||||
"%.2f %.2f translate %.2f %.2f scale\n",
|
||||
llx, ury, border, border);
|
||||
|
||||
if (output_mode & 2) {
|
||||
// Grayscale image...
|
||||
fprintf(outfile,
|
||||
"/imgdata %d string def\n"
|
||||
"%d %d 8[1 0 0 -1 0 1] "
|
||||
"{currentfile imgdata readhexstring pop} image\n",
|
||||
w,
|
||||
w, h);
|
||||
|
||||
uchar *ptr = pixels;
|
||||
int i, count = w * h;
|
||||
|
||||
for (i = 0; i < count; i ++, ptr += 3) {
|
||||
fprintf(outfile, "%02X",
|
||||
(31 * ptr[0] + 61 * ptr[1] + 8 * ptr[2]) / 100);
|
||||
if (!(i % 40)) putc('\n', outfile);
|
||||
}
|
||||
} else {
|
||||
// Color image...
|
||||
fprintf(outfile,
|
||||
"/imgdata %d string def\n"
|
||||
"%d %d 8[1 0 0 -1 0 1] "
|
||||
"{currentfile imgdata readhexstring pop} false 3 colorimage\n",
|
||||
w * 3,
|
||||
w, h);
|
||||
|
||||
uchar *ptr = pixels;
|
||||
int i, count = w * h;
|
||||
|
||||
for (i = 0; i < count; i ++, ptr += 3) {
|
||||
fprintf(outfile, "%02X%02X%02X", ptr[0], ptr[1], ptr[2]);
|
||||
if (!(i % 13)) putc('\n', outfile);
|
||||
}
|
||||
}
|
||||
|
||||
fputs("\ngrestore\n", outfile);
|
||||
|
||||
delete[] pixels;
|
||||
|
||||
// Show the page...
|
||||
fputs("grestore showpage\n", outfile);
|
||||
}
|
||||
}
|
||||
|
||||
// Finish up...
|
||||
fputs("%%EOF\n", outfile);
|
||||
|
||||
if (print_choice->value()) pclose(outfile);
|
||||
else fclose(outfile);
|
||||
} else {
|
||||
// Unable to print...
|
||||
fl_alert("Error printing: %s", strerror(errno));
|
||||
}
|
||||
|
||||
// Hide progress, activate controls, hide print panel...
|
||||
print_panel_controls->activate();
|
||||
print_progress->hide();
|
||||
print_panel->hide();
|
||||
}
|
||||
#endif // WIN32
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
extern Fl_Menu_Item New_Menu[];
|
||||
@ -852,7 +1204,7 @@ Fl_Menu_Item Main_Menu[] = {
|
||||
{"&Save", FL_CTRL+'s', save_cb, 0},
|
||||
{"Save &As...", FL_CTRL+FL_SHIFT+'s', save_cb, (void*)1},
|
||||
{"Save &Template...", 0, save_template_cb, (void*)2, FL_MENU_DIVIDER},
|
||||
{"&Print...", FL_CTRL+'p', 0},
|
||||
{"&Print...", FL_CTRL+'p', print_menu_cb},
|
||||
{"Write &Code...", FL_CTRL+FL_SHIFT+'c', write_cb, 0},
|
||||
{"&Write Strings...", FL_CTRL+FL_SHIFT+'w', write_strings_cb, 0, FL_MENU_DIVIDER},
|
||||
{"&Quit", FL_CTRL+'q', exit_cb},
|
||||
|
@ -255,10 +255,11 @@ fluid.o: alignment_panel.h ../FL/Fl_Text_Buffer.H ../FL/Fl_Text_Display.H
|
||||
fluid.o: ../FL/Fl_Text_Buffer.H ../FL/Fl_Tooltip.H ../FL/Fl_Widget.H
|
||||
fluid.o: ../FL/Fl_Tabs.H ../FL/Fl_Light_Button.H function_panel.h
|
||||
fluid.o: ../FL/Fl_Window.H ../FL/Fl_Text_Editor.H ../FL/Fl_Text_Display.H
|
||||
fluid.o: template_panel.h ../FL/Fl_Browser.H about_panel.h undo.h Fl_Type.h
|
||||
fluid.o: ../FL/Fl_Menu.H Fluid_Image.h ../FL/Fl_Shared_Image.H
|
||||
fluid.o: ../FL/Fl_Pack.H ../FL/Fl_Wizard.H ../FL/Fl_Menu_.H
|
||||
fluid.o: ../FL/Fl_Input_Choice.H
|
||||
fluid.o: template_panel.h ../FL/Fl_Browser.H print_panel.h
|
||||
fluid.o: ../FL/Fl_Round_Button.H ../FL/Fl_Spinner.H ../FL/Fl_Repeat_Button.H
|
||||
fluid.o: ../FL/Fl_Progress.H about_panel.h undo.h Fl_Type.h ../FL/Fl_Menu.H
|
||||
fluid.o: Fluid_Image.h ../FL/Fl_Shared_Image.H ../FL/Fl_Pack.H
|
||||
fluid.o: ../FL/Fl_Wizard.H ../FL/Fl_Menu_.H ../FL/Fl_Input_Choice.H
|
||||
function_panel.o: function_panel.h ../FL/Fl.H ../FL/Enumerations.H
|
||||
function_panel.o: ../FL/Fl_Export.H ../FL/Fl_Window.H ../FL/Fl_Light_Button.H
|
||||
function_panel.o: ../FL/Fl_Input.H ../FL/Fl_Input_.H ../FL/Fl_Return_Button.H
|
||||
@ -273,6 +274,17 @@ function_panel.o: ../FL/Fl_Shared_Image.H ../FL/fl_draw.H ../FL/Fl_Tabs.H
|
||||
function_panel.o: ../FL/Fl_Pack.H ../FL/Fl_Wizard.H ../FL/Fl_Menu_.H
|
||||
function_panel.o: ../FL/Fl_Choice.H ../FL/Fl_Input_Choice.H
|
||||
function_panel.o: ../FL/Fl_Menu_Bar.H undo.h
|
||||
print_panel.o: print_panel.h ../FL/Fl.H ../FL/Enumerations.H
|
||||
print_panel.o: ../FL/Fl_Export.H ../FL/Fl_Double_Window.H ../FL/Fl_Window.H
|
||||
print_panel.o: ../FL/Fl_Group.H ../FL/Fl_Widget.H ../FL/Fl_Group.H
|
||||
print_panel.o: ../FL/Fl_Choice.H ../FL/Fl_Menu_.H ../FL/Fl_Menu_Item.H
|
||||
print_panel.o: ../FL/Fl_Image.H ../FL/Fl_Button.H ../FL/Fl_Box.H
|
||||
print_panel.o: ../FL/Fl_Round_Button.H ../FL/Fl_Light_Button.H
|
||||
print_panel.o: ../FL/Fl_Button.H ../FL/Fl_Input.H ../FL/Fl_Input_.H
|
||||
print_panel.o: ../FL/Fl_Spinner.H ../FL/Fl_Repeat_Button.H ../FL/Fl.H
|
||||
print_panel.o: ../FL/Fl_Check_Button.H ../FL/Fl_Return_Button.H
|
||||
print_panel.o: ../FL/Fl_Progress.H ../src/flstring.h ../FL/Fl_Export.H
|
||||
print_panel.o: ../config.h ../FL/Fl_Preferences.H ../FL/Fl_Pixmap.H
|
||||
template_panel.o: template_panel.h ../FL/Fl.H ../FL/Enumerations.H
|
||||
template_panel.o: ../FL/Fl_Export.H ../FL/Fl_Double_Window.H
|
||||
template_panel.o: ../FL/Fl_Window.H ../FL/Fl_Group.H ../FL/Fl_Widget.H
|
||||
|
44
fluid/pixmaps/print_color.xpm
Normal file
44
fluid/pixmaps/print_color.xpm
Normal file
@ -0,0 +1,44 @@
|
||||
/* XPM */
|
||||
static char * print_color_xpm[] = {
|
||||
"24 24 17 1",
|
||||
" c None",
|
||||
". c #FFFF00",
|
||||
"+ c #C8FF00",
|
||||
"@ c #00FF00",
|
||||
"# c #FFC800",
|
||||
"$ c #FF0000",
|
||||
"% c #00FFFF",
|
||||
"& c #000000",
|
||||
"* c #FF00FF",
|
||||
"= c #00FFC8",
|
||||
"- c #FF00C8",
|
||||
"; c #00C800",
|
||||
"> c #C80000",
|
||||
", c #0000C8",
|
||||
"' c #0000FF",
|
||||
") c #00C8FF",
|
||||
"! c #C800FF",
|
||||
" ...... ",
|
||||
" .......... ",
|
||||
" ............ ",
|
||||
" .............. ",
|
||||
" .............. ",
|
||||
" ................ ",
|
||||
" ................ ",
|
||||
" ................ ",
|
||||
" +@@@@@@+#$$$$$$# ",
|
||||
" %@@@@@@@&&$$$$$$$* ",
|
||||
" %%@@@@@@&&&&$$$$$$** ",
|
||||
" %%%=@@@@&&&&&&$$$$-*** ",
|
||||
" %%%%@@@;&&&&&&>$$$**** ",
|
||||
"%%%%%%@@&&&&&&&&$$******",
|
||||
"%%%%%%%@&&&&&&&&$*******",
|
||||
"%%%%%%%%,&&&&&&,********",
|
||||
"%%%%%%%%''''''''********",
|
||||
"%%%%%%%%''''''''********",
|
||||
"%%%%%%%%''''''''********",
|
||||
" %%%%%%%)''''''!******* ",
|
||||
" %%%%%%%%''''''******** ",
|
||||
" %%%%%%%%''''******** ",
|
||||
" %%%%%%%%''******** ",
|
||||
" %%%%%% ****** "};
|
44
fluid/pixmaps/print_gray.xpm
Normal file
44
fluid/pixmaps/print_gray.xpm
Normal file
@ -0,0 +1,44 @@
|
||||
/* XPM */
|
||||
static char * print_gray_xpm[] = {
|
||||
"24 24 17 1",
|
||||
" c None",
|
||||
". c #E3E3E3",
|
||||
"+ c #D2D2D2",
|
||||
"@ c #969696",
|
||||
"# c #C2C2C2",
|
||||
"$ c #4C4C4C",
|
||||
"% c #B2B2B2",
|
||||
"& c #000000",
|
||||
"* c #696969",
|
||||
"= c #ACACAC",
|
||||
"- c #626262",
|
||||
"; c #767676",
|
||||
"> c #3C3C3C",
|
||||
", c #161616",
|
||||
"' c #1C1C1C",
|
||||
") c #929292",
|
||||
"! c #585858",
|
||||
" ...... ",
|
||||
" .......... ",
|
||||
" ............ ",
|
||||
" .............. ",
|
||||
" .............. ",
|
||||
" ................ ",
|
||||
" ................ ",
|
||||
" ................ ",
|
||||
" +@@@@@@+#$$$$$$# ",
|
||||
" %@@@@@@@&&$$$$$$$* ",
|
||||
" %%@@@@@@&&&&$$$$$$** ",
|
||||
" %%%=@@@@&&&&&&$$$$-*** ",
|
||||
" %%%%@@@;&&&&&&>$$$**** ",
|
||||
"%%%%%%@@&&&&&&&&$$******",
|
||||
"%%%%%%%@&&&&&&&&$*******",
|
||||
"%%%%%%%%,&&&&&&,********",
|
||||
"%%%%%%%%''''''''********",
|
||||
"%%%%%%%%''''''''********",
|
||||
"%%%%%%%%''''''''********",
|
||||
" %%%%%%%)''''''!******* ",
|
||||
" %%%%%%%%''''''******** ",
|
||||
" %%%%%%%%''''******** ",
|
||||
" %%%%%%%%''******** ",
|
||||
" %%%%%% ****** "};
|
578
fluid/print_panel.cxx
Normal file
578
fluid/print_panel.cxx
Normal file
@ -0,0 +1,578 @@
|
||||
//
|
||||
// "$Id$"
|
||||
//
|
||||
// FLUID print panel for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
// Copyright 1998-2005 by Bill Spitzak and others.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Library General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2 of the License, or (at your option) any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Library General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Library General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
// USA.
|
||||
//
|
||||
// Please report all bugs and problems on the following page:
|
||||
//
|
||||
// http://www.fltk.org/str.php
|
||||
//
|
||||
|
||||
// generated by Fast Light User Interface Designer (fluid) version 1.0107
|
||||
|
||||
#include "print_panel.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "../src/flstring.h"
|
||||
#include <FL/Fl_Preferences.H>
|
||||
extern Fl_Preferences fluid_prefs;
|
||||
|
||||
Fl_Double_Window *print_panel=(Fl_Double_Window *)0;
|
||||
|
||||
Fl_Group *print_panel_controls=(Fl_Group *)0;
|
||||
|
||||
Fl_Choice *print_choice=(Fl_Choice *)0;
|
||||
|
||||
static void cb_print_choice(Fl_Choice*, void*) {
|
||||
print_update_status();
|
||||
}
|
||||
|
||||
Fl_Button *print_properties=(Fl_Button *)0;
|
||||
|
||||
static void cb_print_properties(Fl_Button*, void*) {
|
||||
print_properties_panel->show();
|
||||
}
|
||||
|
||||
Fl_Box *print_status=(Fl_Box *)0;
|
||||
|
||||
Fl_Round_Button *print_all=(Fl_Round_Button *)0;
|
||||
|
||||
static void cb_print_all(Fl_Round_Button*, void*) {
|
||||
print_from->deactivate();
|
||||
print_to->deactivate();
|
||||
}
|
||||
|
||||
Fl_Round_Button *print_pages=(Fl_Round_Button *)0;
|
||||
|
||||
static void cb_print_pages(Fl_Round_Button*, void*) {
|
||||
print_from->activate();
|
||||
print_to->activate();
|
||||
}
|
||||
|
||||
Fl_Round_Button *print_selection=(Fl_Round_Button *)0;
|
||||
|
||||
static void cb_print_selection(Fl_Round_Button*, void*) {
|
||||
print_from->deactivate();
|
||||
print_to->deactivate();
|
||||
}
|
||||
|
||||
Fl_Input *print_from=(Fl_Input *)0;
|
||||
|
||||
Fl_Input *print_to=(Fl_Input *)0;
|
||||
|
||||
Fl_Spinner *print_copies=(Fl_Spinner *)0;
|
||||
|
||||
static void cb_print_copies(Fl_Spinner*, void*) {
|
||||
if (print_copies->value() == 1) {
|
||||
print_collate_button->deactivate();
|
||||
print_collate_group[0]->deactivate();
|
||||
print_collate_group[1]->deactivate();
|
||||
} else {
|
||||
print_collate_button->activate();
|
||||
print_collate_group[0]->activate();
|
||||
print_collate_group[1]->activate();
|
||||
};
|
||||
}
|
||||
|
||||
Fl_Check_Button *print_collate_button=(Fl_Check_Button *)0;
|
||||
|
||||
static void cb_print_collate_button(Fl_Check_Button*, void*) {
|
||||
int i = print_collate_button->value() != 0;
|
||||
print_collate_group[i]->show();
|
||||
print_collate_group[1 - i]->hide();
|
||||
}
|
||||
|
||||
Fl_Group *print_collate_group[2]={(Fl_Group *)0};
|
||||
|
||||
static void cb_Cancel(Fl_Button*, void*) {
|
||||
print_panel->hide();
|
||||
}
|
||||
|
||||
Fl_Progress *print_progress=(Fl_Progress *)0;
|
||||
|
||||
Fl_Double_Window *print_properties_panel=(Fl_Double_Window *)0;
|
||||
|
||||
static void cb_print_properties_panel(Fl_Double_Window*, void*) {
|
||||
print_properties_panel->hide();
|
||||
print_update_status();
|
||||
}
|
||||
|
||||
Fl_Choice *print_page_size=(Fl_Choice *)0;
|
||||
|
||||
Fl_Menu_Item menu_print_page_size[] = {
|
||||
{"Letter", 0, 0, 0, 0, FL_NORMAL_LABEL, 0, 14, 56},
|
||||
{"A4", 0, 0, 0, 0, FL_NORMAL_LABEL, 0, 14, 56},
|
||||
{0,0,0,0,0,0,0,0,0}
|
||||
};
|
||||
|
||||
#include <FL/Fl_Pixmap.H>
|
||||
static const char *idata_print_color[] = {
|
||||
"24 24 17 1",
|
||||
" \tc None",
|
||||
".\tc #FFFF00",
|
||||
"+\tc #C8FF00",
|
||||
"@\tc #00FF00",
|
||||
"#\tc #FFC800",
|
||||
"$\tc #FF0000",
|
||||
"%\tc #00FFFF",
|
||||
"&\tc #000000",
|
||||
"*\tc #FF00FF",
|
||||
"=\tc #00FFC8",
|
||||
"-\tc #FF00C8",
|
||||
";\tc #00C800",
|
||||
">\tc #C80000",
|
||||
",\tc #0000C8",
|
||||
"\'\tc #0000FF",
|
||||
")\tc #00C8FF",
|
||||
"!\tc #C800FF",
|
||||
" ...... ",
|
||||
" .......... ",
|
||||
" ............ ",
|
||||
" .............. ",
|
||||
" .............. ",
|
||||
" ................ ",
|
||||
" ................ ",
|
||||
" ................ ",
|
||||
" +@@@@@@+#$$$$$$# ",
|
||||
" %@@@@@@@&&$$$$$$$* ",
|
||||
" %%@@@@@@&&&&$$$$$$** ",
|
||||
" %%%=@@@@&&&&&&$$$$-*** ",
|
||||
" %%%%@@@;&&&&&&>$$$**** ",
|
||||
"%%%%%%@@&&&&&&&&$$******",
|
||||
"%%%%%%%@&&&&&&&&$*******",
|
||||
"%%%%%%%%,&&&&&&,********",
|
||||
"%%%%%%%%\'\'\'\'\'\'\'\'********",
|
||||
"%%%%%%%%\'\'\'\'\'\'\'\'********",
|
||||
"%%%%%%%%\'\'\'\'\'\'\'\'********",
|
||||
" %%%%%%%)\'\'\'\'\'\'!******* ",
|
||||
" %%%%%%%%\'\'\'\'\'\'******** ",
|
||||
" %%%%%%%%\'\'\'\'******** ",
|
||||
" %%%%%%%%\'\'******** ",
|
||||
" %%%%%% ****** "
|
||||
};
|
||||
static Fl_Pixmap image_print_color(idata_print_color);
|
||||
|
||||
static const char *idata_print_gray[] = {
|
||||
"24 24 17 1",
|
||||
" \tc None",
|
||||
".\tc #E3E3E3",
|
||||
"+\tc #D2D2D2",
|
||||
"@\tc #969696",
|
||||
"#\tc #C2C2C2",
|
||||
"$\tc #4C4C4C",
|
||||
"%\tc #B2B2B2",
|
||||
"&\tc #000000",
|
||||
"*\tc #696969",
|
||||
"=\tc #ACACAC",
|
||||
"-\tc #626262",
|
||||
";\tc #767676",
|
||||
">\tc #3C3C3C",
|
||||
",\tc #161616",
|
||||
"\'\tc #1C1C1C",
|
||||
")\tc #929292",
|
||||
"!\tc #585858",
|
||||
" ...... ",
|
||||
" .......... ",
|
||||
" ............ ",
|
||||
" .............. ",
|
||||
" .............. ",
|
||||
" ................ ",
|
||||
" ................ ",
|
||||
" ................ ",
|
||||
" +@@@@@@+#$$$$$$# ",
|
||||
" %@@@@@@@&&$$$$$$$* ",
|
||||
" %%@@@@@@&&&&$$$$$$** ",
|
||||
" %%%=@@@@&&&&&&$$$$-*** ",
|
||||
" %%%%@@@;&&&&&&>$$$**** ",
|
||||
"%%%%%%@@&&&&&&&&$$******",
|
||||
"%%%%%%%@&&&&&&&&$*******",
|
||||
"%%%%%%%%,&&&&&&,********",
|
||||
"%%%%%%%%\'\'\'\'\'\'\'\'********",
|
||||
"%%%%%%%%\'\'\'\'\'\'\'\'********",
|
||||
"%%%%%%%%\'\'\'\'\'\'\'\'********",
|
||||
" %%%%%%%)\'\'\'\'\'\'!******* ",
|
||||
" %%%%%%%%\'\'\'\'\'\'******** ",
|
||||
" %%%%%%%%\'\'\'\'******** ",
|
||||
" %%%%%%%%\'\'******** ",
|
||||
" %%%%%% ****** "
|
||||
};
|
||||
static Fl_Pixmap image_print_gray(idata_print_gray);
|
||||
|
||||
Fl_Button *print_output_mode[4]={(Fl_Button *)0};
|
||||
|
||||
static void cb_Save(Fl_Return_Button*, void*) {
|
||||
print_properties_panel->hide();
|
||||
|
||||
char name[1024];
|
||||
int val;
|
||||
|
||||
snprintf(name, sizeof(name), "%s/page_size", print_choice->text(print_choice->value()));
|
||||
fluid_prefs.set(name, print_page_size->value());
|
||||
|
||||
snprintf(name, sizeof(name), "%s/output_mode", print_choice->text(print_choice->value()));
|
||||
for (val = 0; val < 4; val ++) {
|
||||
if (print_output_mode[val]->value()) break;
|
||||
}
|
||||
fluid_prefs.set(name, val);
|
||||
}
|
||||
|
||||
static void cb_Cancel1(Fl_Button*, void*) {
|
||||
print_properties_panel->hide();
|
||||
print_update_status();
|
||||
}
|
||||
|
||||
Fl_Double_Window* make_print_panel() {
|
||||
Fl_Double_Window* w;
|
||||
{ Fl_Double_Window* o = print_panel = new Fl_Double_Window(465, 235, "Print");
|
||||
w = o;
|
||||
{ Fl_Group* o = print_panel_controls = new Fl_Group(10, 10, 447, 216);
|
||||
{ Fl_Choice* o = print_choice = new Fl_Choice(113, 10, 181, 25, "Printer:");
|
||||
o->down_box(FL_BORDER_BOX);
|
||||
o->labelfont(1);
|
||||
o->callback((Fl_Callback*)cb_print_choice);
|
||||
o->when(FL_WHEN_CHANGED);
|
||||
}
|
||||
{ Fl_Button* o = print_properties = new Fl_Button(294, 10, 105, 25, "Properties...");
|
||||
o->callback((Fl_Callback*)cb_print_properties);
|
||||
}
|
||||
{ Fl_Box* o = print_status = new Fl_Box(111, 41, 288, 17, "printer/job status");
|
||||
o->align(68|FL_ALIGN_INSIDE);
|
||||
}
|
||||
{ Fl_Group* o = new Fl_Group(10, 86, 227, 105, "Print Range");
|
||||
o->box(FL_THIN_DOWN_BOX);
|
||||
o->labelfont(1);
|
||||
o->align(FL_ALIGN_TOP_LEFT);
|
||||
{ Fl_Round_Button* o = print_all = new Fl_Round_Button(20, 96, 38, 25, "All");
|
||||
o->type(102);
|
||||
o->down_box(FL_ROUND_DOWN_BOX);
|
||||
o->value(1);
|
||||
o->callback((Fl_Callback*)cb_print_all);
|
||||
}
|
||||
{ Fl_Round_Button* o = print_pages = new Fl_Round_Button(20, 126, 64, 25, "Pages");
|
||||
o->type(102);
|
||||
o->down_box(FL_ROUND_DOWN_BOX);
|
||||
o->callback((Fl_Callback*)cb_print_pages);
|
||||
}
|
||||
{ Fl_Round_Button* o = print_selection = new Fl_Round_Button(20, 156, 82, 25, "Selection");
|
||||
o->type(102);
|
||||
o->down_box(FL_ROUND_DOWN_BOX);
|
||||
o->callback((Fl_Callback*)cb_print_selection);
|
||||
}
|
||||
{ Fl_Input* o = print_from = new Fl_Input(136, 126, 28, 25, "From:");
|
||||
o->type(2);
|
||||
o->textfont(4);
|
||||
o->deactivate();
|
||||
}
|
||||
{ Fl_Input* o = print_to = new Fl_Input(199, 126, 28, 25, "To:");
|
||||
o->type(2);
|
||||
o->textfont(4);
|
||||
o->deactivate();
|
||||
}
|
||||
o->end();
|
||||
}
|
||||
{ Fl_Group* o = new Fl_Group(247, 86, 210, 105, "Copies");
|
||||
o->box(FL_THIN_DOWN_BOX);
|
||||
o->labelfont(1);
|
||||
o->align(FL_ALIGN_TOP_LEFT);
|
||||
{ Fl_Spinner* o = print_copies = new Fl_Spinner(326, 96, 40, 25, "# Copies:");
|
||||
o->callback((Fl_Callback*)cb_print_copies);
|
||||
o->when(FL_WHEN_CHANGED);
|
||||
}
|
||||
{ Fl_Check_Button* o = print_collate_button = new Fl_Check_Button(376, 96, 64, 25, "Collate");
|
||||
o->down_box(FL_DOWN_BOX);
|
||||
o->callback((Fl_Callback*)cb_print_collate_button);
|
||||
o->when(FL_WHEN_CHANGED);
|
||||
o->deactivate();
|
||||
}
|
||||
{ Fl_Group* o = print_collate_group[0] = new Fl_Group(257, 131, 191, 50);
|
||||
o->deactivate();
|
||||
{ Fl_Box* o = new Fl_Box(287, 141, 30, 40, "1");
|
||||
o->box(FL_BORDER_BOX);
|
||||
o->color(FL_BACKGROUND2_COLOR);
|
||||
o->labelsize(11);
|
||||
o->align(FL_ALIGN_BOTTOM_RIGHT|FL_ALIGN_INSIDE);
|
||||
o->deactivate();
|
||||
}
|
||||
{ Fl_Box* o = new Fl_Box(272, 136, 30, 40, "1");
|
||||
o->box(FL_BORDER_BOX);
|
||||
o->color(FL_BACKGROUND2_COLOR);
|
||||
o->labelsize(11);
|
||||
o->align(FL_ALIGN_BOTTOM_RIGHT|FL_ALIGN_INSIDE);
|
||||
o->deactivate();
|
||||
}
|
||||
{ Fl_Box* o = new Fl_Box(257, 131, 30, 40, "1");
|
||||
o->box(FL_BORDER_BOX);
|
||||
o->color(FL_BACKGROUND2_COLOR);
|
||||
o->labelsize(11);
|
||||
o->align(FL_ALIGN_BOTTOM_RIGHT|FL_ALIGN_INSIDE);
|
||||
o->deactivate();
|
||||
}
|
||||
{ Fl_Box* o = new Fl_Box(352, 141, 30, 40, "2");
|
||||
o->box(FL_BORDER_BOX);
|
||||
o->color(FL_BACKGROUND2_COLOR);
|
||||
o->labelsize(11);
|
||||
o->align(FL_ALIGN_BOTTOM_RIGHT|FL_ALIGN_INSIDE);
|
||||
o->deactivate();
|
||||
}
|
||||
{ Fl_Box* o = new Fl_Box(337, 136, 30, 40, "2");
|
||||
o->box(FL_BORDER_BOX);
|
||||
o->color(FL_BACKGROUND2_COLOR);
|
||||
o->labelsize(11);
|
||||
o->align(FL_ALIGN_BOTTOM_RIGHT|FL_ALIGN_INSIDE);
|
||||
o->deactivate();
|
||||
}
|
||||
{ Fl_Box* o = new Fl_Box(322, 131, 30, 40, "2");
|
||||
o->box(FL_BORDER_BOX);
|
||||
o->color(FL_BACKGROUND2_COLOR);
|
||||
o->labelsize(11);
|
||||
o->align(FL_ALIGN_BOTTOM_RIGHT|FL_ALIGN_INSIDE);
|
||||
o->deactivate();
|
||||
}
|
||||
{ Fl_Box* o = new Fl_Box(417, 141, 30, 40, "3");
|
||||
o->box(FL_BORDER_BOX);
|
||||
o->color(FL_BACKGROUND2_COLOR);
|
||||
o->labelsize(11);
|
||||
o->align(FL_ALIGN_BOTTOM_RIGHT|FL_ALIGN_INSIDE);
|
||||
o->deactivate();
|
||||
}
|
||||
{ Fl_Box* o = new Fl_Box(402, 136, 30, 40, "3");
|
||||
o->box(FL_BORDER_BOX);
|
||||
o->color(FL_BACKGROUND2_COLOR);
|
||||
o->labelsize(11);
|
||||
o->align(FL_ALIGN_BOTTOM_RIGHT|FL_ALIGN_INSIDE);
|
||||
o->deactivate();
|
||||
}
|
||||
{ Fl_Box* o = new Fl_Box(387, 131, 30, 40, "3");
|
||||
o->box(FL_BORDER_BOX);
|
||||
o->color(FL_BACKGROUND2_COLOR);
|
||||
o->labelsize(11);
|
||||
o->align(FL_ALIGN_BOTTOM_RIGHT|FL_ALIGN_INSIDE);
|
||||
o->deactivate();
|
||||
}
|
||||
o->end();
|
||||
}
|
||||
{ Fl_Group* o = print_collate_group[1] = new Fl_Group(257, 131, 191, 50);
|
||||
o->hide();
|
||||
o->deactivate();
|
||||
{ Fl_Box* o = new Fl_Box(287, 141, 30, 40, "3");
|
||||
o->box(FL_BORDER_BOX);
|
||||
o->color(FL_BACKGROUND2_COLOR);
|
||||
o->labelsize(11);
|
||||
o->align(FL_ALIGN_BOTTOM_RIGHT|FL_ALIGN_INSIDE);
|
||||
}
|
||||
{ Fl_Box* o = new Fl_Box(272, 136, 30, 40, "2");
|
||||
o->box(FL_BORDER_BOX);
|
||||
o->color(FL_BACKGROUND2_COLOR);
|
||||
o->labelsize(11);
|
||||
o->align(FL_ALIGN_BOTTOM_RIGHT|FL_ALIGN_INSIDE);
|
||||
}
|
||||
{ Fl_Box* o = new Fl_Box(257, 131, 30, 40, "1");
|
||||
o->box(FL_BORDER_BOX);
|
||||
o->color(FL_BACKGROUND2_COLOR);
|
||||
o->labelsize(11);
|
||||
o->align(FL_ALIGN_BOTTOM_RIGHT|FL_ALIGN_INSIDE);
|
||||
}
|
||||
{ Fl_Box* o = new Fl_Box(352, 141, 30, 40, "3");
|
||||
o->box(FL_BORDER_BOX);
|
||||
o->color(FL_BACKGROUND2_COLOR);
|
||||
o->labelsize(11);
|
||||
o->align(FL_ALIGN_BOTTOM_RIGHT|FL_ALIGN_INSIDE);
|
||||
}
|
||||
{ Fl_Box* o = new Fl_Box(337, 136, 30, 40, "2");
|
||||
o->box(FL_BORDER_BOX);
|
||||
o->color(FL_BACKGROUND2_COLOR);
|
||||
o->labelsize(11);
|
||||
o->align(FL_ALIGN_BOTTOM_RIGHT|FL_ALIGN_INSIDE);
|
||||
}
|
||||
{ Fl_Box* o = new Fl_Box(322, 131, 30, 40, "1");
|
||||
o->box(FL_BORDER_BOX);
|
||||
o->color(FL_BACKGROUND2_COLOR);
|
||||
o->labelsize(11);
|
||||
o->align(FL_ALIGN_BOTTOM_RIGHT|FL_ALIGN_INSIDE);
|
||||
}
|
||||
{ Fl_Box* o = new Fl_Box(417, 141, 30, 40, "3");
|
||||
o->box(FL_BORDER_BOX);
|
||||
o->color(FL_BACKGROUND2_COLOR);
|
||||
o->labelsize(11);
|
||||
o->align(FL_ALIGN_BOTTOM_RIGHT|FL_ALIGN_INSIDE);
|
||||
}
|
||||
{ Fl_Box* o = new Fl_Box(402, 136, 30, 40, "2");
|
||||
o->box(FL_BORDER_BOX);
|
||||
o->color(FL_BACKGROUND2_COLOR);
|
||||
o->labelsize(11);
|
||||
o->align(FL_ALIGN_BOTTOM_RIGHT|FL_ALIGN_INSIDE);
|
||||
}
|
||||
{ Fl_Box* o = new Fl_Box(387, 131, 30, 40, "1");
|
||||
o->box(FL_BORDER_BOX);
|
||||
o->color(FL_BACKGROUND2_COLOR);
|
||||
o->labelsize(11);
|
||||
o->align(FL_ALIGN_BOTTOM_RIGHT|FL_ALIGN_INSIDE);
|
||||
}
|
||||
o->end();
|
||||
}
|
||||
o->end();
|
||||
}
|
||||
{ Fl_Return_Button* o = new Fl_Return_Button(309, 201, 70, 25, "Print");
|
||||
o->callback((Fl_Callback*)print_cb);
|
||||
}
|
||||
{ Fl_Button* o = new Fl_Button(389, 201, 68, 25, "Cancel");
|
||||
o->callback((Fl_Callback*)cb_Cancel);
|
||||
}
|
||||
o->end();
|
||||
}
|
||||
{ Fl_Progress* o = print_progress = new Fl_Progress(10, 203, 289, 21);
|
||||
o->selection_color((Fl_Color)4);
|
||||
o->hide();
|
||||
}
|
||||
o->set_modal();
|
||||
o->end();
|
||||
}
|
||||
{ Fl_Double_Window* o = print_properties_panel = new Fl_Double_Window(290, 130, "Printer Properties");
|
||||
w = o;
|
||||
o->callback((Fl_Callback*)cb_print_properties_panel);
|
||||
{ Fl_Choice* o = print_page_size = new Fl_Choice(110, 10, 80, 25, "Page Size:");
|
||||
o->down_box(FL_BORDER_BOX);
|
||||
o->labelfont(1);
|
||||
o->menu(menu_print_page_size);
|
||||
}
|
||||
{ Fl_Group* o = new Fl_Group(110, 45, 170, 40, "Output Mode:");
|
||||
o->labelfont(1);
|
||||
o->align(FL_ALIGN_LEFT);
|
||||
{ Fl_Button* o = print_output_mode[0] = new Fl_Button(110, 45, 30, 40);
|
||||
o->type(102);
|
||||
o->box(FL_BORDER_BOX);
|
||||
o->down_box(FL_BORDER_BOX);
|
||||
o->value(1);
|
||||
o->color(FL_BACKGROUND2_COLOR);
|
||||
o->selection_color(FL_FOREGROUND_COLOR);
|
||||
o->image(image_print_color);
|
||||
}
|
||||
{ Fl_Button* o = print_output_mode[1] = new Fl_Button(200, 45, 30, 40);
|
||||
o->type(102);
|
||||
o->box(FL_BORDER_BOX);
|
||||
o->down_box(FL_BORDER_BOX);
|
||||
o->color(FL_BACKGROUND2_COLOR);
|
||||
o->selection_color(FL_FOREGROUND_COLOR);
|
||||
o->image(image_print_gray);
|
||||
}
|
||||
{ Fl_Button* o = print_output_mode[2] = new Fl_Button(150, 50, 40, 30);
|
||||
o->type(102);
|
||||
o->box(FL_BORDER_BOX);
|
||||
o->down_box(FL_BORDER_BOX);
|
||||
o->color(FL_BACKGROUND2_COLOR);
|
||||
o->selection_color(FL_FOREGROUND_COLOR);
|
||||
o->image(image_print_color);
|
||||
}
|
||||
{ Fl_Button* o = print_output_mode[3] = new Fl_Button(240, 50, 40, 30);
|
||||
o->type(102);
|
||||
o->box(FL_BORDER_BOX);
|
||||
o->down_box(FL_BORDER_BOX);
|
||||
o->color(FL_BACKGROUND2_COLOR);
|
||||
o->selection_color(FL_FOREGROUND_COLOR);
|
||||
o->image(image_print_gray);
|
||||
}
|
||||
o->end();
|
||||
}
|
||||
{ Fl_Return_Button* o = new Fl_Return_Button(123, 95, 79, 25, "Save");
|
||||
o->callback((Fl_Callback*)cb_Save);
|
||||
}
|
||||
{ Fl_Button* o = new Fl_Button(212, 95, 68, 25, "Cancel");
|
||||
o->callback((Fl_Callback*)cb_Cancel1);
|
||||
}
|
||||
o->set_modal();
|
||||
o->end();
|
||||
}
|
||||
return w;
|
||||
}
|
||||
void print_cb(Fl_Return_Button *, void *);
|
||||
|
||||
void print_load() {
|
||||
FILE *lpstat;
|
||||
char line[1024], name[1024], defname[1024];
|
||||
int i;
|
||||
|
||||
print_choice->clear();
|
||||
print_choice->add("Print To File", 0, 0, 0, FL_MENU_DIVIDER);
|
||||
print_choice->value(0);
|
||||
|
||||
print_properties->deactivate();
|
||||
|
||||
defname[0] = '\0';
|
||||
|
||||
if ((lpstat = popen("lpstat -p -d", "r")) != NULL) {
|
||||
while (fgets(line, sizeof(line), lpstat)) {
|
||||
if (!strncmp(line, "printer ", 8) &&
|
||||
sscanf(line + 8, "%s", name) == 1) {
|
||||
print_choice->add(name, 0, 0, (void *)name, 0);
|
||||
} else if (!strncmp(line, "system default destination: ", 28)) {
|
||||
if (sscanf(line + 28, "%s", defname) != 1) defname[0] = '\0';
|
||||
}
|
||||
}
|
||||
pclose(lpstat);
|
||||
}
|
||||
|
||||
if (defname[0]) {
|
||||
for (i = 1; print_choice->text(i); i ++) {
|
||||
if (!strcmp(print_choice->text(i), defname)) {
|
||||
print_choice->value(i);
|
||||
print_properties->activate();
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if (print_choice->size() > 2) {
|
||||
print_choice->value(1);
|
||||
print_properties->activate();
|
||||
}
|
||||
|
||||
|
||||
print_update_status();
|
||||
}
|
||||
|
||||
void print_update_status() {
|
||||
FILE *lpstat;
|
||||
char command[1024];
|
||||
static char status[1024];
|
||||
|
||||
if (print_choice->value()) {
|
||||
snprintf(command, sizeof(command), "lpstat -p '%s'",
|
||||
print_choice->text(print_choice->value()));
|
||||
if ((lpstat = popen(command, "r")) != NULL) {
|
||||
fgets(status, sizeof(status), lpstat);
|
||||
pclose(lpstat);
|
||||
} else strcpy(status, "printer status unavailable");
|
||||
} else status[0] = '\0';
|
||||
|
||||
print_status->label(status);
|
||||
|
||||
char name[1024];
|
||||
int val;
|
||||
|
||||
snprintf(name, sizeof(name), "%s/page_size", print_choice->text(print_choice->value()));
|
||||
fluid_prefs.get(name, val, 0);
|
||||
print_page_size->value(val);
|
||||
|
||||
snprintf(name, sizeof(name), "%s/output_mode", print_choice->text(print_choice->value()));
|
||||
fluid_prefs.get(name, val, 0);
|
||||
print_output_mode[val]->setonly();
|
||||
}
|
||||
|
||||
//
|
||||
// End of "$Id$".
|
||||
//
|
359
fluid/print_panel.fl
Normal file
359
fluid/print_panel.fl
Normal file
@ -0,0 +1,359 @@
|
||||
# data file for the Fltk User Interface Designer (fluid)
|
||||
version 1.0107
|
||||
header_name {.h}
|
||||
code_name {.cxx}
|
||||
comment {//
|
||||
// "$Id$"
|
||||
//
|
||||
// FLUID print panel for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
// Copyright 1998-2005 by Bill Spitzak and others.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Library General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2 of the License, or (at your option) any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Library General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Library General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
// USA.
|
||||
//
|
||||
// Please report all bugs and problems on the following page:
|
||||
//
|
||||
// http://www.fltk.org/str.php
|
||||
//
|
||||
} {in_source in_header
|
||||
}
|
||||
|
||||
decl {\#include <stdio.h>} {}
|
||||
|
||||
decl {\#include <stdlib.h>} {}
|
||||
|
||||
decl {\#include "../src/flstring.h"} {}
|
||||
|
||||
decl {\#include <FL/Fl_Preferences.H>} {}
|
||||
|
||||
decl {extern Fl_Preferences fluid_prefs;} {}
|
||||
|
||||
Function {make_print_panel()} {open
|
||||
} {
|
||||
Fl_Window print_panel {
|
||||
label Print open
|
||||
xywh {342 21 465 235} type Double modal visible
|
||||
} {
|
||||
Fl_Group print_panel_controls {open
|
||||
xywh {10 10 447 216}
|
||||
} {
|
||||
Fl_Choice print_choice {
|
||||
label {Printer:}
|
||||
callback {print_update_status();} open selected
|
||||
xywh {113 10 181 25} down_box BORDER_BOX labelfont 1 when 1
|
||||
} {}
|
||||
Fl_Button print_properties {
|
||||
label {Properties...}
|
||||
callback {print_properties_panel->show();}
|
||||
xywh {294 10 105 25}
|
||||
}
|
||||
Fl_Box print_status {
|
||||
label {printer/job status}
|
||||
xywh {111 41 288 17} align 84
|
||||
}
|
||||
Fl_Group {} {
|
||||
label {Print Range} open
|
||||
xywh {10 86 227 105} box THIN_DOWN_BOX labelfont 1 align 5
|
||||
} {
|
||||
Fl_Round_Button print_all {
|
||||
label All
|
||||
callback {print_from->deactivate();
|
||||
print_to->deactivate();}
|
||||
xywh {20 96 38 25} type Radio down_box ROUND_DOWN_BOX value 1
|
||||
}
|
||||
Fl_Round_Button print_pages {
|
||||
label Pages
|
||||
callback {print_from->activate();
|
||||
print_to->activate();}
|
||||
xywh {20 126 64 25} type Radio down_box ROUND_DOWN_BOX
|
||||
}
|
||||
Fl_Round_Button print_selection {
|
||||
label Selection
|
||||
callback {print_from->deactivate();
|
||||
print_to->deactivate();}
|
||||
xywh {20 156 82 25} type Radio down_box ROUND_DOWN_BOX
|
||||
}
|
||||
Fl_Input print_from {
|
||||
label {From:}
|
||||
xywh {136 126 28 25} type Int textfont 4 deactivate
|
||||
}
|
||||
Fl_Input print_to {
|
||||
label {To:}
|
||||
xywh {199 126 28 25} type Int textfont 4 deactivate
|
||||
}
|
||||
}
|
||||
Fl_Group {} {
|
||||
label Copies open
|
||||
xywh {247 86 210 105} box THIN_DOWN_BOX labelfont 1 align 5
|
||||
} {
|
||||
Fl_Spinner print_copies {
|
||||
label {\# Copies:}
|
||||
callback {if (print_copies->value() == 1) {
|
||||
print_collate_button->deactivate();
|
||||
print_collate_group[0]->deactivate();
|
||||
print_collate_group[1]->deactivate();
|
||||
} else {
|
||||
print_collate_button->activate();
|
||||
print_collate_group[0]->activate();
|
||||
print_collate_group[1]->activate();
|
||||
}}
|
||||
xywh {326 96 40 25} when 1
|
||||
}
|
||||
Fl_Check_Button print_collate_button {
|
||||
label Collate
|
||||
callback {int i = print_collate_button->value() != 0;
|
||||
print_collate_group[i]->show();
|
||||
print_collate_group[1 - i]->hide();}
|
||||
xywh {376 96 64 25} down_box DOWN_BOX when 1 deactivate
|
||||
}
|
||||
Fl_Group {print_collate_group[0]} {
|
||||
xywh {257 131 191 50} deactivate
|
||||
} {
|
||||
Fl_Box {} {
|
||||
label 1
|
||||
xywh {287 141 30 40} box BORDER_BOX color 7 labelsize 11 align 26 deactivate
|
||||
}
|
||||
Fl_Box {} {
|
||||
label 1
|
||||
xywh {272 136 30 40} box BORDER_BOX color 7 labelsize 11 align 26 deactivate
|
||||
}
|
||||
Fl_Box {} {
|
||||
label 1
|
||||
xywh {257 131 30 40} box BORDER_BOX color 7 labelsize 11 align 26 deactivate
|
||||
}
|
||||
Fl_Box {} {
|
||||
label 2
|
||||
xywh {352 141 30 40} box BORDER_BOX color 7 labelsize 11 align 26 deactivate
|
||||
}
|
||||
Fl_Box {} {
|
||||
label 2
|
||||
xywh {337 136 30 40} box BORDER_BOX color 7 labelsize 11 align 26 deactivate
|
||||
}
|
||||
Fl_Box {} {
|
||||
label 2
|
||||
xywh {322 131 30 40} box BORDER_BOX color 7 labelsize 11 align 26 deactivate
|
||||
}
|
||||
Fl_Box {} {
|
||||
label 3
|
||||
xywh {417 141 30 40} box BORDER_BOX color 7 labelsize 11 align 26 deactivate
|
||||
}
|
||||
Fl_Box {} {
|
||||
label 3
|
||||
xywh {402 136 30 40} box BORDER_BOX color 7 labelsize 11 align 26 deactivate
|
||||
}
|
||||
Fl_Box {} {
|
||||
label 3
|
||||
xywh {387 131 30 40} box BORDER_BOX color 7 labelsize 11 align 26 deactivate
|
||||
}
|
||||
}
|
||||
Fl_Group {print_collate_group[1]} {
|
||||
xywh {257 131 191 50} hide deactivate
|
||||
} {
|
||||
Fl_Box {} {
|
||||
label 3
|
||||
xywh {287 141 30 40} box BORDER_BOX color 7 labelsize 11 align 26
|
||||
}
|
||||
Fl_Box {} {
|
||||
label 2
|
||||
xywh {272 136 30 40} box BORDER_BOX color 7 labelsize 11 align 26
|
||||
}
|
||||
Fl_Box {} {
|
||||
label 1
|
||||
xywh {257 131 30 40} box BORDER_BOX color 7 labelsize 11 align 26
|
||||
}
|
||||
Fl_Box {} {
|
||||
label 3
|
||||
xywh {352 141 30 40} box BORDER_BOX color 7 labelsize 11 align 26
|
||||
}
|
||||
Fl_Box {} {
|
||||
label 2
|
||||
xywh {337 136 30 40} box BORDER_BOX color 7 labelsize 11 align 26
|
||||
}
|
||||
Fl_Box {} {
|
||||
label 1
|
||||
xywh {322 131 30 40} box BORDER_BOX color 7 labelsize 11 align 26
|
||||
}
|
||||
Fl_Box {} {
|
||||
label 3
|
||||
xywh {417 141 30 40} box BORDER_BOX color 7 labelsize 11 align 26
|
||||
}
|
||||
Fl_Box {} {
|
||||
label 2
|
||||
xywh {402 136 30 40} box BORDER_BOX color 7 labelsize 11 align 26
|
||||
}
|
||||
Fl_Box {} {
|
||||
label 1
|
||||
xywh {387 131 30 40} box BORDER_BOX color 7 labelsize 11 align 26
|
||||
}
|
||||
}
|
||||
}
|
||||
Fl_Return_Button {} {
|
||||
label Print
|
||||
callback print_cb
|
||||
xywh {309 201 70 25}
|
||||
}
|
||||
Fl_Button {} {
|
||||
label Cancel
|
||||
callback {print_panel->hide();}
|
||||
xywh {389 201 68 25}
|
||||
}
|
||||
}
|
||||
Fl_Progress print_progress {
|
||||
xywh {10 203 289 21} selection_color 4 hide
|
||||
}
|
||||
}
|
||||
Fl_Window print_properties_panel {
|
||||
label {Printer Properties}
|
||||
callback {print_properties_panel->hide();
|
||||
print_update_status();} open
|
||||
xywh {340 213 290 130} type Double modal visible
|
||||
} {
|
||||
Fl_Choice print_page_size {
|
||||
label {Page Size:}
|
||||
xywh {110 10 80 25} down_box BORDER_BOX labelfont 1
|
||||
} {
|
||||
MenuItem {} {
|
||||
label Letter
|
||||
xywh {0 0 35 25}
|
||||
}
|
||||
MenuItem {} {
|
||||
label A4
|
||||
xywh {0 0 35 25}
|
||||
}
|
||||
}
|
||||
Fl_Group {} {
|
||||
label {Output Mode:} open
|
||||
xywh {110 45 170 40} labelfont 1 align 4
|
||||
} {
|
||||
Fl_Button {print_output_mode[0]} {
|
||||
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
|
||||
}
|
||||
Fl_Button {print_output_mode[1]} {
|
||||
image {pixmaps/print_gray.xpm} xywh {200 45 30 40} type Radio box BORDER_BOX down_box BORDER_BOX color 7 selection_color 0
|
||||
}
|
||||
Fl_Button {print_output_mode[2]} {
|
||||
image {pixmaps/print_color.xpm} xywh {150 50 40 30} type Radio box BORDER_BOX down_box BORDER_BOX color 7 selection_color 0
|
||||
}
|
||||
Fl_Button {print_output_mode[3]} {
|
||||
image {pixmaps/print_gray.xpm} xywh {240 50 40 30} type Radio box BORDER_BOX down_box BORDER_BOX color 7 selection_color 0
|
||||
}
|
||||
}
|
||||
Fl_Return_Button {} {
|
||||
label Save
|
||||
callback {print_properties_panel->hide();
|
||||
|
||||
char name[1024];
|
||||
int val;
|
||||
|
||||
snprintf(name, sizeof(name), "%s/page_size", print_choice->text(print_choice->value()));
|
||||
fluid_prefs.set(name, print_page_size->value());
|
||||
|
||||
snprintf(name, sizeof(name), "%s/output_mode", print_choice->text(print_choice->value()));
|
||||
for (val = 0; val < 4; val ++) {
|
||||
if (print_output_mode[val]->value()) break;
|
||||
}
|
||||
fluid_prefs.set(name, val);}
|
||||
xywh {123 95 79 25}
|
||||
}
|
||||
Fl_Button {} {
|
||||
label Cancel
|
||||
callback {print_properties_panel->hide();
|
||||
print_update_status();}
|
||||
xywh {212 95 68 25}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
decl {void print_cb(Fl_Return_Button *, void *);} {public
|
||||
}
|
||||
|
||||
Function {print_load()} {return_type void
|
||||
} {
|
||||
code {FILE *lpstat;
|
||||
char line[1024], name[1024], defname[1024];
|
||||
int i;
|
||||
|
||||
print_choice->clear();
|
||||
print_choice->add("Print To File", 0, 0, 0, FL_MENU_DIVIDER);
|
||||
print_choice->value(0);
|
||||
|
||||
print_properties->deactivate();
|
||||
|
||||
defname[0] = '\\0';
|
||||
|
||||
if ((lpstat = popen("lpstat -p -d", "r")) != NULL) {
|
||||
while (fgets(line, sizeof(line), lpstat)) {
|
||||
if (!strncmp(line, "printer ", 8) &&
|
||||
sscanf(line + 8, "%s", name) == 1) {
|
||||
print_choice->add(name, 0, 0, (void *)name, 0);
|
||||
} else if (!strncmp(line, "system default destination: ", 28)) {
|
||||
if (sscanf(line + 28, "%s", defname) != 1) defname[0] = '\\0';
|
||||
}
|
||||
}
|
||||
pclose(lpstat);
|
||||
}
|
||||
|
||||
if (defname[0]) {
|
||||
for (i = 1; print_choice->text(i); i ++) {
|
||||
if (!strcmp(print_choice->text(i), defname)) {
|
||||
print_choice->value(i);
|
||||
print_properties->activate();
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if (print_choice->size() > 2) {
|
||||
print_choice->value(1);
|
||||
print_properties->activate();
|
||||
}
|
||||
|
||||
|
||||
print_update_status();} {}
|
||||
}
|
||||
|
||||
Function {print_update_status()} {open return_type void
|
||||
} {
|
||||
code {FILE *lpstat;
|
||||
char command[1024];
|
||||
static char status[1024];
|
||||
|
||||
if (print_choice->value()) {
|
||||
snprintf(command, sizeof(command), "lpstat -p '%s'",
|
||||
print_choice->text(print_choice->value()));
|
||||
if ((lpstat = popen(command, "r")) != NULL) {
|
||||
fgets(status, sizeof(status), lpstat);
|
||||
pclose(lpstat);
|
||||
} else strcpy(status, "printer status unavailable");
|
||||
} else status[0] = '\\0';
|
||||
|
||||
print_status->label(status);
|
||||
|
||||
char name[1024];
|
||||
int val;
|
||||
|
||||
snprintf(name, sizeof(name), "%s/page_size", print_choice->text(print_choice->value()));
|
||||
fluid_prefs.get(name, val, 0);
|
||||
print_page_size->value(val);
|
||||
|
||||
snprintf(name, sizeof(name), "%s/output_mode", print_choice->text(print_choice->value()));
|
||||
fluid_prefs.get(name, val, 0);
|
||||
print_output_mode[val]->setonly();} {}
|
||||
}
|
||||
|
||||
comment {
|
||||
//
|
||||
// End of "$Id$".
|
||||
//} {in_source in_header
|
||||
}
|
71
fluid/print_panel.h
Normal file
71
fluid/print_panel.h
Normal file
@ -0,0 +1,71 @@
|
||||
//
|
||||
// "$Id$"
|
||||
//
|
||||
// FLUID print panel for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
// Copyright 1998-2005 by Bill Spitzak and others.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Library General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2 of the License, or (at your option) any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Library General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Library General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
// USA.
|
||||
//
|
||||
// Please report all bugs and problems on the following page:
|
||||
//
|
||||
// http://www.fltk.org/str.php
|
||||
//
|
||||
|
||||
// generated by Fast Light User Interface Designer (fluid) version 1.0107
|
||||
|
||||
#ifndef print_panel_h
|
||||
#define print_panel_h
|
||||
#include <FL/Fl.H>
|
||||
#include <FL/Fl_Double_Window.H>
|
||||
extern Fl_Double_Window *print_panel;
|
||||
#include <FL/Fl_Group.H>
|
||||
extern Fl_Group *print_panel_controls;
|
||||
#include <FL/Fl_Choice.H>
|
||||
extern Fl_Choice *print_choice;
|
||||
#include <FL/Fl_Button.H>
|
||||
extern Fl_Button *print_properties;
|
||||
#include <FL/Fl_Box.H>
|
||||
extern Fl_Box *print_status;
|
||||
#include <FL/Fl_Round_Button.H>
|
||||
extern Fl_Round_Button *print_all;
|
||||
extern Fl_Round_Button *print_pages;
|
||||
extern Fl_Round_Button *print_selection;
|
||||
#include <FL/Fl_Input.H>
|
||||
extern Fl_Input *print_from;
|
||||
extern Fl_Input *print_to;
|
||||
#include <FL/Fl_Spinner.H>
|
||||
extern Fl_Spinner *print_copies;
|
||||
#include <FL/Fl_Check_Button.H>
|
||||
extern Fl_Check_Button *print_collate_button;
|
||||
extern Fl_Group *print_collate_group[2];
|
||||
#include <FL/Fl_Return_Button.H>
|
||||
extern void print_cb(Fl_Return_Button*, void*);
|
||||
#include <FL/Fl_Progress.H>
|
||||
extern Fl_Progress *print_progress;
|
||||
extern Fl_Double_Window *print_properties_panel;
|
||||
extern Fl_Choice *print_page_size;
|
||||
extern Fl_Button *print_output_mode[4];
|
||||
Fl_Double_Window* make_print_panel();
|
||||
extern Fl_Menu_Item menu_print_page_size[];
|
||||
extern void print_cb(Fl_Return_Button *, void *);
|
||||
void print_load();
|
||||
void print_update_status();
|
||||
#endif
|
||||
|
||||
//
|
||||
// End of "$Id$".
|
||||
//
|
@ -106,7 +106,8 @@ void fl_thin_down_frame(int x, int y, int w, int h, Fl_Color) {
|
||||
|
||||
void fl_thin_down_box(int x, int y, int w, int h, Fl_Color c) {
|
||||
fl_thin_down_frame(x,y,w,h,c);
|
||||
fl_color(c); fl_rectf(x+1, y+1, w-2, h-2);
|
||||
fl_color(draw_it_active ? c : fl_inactive(c));
|
||||
fl_rectf(x+1, y+1, w-2, h-2);
|
||||
}
|
||||
|
||||
void fl_thin_up_frame(int x, int y, int w, int h, Fl_Color) {
|
||||
@ -115,7 +116,8 @@ void fl_thin_up_frame(int x, int y, int w, int h, Fl_Color) {
|
||||
|
||||
void fl_thin_up_box(int x, int y, int w, int h, Fl_Color c) {
|
||||
fl_thin_up_frame(x,y,w,h,c);
|
||||
fl_color(c); fl_rectf(x+1, y+1, w-2, h-2);
|
||||
fl_color(draw_it_active ? c : fl_inactive(c));
|
||||
fl_rectf(x+1, y+1, w-2, h-2);
|
||||
}
|
||||
|
||||
void fl_up_frame(int x, int y, int w, int h, Fl_Color) {
|
||||
@ -135,7 +137,8 @@ void fl_up_frame(int x, int y, int w, int h, Fl_Color) {
|
||||
|
||||
void fl_up_box(int x, int y, int w, int h, Fl_Color c) {
|
||||
fl_up_frame(x,y,w,h,c);
|
||||
fl_color(c); fl_rectf(x+D1, y+D1, w-D2, h-D2);
|
||||
fl_color(draw_it_active ? c : fl_inactive(c));
|
||||
fl_rectf(x+D1, y+D1, w-D2, h-D2);
|
||||
}
|
||||
|
||||
void fl_down_frame(int x, int y, int w, int h, Fl_Color) {
|
||||
@ -161,7 +164,8 @@ void fl_engraved_frame(int x, int y, int w, int h, Fl_Color) {
|
||||
|
||||
void fl_engraved_box(int x, int y, int w, int h, Fl_Color c) {
|
||||
fl_engraved_frame(x,y,w,h,c);
|
||||
fl_color(c); fl_rectf(x+2, y+2, w-4, h-4);
|
||||
fl_color(draw_it_active ? c : fl_inactive(c));
|
||||
fl_rectf(x+2, y+2, w-4, h-4);
|
||||
}
|
||||
|
||||
void fl_embossed_frame(int x, int y, int w, int h, Fl_Color) {
|
||||
@ -170,17 +174,20 @@ void fl_embossed_frame(int x, int y, int w, int h, Fl_Color) {
|
||||
|
||||
void fl_embossed_box(int x, int y, int w, int h, Fl_Color c) {
|
||||
fl_embossed_frame(x,y,w,h,c);
|
||||
fl_color(c); fl_rectf(x+2, y+2, w-4, h-4);
|
||||
fl_color(draw_it_active ? c : fl_inactive(c));
|
||||
fl_rectf(x+2, y+2, w-4, h-4);
|
||||
}
|
||||
|
||||
void fl_rectbound(int x, int y, int w, int h, Fl_Color bgcolor) {
|
||||
fl_color(FL_BLACK); fl_rect(x, y, w, h);
|
||||
fl_color(bgcolor); fl_rectf(x+1, y+1, w-2, h-2);
|
||||
fl_color(draw_it_active ? FL_BLACK : fl_inactive(FL_BLACK));
|
||||
fl_rect(x, y, w, h);
|
||||
fl_color(draw_it_active ? bgcolor : fl_inactive(bgcolor));
|
||||
fl_rectf(x+1, y+1, w-2, h-2);
|
||||
}
|
||||
#define fl_border_box fl_rectbound
|
||||
|
||||
void fl_border_frame(int x, int y, int w, int h, Fl_Color c) {
|
||||
fl_color(c);
|
||||
fl_color(draw_it_active ? c : fl_inactive(c));
|
||||
fl_rect(x, y, w, h);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user