-\versionid $Id: config.but,v 1.66 2003/06/25 15:52:29 jacob Exp $
+\versionid $Id: config.but,v 1.67 2003/09/03 20:14:38 jacob Exp $
\C{config} Configuring PuTTY
you can try enabling this option. However, be warned that it's never
worked very well.
+\S{config-syscolour} \q{Use system colours}
+
+\cfg{winhelp-topic}{colours.system}
+
+Enabling this option will cause PuTTY to ignore the configured colours
+for \q{Default Background/Foreground} and \q{Cursor Colour/Text} (see
+\k{config-colourcfg}), instead going with the system-wide defaults.
+
+Note that non-bold and bold text will be the same colour if this
+option is enabled. You might want to change to indicating bold text
+by font changes (see \k{config-boldcolour}).
+
\S{config-colourcfg} Adjusting the colours in the terminal window
\cfg{winhelp-topic}{colours.config}
char answerback[256];
char printer[128];
/* Colour options */
+ int system_colour;
int try_palette;
int bold_colour;
unsigned char colours[22][3];
write_setting_i(sesskey, "TermHeight", cfg->height);
write_setting_fontspec(sesskey, "Font", cfg->font);
write_setting_i(sesskey, "FontVTMode", cfg->vtmode);
+ write_setting_i(sesskey, "UseSystemColours", cfg->system_colour);
write_setting_i(sesskey, "TryPalette", cfg->try_palette);
write_setting_i(sesskey, "BoldAsColour", cfg->bold_colour);
for (i = 0; i < 22; i++) {
gppi(sesskey, "TermHeight", 24, &cfg->height);
gppfont(sesskey, "Font", &cfg->font);
gppi(sesskey, "FontVTMode", VT_UNICODE, (int *) &cfg->vtmode);
+ gppi(sesskey, "UseSystemColours", 0, &cfg->system_colour);
gppi(sesskey, "TryPalette", 0, &cfg->try_palette);
gppi(sesskey, "BoldAsColour", 1, &cfg->bold_colour);
for (i = 0; i < 22; i++) {
ctrl_checkbox(s, "Attempt to use logical palettes", 'l',
HELPCTX(colours_logpal),
dlg_stdcheckbox_handler, I(offsetof(Config,try_palette)));
+ ctrl_checkbox(s, "Use system colours", 's',
+ HELPCTX(colours_system),
+ dlg_stdcheckbox_handler, I(offsetof(Config,system_colour)));
+
/*
* Resize-by-changing-font is a Windows insanity.
static int TranslateKey(UINT message, WPARAM wParam, LPARAM lParam,
unsigned char *output);
static void cfgtopalette(void);
+static void systopalette(void);
static void init_palette(void);
static void init_fonts(int, int);
static void another_font(int);
defpal[i].rgbtGreen = cfg.colours[w][1];
defpal[i].rgbtBlue = cfg.colours[w][2];
}
+
+ /* Override with system colours if appropriate */
+ if (cfg.system_colour)
+ systopalette();
+}
+
+/*
+ * Override bit of defpal with colours from the system.
+ * (NB that this takes a copy the system colours at the time this is called,
+ * so subsequent colour scheme changes don't take effect. To fix that we'd
+ * probably want to be using GetSysColorBrush() and the like.)
+ */
+static void systopalette(void)
+{
+ int i;
+ static const struct { int nIndex; int norm; int bold; } or[] =
+ {
+ { COLOR_WINDOWTEXT, 16, 17 }, /* Default Foreground */
+ { COLOR_WINDOW, 18, 19 }, /* Default Background */
+ { COLOR_HIGHLIGHTTEXT, 20, 21 }, /* Cursor Text */
+ { COLOR_HIGHLIGHT, 22, 23 }, /* Cursor Colour */
+ };
+
+ for (i = 0; i < (sizeof(or)/sizeof(or[0])); i++) {
+ COLORREF colour = GetSysColor(or[i].nIndex);
+ defpal[or[i].norm].rgbtRed =
+ defpal[or[i].bold].rgbtRed = GetRValue(colour);
+ defpal[or[i].norm].rgbtGreen =
+ defpal[or[i].bold].rgbtGreen = GetGValue(colour);
+ defpal[or[i].norm].rgbtBlue =
+ defpal[or[i].bold].rgbtBlue = GetBValue(colour);
+ }
}
/*
#define WINHELP_CTX_selection_linedraw "selection.linedraw"
#define WINHELP_CTX_selection_rtf "selection.rtf"
#define WINHELP_CTX_colours_bold "colours.bold"
+#define WINHELP_CTX_colours_system "colours.system"
#define WINHELP_CTX_colours_logpal "colours.logpal"
#define WINHELP_CTX_colours_config "colours.config"
#define WINHELP_CTX_translation_codepage "translation.codepage"