mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-03-22 14:39:24 -05:00
Fixed the printing and charset combo boxes in Unix PuTTY. (The
former by simply removing it; the latter by adding an enumeration function to libcharset.) This has had slight `const' repercussions on cp_name() and cp_enumerate() which might break the Mac build. [originally from svn r3064]
This commit is contained in:
parent
09c9f31289
commit
cf08c5a64a
2
Recipe
2
Recipe
@ -124,7 +124,7 @@ MACMISC = misc version macstore settings tree234 macnet mtcpnet otnet proxy
|
|||||||
+ macmisc macabout
|
+ macmisc macabout
|
||||||
|
|
||||||
# Character set library, for use in pterm.
|
# Character set library, for use in pterm.
|
||||||
CHARSET = sbcsdat slookup sbcs utf8 toucs fromucs xenc mimeenc macenc
|
CHARSET = sbcsdat slookup sbcs utf8 toucs fromucs xenc mimeenc macenc localenc
|
||||||
|
|
||||||
# Standard libraries, and the same with WinSocks 1 and 2.
|
# Standard libraries, and the same with WinSocks 1 and 2.
|
||||||
LIBS = advapi32.lib user32.lib gdi32.lib comctl32.lib comdlg32.lib
|
LIBS = advapi32.lib user32.lib gdi32.lib comctl32.lib comdlg32.lib
|
||||||
|
@ -136,6 +136,14 @@ int charset_from_xenc(const char *name);
|
|||||||
const char *charset_to_mimeenc(int charset);
|
const char *charset_to_mimeenc(int charset);
|
||||||
int charset_from_mimeenc(const char *name);
|
int charset_from_mimeenc(const char *name);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Convert our own encoding names to and from our charset
|
||||||
|
* identifiers.
|
||||||
|
*/
|
||||||
|
const char *charset_to_localenc(int charset);
|
||||||
|
int charset_from_localenc(const char *name);
|
||||||
|
int charset_localenc_nth(int n);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Convert Mac OS script/region/font to our charset identifiers.
|
* Convert Mac OS script/region/font to our charset identifiers.
|
||||||
*/
|
*/
|
||||||
|
2
config.c
2
config.c
@ -162,7 +162,7 @@ static void codepage_handler(union control *ctrl, void *dlg,
|
|||||||
Config *cfg = (Config *)data;
|
Config *cfg = (Config *)data;
|
||||||
if (event == EVENT_REFRESH) {
|
if (event == EVENT_REFRESH) {
|
||||||
int i;
|
int i;
|
||||||
char *cp;
|
const char *cp;
|
||||||
dlg_update_start(ctrl, dlg);
|
dlg_update_start(ctrl, dlg);
|
||||||
strcpy(cfg->line_codepage,
|
strcpy(cfg->line_codepage,
|
||||||
cp_name(decode_codepage(cfg->line_codepage)));
|
cp_name(decode_codepage(cfg->line_codepage)));
|
||||||
|
4
putty.h
4
putty.h
@ -728,8 +728,8 @@ int wc_to_mb(int codepage, int flags, wchar_t *wcstr, int wclen,
|
|||||||
wchar_t xlat_uskbd2cyrllic(int ch);
|
wchar_t xlat_uskbd2cyrllic(int ch);
|
||||||
int check_compose(int first, int second);
|
int check_compose(int first, int second);
|
||||||
int decode_codepage(char *cp_name);
|
int decode_codepage(char *cp_name);
|
||||||
char *cp_enumerate (int index);
|
const char *cp_enumerate (int index);
|
||||||
char *cp_name(int codepage);
|
const char *cp_name(int codepage);
|
||||||
void get_unitab(int codepage, wchar_t * unitab, int ftype);
|
void get_unitab(int codepage, wchar_t * unitab, int ftype);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1094,7 +1094,7 @@ int decode_codepage(char *cp_name)
|
|||||||
return codepage;
|
return codepage;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *cp_name(int codepage)
|
const char *cp_name(int codepage)
|
||||||
{
|
{
|
||||||
const struct cp_list_item *cpi, *cpno;
|
const struct cp_list_item *cpi, *cpno;
|
||||||
static char buf[32];
|
static char buf[32];
|
||||||
@ -1134,7 +1134,7 @@ char *cp_name(int codepage)
|
|||||||
* Return the nth code page in the list, for use in the GUI
|
* Return the nth code page in the list, for use in the GUI
|
||||||
* configurer.
|
* configurer.
|
||||||
*/
|
*/
|
||||||
char *cp_enumerate(int index)
|
const char *cp_enumerate(int index)
|
||||||
{
|
{
|
||||||
if (index < 0 || index >= lenof(cp_list))
|
if (index < 0 || index >= lenof(cp_list))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -9,27 +9,6 @@
|
|||||||
|
|
||||||
const char *const appname = "pterm";
|
const char *const appname = "pterm";
|
||||||
|
|
||||||
/*
|
|
||||||
* Another bunch of temporary stub functions. These ones will want
|
|
||||||
* removing by means of implementing them properly: libcharset
|
|
||||||
* should invent its own sensible format for codepage names and a
|
|
||||||
* means of enumerating them, and printer_enum needs to be dealt
|
|
||||||
* with somehow or other too.
|
|
||||||
*/
|
|
||||||
|
|
||||||
char *cp_name(int codepage)
|
|
||||||
{
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
char *cp_enumerate(int index)
|
|
||||||
{
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
int decode_codepage(char *cp_name)
|
|
||||||
{
|
|
||||||
return -2;
|
|
||||||
}
|
|
||||||
|
|
||||||
Backend *select_backend(Config *cfg)
|
Backend *select_backend(Config *cfg)
|
||||||
{
|
{
|
||||||
return &pty_backend;
|
return &pty_backend;
|
||||||
|
@ -14,12 +14,6 @@
|
|||||||
/*
|
/*
|
||||||
* TODO:
|
* TODO:
|
||||||
*
|
*
|
||||||
* - libcharset enumeration.
|
|
||||||
*
|
|
||||||
* - fix the printer enum (I think the sensible thing is simply to
|
|
||||||
* have uxcfg.c remove the drop-down list completely, since you
|
|
||||||
* can't sensibly provide an enumerated list of lpr commands!).
|
|
||||||
*
|
|
||||||
* - Remainder of the context menu:
|
* - Remainder of the context menu:
|
||||||
*
|
*
|
||||||
* - Event Log (this means we must implement the Event Log; not
|
* - Event Log (this means we must implement the Event Log; not
|
||||||
@ -73,27 +67,6 @@ void cleanup_exit(int code)
|
|||||||
exit(code);
|
exit(code);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Another bunch of temporary stub functions. These ones will want
|
|
||||||
* removing by means of implementing them properly: libcharset
|
|
||||||
* should invent its own sensible format for codepage names and a
|
|
||||||
* means of enumerating them, and printer_enum needs to be dealt
|
|
||||||
* with somehow or other too.
|
|
||||||
*/
|
|
||||||
|
|
||||||
char *cp_name(int codepage)
|
|
||||||
{
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
char *cp_enumerate(int index)
|
|
||||||
{
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
int decode_codepage(char *cp_name)
|
|
||||||
{
|
|
||||||
return -2;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char *const appname = "PuTTY";
|
const char *const appname = "PuTTY";
|
||||||
|
|
||||||
Backend *select_backend(Config *cfg)
|
Backend *select_backend(Config *cfg)
|
||||||
|
30
unix/uxucs.c
30
unix/uxucs.c
@ -8,6 +8,7 @@
|
|||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
#include "putty.h"
|
#include "putty.h"
|
||||||
|
#include "charset.h"
|
||||||
#include "terminal.h"
|
#include "terminal.h"
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
|
|
||||||
@ -122,9 +123,7 @@ int init_ucs(struct unicode_data *ucsdata,
|
|||||||
* line_codepage should be decoded from the specification in
|
* line_codepage should be decoded from the specification in
|
||||||
* cfg.
|
* cfg.
|
||||||
*/
|
*/
|
||||||
ucsdata->line_codepage = charset_from_mimeenc(linecharset);
|
ucsdata->line_codepage = decode_codepage(linecharset);
|
||||||
if (ucsdata->line_codepage == CS_NONE)
|
|
||||||
ucsdata->line_codepage = charset_from_xenc(linecharset);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If line_codepage is _still_ CS_NONE, we assume we're using
|
* If line_codepage is _still_ CS_NONE, we assume we're using
|
||||||
@ -218,3 +217,28 @@ int init_ucs(struct unicode_data *ucsdata,
|
|||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *cp_name(int codepage)
|
||||||
|
{
|
||||||
|
if (codepage == CS_NONE)
|
||||||
|
return "Use font encoding";
|
||||||
|
return charset_to_localenc(codepage);
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *cp_enumerate(int index)
|
||||||
|
{
|
||||||
|
int charset;
|
||||||
|
if (index == 0)
|
||||||
|
return "Use font encoding";
|
||||||
|
charset = charset_localenc_nth(index-1);
|
||||||
|
if (charset == CS_NONE)
|
||||||
|
return NULL;
|
||||||
|
return charset_to_localenc(charset);
|
||||||
|
}
|
||||||
|
|
||||||
|
int decode_codepage(char *cp_name)
|
||||||
|
{
|
||||||
|
if (!*cp_name)
|
||||||
|
return CS_NONE; /* use font encoding */
|
||||||
|
return charset_from_localenc(cp_name);
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user