1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-25 01:02:24 +00:00

Unix can't sensibly enumerate printers (since they're defined as

being lpr commands), so the Unix config box now replaces the printer
combo box with an ordinary edit box.

[originally from svn r3063]
This commit is contained in:
Simon Tatham 2003-04-05 16:12:52 +00:00
parent 30497ff683
commit 09c9f31289
5 changed files with 34 additions and 22 deletions

View File

@ -133,12 +133,18 @@ static void printerbox_handler(union control *ctrl, void *dlg,
printer_enum *pe;
dlg_update_start(ctrl, dlg);
dlg_listbox_clear(ctrl, dlg);
dlg_listbox_add(ctrl, dlg, PRINTER_DISABLED_STRING);
pe = printer_start_enum(&nprinters);
for (i = 0; i < nprinters; i++)
dlg_listbox_add(ctrl, dlg, printer_get_name(pe, i));
printer_finish_enum(pe);
/*
* Some backends may wish to disable the drop-down list on
* this edit box. Be prepared for this.
*/
if (ctrl->editbox.has_list) {
dlg_listbox_clear(ctrl, dlg);
dlg_listbox_add(ctrl, dlg, PRINTER_DISABLED_STRING);
pe = printer_start_enum(&nprinters);
for (i = 0; i < nprinters; i++)
dlg_listbox_add(ctrl, dlg, printer_get_name(pe, i));
printer_finish_enum(pe);
}
dlg_editbox_set(ctrl, dlg,
(*cfg->printer ? cfg->printer :
PRINTER_DISABLED_STRING));

View File

@ -30,14 +30,6 @@ int decode_codepage(char *cp_name)
return -2;
}
printer_enum *printer_start_enum(int *nprinters_ptr) {
*nprinters_ptr = 0;
return NULL;
}
char *printer_get_name(printer_enum *pe, int i) { return NULL;
}
void printer_finish_enum(printer_enum *pe) { }
Backend *select_backend(Config *cfg)
{
return &pty_backend;

View File

@ -42,6 +42,14 @@ void unix_setup_config_box(struct controlbox *b, int midsession)
* when these elements would be useful to configure.
*/
/*
* On Unix, we don't have a drop-down list for the printer
* control.
*/
s = ctrl_getset(b, "Terminal", "printing", "Remote-controlled printing");
assert(s->ncontrols == 1 && s->ctrls[0]->generic.type == CTRL_EDITBOX);
s->ctrls[0]->editbox.has_list = 0;
/*
* GTK makes it rather easier to put the scrollbar on the left
* than Windows does!

View File

@ -41,3 +41,17 @@ void printer_finish_job(printer_job *pj)
pclose(pj->fp);
sfree(pj);
}
/*
* There's no sensible way to enumerate printers under Unix, since
* practically any valid Unix command is a valid printer :-) So
* these are useless stub functions, and uxcfg.c will disable the
* drop-down list in the printer configurer.
*/
printer_enum *printer_start_enum(int *nprinters_ptr) {
*nprinters_ptr = 0;
return NULL;
}
char *printer_get_name(printer_enum *pe, int i) { return NULL;
}
void printer_finish_enum(printer_enum *pe) { }

View File

@ -94,14 +94,6 @@ int decode_codepage(char *cp_name)
return -2;
}
printer_enum *printer_start_enum(int *nprinters_ptr) {
*nprinters_ptr = 0;
return NULL;
}
char *printer_get_name(printer_enum *pe, int i) { return NULL;
}
void printer_finish_enum(printer_enum *pe) { }
const char *const appname = "PuTTY";
Backend *select_backend(Config *cfg)