+ Added new keyword to support background transparency

TRANSPARENTCOLORS Yes/No
  default is "No". If set to "Yes" BLACK background color will become
  transparent. Supported for ncurses compilation, otherwise do nothing.
This commit is contained in:
Stanislav Mekhanoshin 2007-06-21 19:03:18 +00:00
parent 0bf406cc77
commit 0d3a3b3ebc
11 changed files with 47 additions and 5 deletions

View File

@ -1237,6 +1237,11 @@ SCREENSHADOWS YES
;INTENSECOLORS YES
INTENSECOLORS NO
// Use background transparency?
// Default is "No". If set to "Yes" BLACK background color will become
// transparent. Supported for ncurses compilation, otherwise do nothing.
;TRANSPARENTCOLORS YES
// Select default color set.
COLORSET DETECT ; Select based on screencard and intense value.
;COLORSET NORMAL ; Select standard color set.

View File

@ -1443,6 +1443,12 @@ ScreenShadows Yes
;IntenseColors Yes
IntenseColors No
// ˆá¯®«ì§®¢ âì «¨ ¯à®§à ç­ë© ä®­?
// <20>/ã "No". ᫨ ãáâ ­®¢«¥­® ¢ "Yes", 梥â BLACK ¨á¯®«ì§®¢ ­­ë© ¢
// ª ç¥á⢥ ä®­ , áâ ­¥â ¯à®§à ç­ë¬. <20>®¤¤¥à¦¨¢ ¥âáï ⮫쪮 ¯à¨
// ¨á¯®«ì§®¢ ­¨¨ ncurses, ¨­ ç¥ ¨£­®à¨àã¥âáï.
;TransparentColors Yes
// ‚ë¡®à 梥⮢ ¯® 㬮«ç ­¨î.
ColorSet Detect ; €¢â® ®¯à¥¤¥«¥­¨¥.
;ColorSet Normal ; ‘â ­¤ àâ­ë© 梥â.

View File

@ -10,6 +10,11 @@ ______________________________________________________________________
Notes for GoldED+ 1.1.5, /snapshot/
______________________________________________________________________
+ Added new keyword to support background transparency
TRANSPARENTCOLORS Yes/No
default is "No". If set to "Yes" BLACK background color will become
transparent. Supported for ncurses compilation, otherwise do nothing.
= Snapshot for the May 3, 2007.
+ Golded+ may be compiled in MacOS X now (using xcode package).

View File

@ -748,6 +748,7 @@ CfgGed::CfgGed() {
hudsonuserno = 0;
ignorecharset = false;
intensecolors = false;
transparentcolors = false;
internetmsgid = false;
internetrfcbody = 0;
internetviagate = false;

View File

@ -294,6 +294,7 @@ const word CRC_PRINTINIT = 0xB195;
const word CRC_PRINTLENGTH = 0x5D19;
const word CRC_PRINTMARGIN = 0xAC75;
const word CRC_PRINTRESET = 0xEFBD;
const word CRC_TRANSPARENTCOLORS= 0xFCB1;
const word CRC_QUOTEBLANK = 0xD3BB;
const word CRC_QUOTEBUFFILE = 0xDE2A;
const word CRC_QUOTEBUFMODE = 0x6A16;

View File

@ -577,6 +577,7 @@ SwitchT:
case CRC_TIMEOUT : CfgTimeout (); break;
case CRC_TITLESTATUS : CfgTitlestatus (); break;
case CRC_TRANSLATE : CfgTranslate (); break;
case CRC_TRANSPARENTCOLORS: CfgTransparentcolors(); break;
case CRC_TWITMODE : CfgTwitmode (); break;
case CRC_TWITNAME : CfgTwitname (); break;
case CRC_TWITSUBJ : CfgTwitsubj (); break;

View File

@ -251,6 +251,15 @@ void CfgTranslate()
CFG->translate.Add(strupr(key), val);
}
// ------------------------------------------------------------------ $
void CfgTransparentcolors() {
CFG->transparentcolors = make_bool(GetYesno(val));
if(CFG->transparentcolors)
GVid::setcolorpairs(true);
}
// ------------------------------------------------------------------
void CfgTwitmode() {

View File

@ -360,6 +360,7 @@ void CfgTimeout ();
void CfgTimeoutsavemsg ();
void CfgTitlestatus ();
void CfgTranslate ();
void CfgTransparentcolors();
void CfgTwitmode ();
void CfgTwitname ();
void CfgTwitsubj ();

View File

@ -332,6 +332,7 @@ public:
Path inboundpath;
Path inputfile;
bool intensecolors;
bool transparentcolors;
IAdr internetaddress;
char internetdomain[96];
Node internetgate;

View File

@ -329,6 +329,8 @@ public:
int detectadapter ();
void detectinfo (GVidInfo* _info);
static
void setcolorpairs (bool enabletransparent=false);
void resetcurr ();

View File

@ -222,11 +222,7 @@ int GVid::detectadapter() {
start_color();
/* init colors */
short mycolors[] = { COLOR_BLACK, COLOR_BLUE, COLOR_GREEN, COLOR_CYAN,
COLOR_RED, COLOR_MAGENTA, COLOR_YELLOW, COLOR_WHITE };
for(int i = 1; i < 64 and i < COLOR_PAIRS; i++)
init_pair(i, mycolors[(~i)&0x07], mycolors[(i>>3)&0x07]);
setcolorpairs();
adapter = V_VGA;
@ -435,6 +431,20 @@ int GVid::detectadapter() {
return adapter;
}
void GVid::setcolorpairs(bool enabletransparent) {
#if defined(__USE_NCURSES__)
/* init colors */
short mycolors[] = { COLOR_BLACK, COLOR_BLUE, COLOR_GREEN, COLOR_CYAN,
COLOR_RED, COLOR_MAGENTA, COLOR_YELLOW, COLOR_WHITE };
if(enabletransparent)
use_default_colors();
for(int i = 1; i < 64 and i < COLOR_PAIRS; i++) {
short bg=mycolors[(i>>3)&0x07];
init_pair(i, mycolors[(~i)&0x07], ((bg==COLOR_BLACK) && enabletransparent)?-1:bg);
}
#endif
}
// ------------------------------------------------------------------
// Video info detect