Hi!
I send for you patch for print support (it contains small fix relatively has
previously). But have problem with a2ps + utf-8, details in source
Apart patch I attach *.c *.h files, which contains in patch.
If need correct it, please write me.
--
good luck!
Vadim Likhota [EMAIL PROTECTED]
patch-mc-4.6.1-prn
Description: Binary data
#ifndef __MC_DLG_PRN_H
#define __MC_DLG_PRN_H
#ifdef HAVE_PRINT
#define PRINTCAP /etc/printcap
int show_print_dlg (void);
void print_file (const char *fname);
#endif /* HAVE_PRINT */
#endif /* __MC_DLG_PRN_H */
/* Print dialog module for the Midnight Commander
Copyright (C) 2005 Likhota Vadim [EMAIL PROTECTED]
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/*
2005 09 small fix add a2ps
2005 06 orig
*/
#include config.h
#ifdef HAVE_PRINT
#include stdio.h
#include errno.h
#include global.h
#include tty.h
#include execute.h
#include color.h
#include widget.h
#include wtools.h
#ifdef HAVE_CHARSET
#include charsets.h
#endif
#include dlg_prn.h
#define TEMP_BUF_LEN 1024
#define DLG_PRN_H 11
#define DLG_PRN_W 72
static char printer[32] = N_(default printer);
static char codepgf[32] = N_(default charset);
static char codepgt[32] = N_(default charset);
static int nprinter = 0, ncodepgf = 0, ncodepgt = 0;
static int sel_pln = 1, sel_prn = 0, sel_enc = 0;
static WCheck *check_pln, *check_prn, *check_enc;
static WButton *but_prn, *but_en1, *but_en2;
static void
prn_enter (Dlg_head * h, const int f_pos)
{
Dlg_head *chl_dlg = 0;
WListbox *chl_list;
int prnbox = ( f_pos == 2 ? 1 : 0 ); // 1 - printers, 0 - charsets
int lxx = (COLS - DLG_PRN_W) / 2 + (f_pos == 7 ? 50 : 25);
int lyy = (LINES - DLG_PRN_H) / 2 + (prnbox ? 0 : 2 );
char *title = ( prnbox ? _(printers) : _(charsets) );
if ( !(chl_dlg = create_dlg (lyy, lxx, 9, 20, dialog_colors, NULL,
[print option], title, DLG_COMPACT))) {
message (1, MSG_ERROR, Can't create child window.);
return;
}
if ( !(chl_list = listbox_new (1, 1, 18, 7, NULL))) {
message (1, MSG_ERROR, Can't create child lisbox.);
destroy_dlg (chl_dlg);
return;
}
listbox_add_item (chl_list, 0, 0,
(prnbox ? N_(default printer) : N_(default charset)), NULL);
// read printcap file
if ( prnbox ) {
char *p = PRINTCAP;
char buf[TEMP_BUF_LEN], *bufi;
FILE *f;
f = (FILE *) fopen (p, r);
if (f) {
while ( fgets(buf, TEMP_BUF_LEN - 1, f) ) {
int prflag = 0;
if (*buf != '#') {
bufi = buf;
while ( *bufi != '\0' and (*bufi = '0' and *bufi = '9' or
*bufi = 'A' and *bufi = 'Z' or *bufi = 'a' and *bufi = 'z' or
*bufi == '|' or *bufi == '_') {
if ( *bufi == '|' ) {
*bufi = '\0';
prflag = 1;
break;
}
else
bufi++;
}
if ( prflag ) {
listbox_add_item (chl_list, 0, 0, buf, NULL);
prflag = 0;
}
}
}
if (fclose (f) 0)
message (1, MSG_ERROR, Error while close file: %s., p);
} else {
message (1, MSG_ERROR, Can't open file for reading: %s., p);
destroy_dlg (chl_dlg);
return;
}
}
#ifdef HAVE_CHARSET
else {
int i = 0;
for ( ; i n_codepages; i++)
listbox_add_item (chl_list, 0, 0, codepages[i].name, NULL);
}
#endif
add_widget (chl_dlg, chl_list);
run_dlg (chl_dlg);
switch (f_pos) {
case 2:
strncpy(printer, chl_list-current-text, 32);
strncpy(but_prn-text, printer, 32);
nprinter = chl_list-pos;
break;
case 5:
strncpy(codepgf, chl_list-current-text, 32);
strncpy(but_en1-text, codepgf, 32);
ncodepgf = chl_list-pos;
break;
case 7:
strncpy(codepgt, chl_list-current-text, 32);
strncpy(but_en2-text, codepgt, 32);
ncodepgt = chl_list-pos;
break;
}
destroy_dlg (chl_dlg);
}
static cb_ret_t
print_block_callback (struct Dlg_head *h, dlg_msg_t Msg, int Par)
{
int f_pos = h-current-dlg_id;
if (Msg == DLG_KEY) {
switch (Par) {
case '\n':
if ( f_pos 8 ) {
switch (f_pos) {
case 2:
if ( check_prn-state )
prn_enter (h, f_pos);
break;
case 7:
if ( !strcmp(but_en1-text, N_(default charset)) )
break;
case 5:
if ( check_enc-state )
prn_enter (h, f_pos);
break;
}
return MSG_HANDLED;
}
break;
}
} else
return default_dlg_callback (h, Msg, Par);
return MSG_NOT_HANDLED;
}
/*