From 0d3a3b3ebc017fadcce2f4672954160a2ea64b62 Mon Sep 17 00:00:00 2001 From: Stanislav Mekhanoshin Date: Thu, 21 Jun 2007 19:03:18 +0000 Subject: [PATCH] + 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. --- cfgs/config/advanced.cfg | 5 +++++ cfgs/config/advanced.rus | 6 ++++++ docs/notework.txt | 5 +++++ golded3/gccfgg.cpp | 1 + golded3/gccfgg.h | 1 + golded3/gccfgg0.cpp | 1 + golded3/gccfgg8.cpp | 9 +++++++++ golded3/gcprot.h | 1 + golded3/gecfgg.h | 1 + goldlib/gall/gvidall.h | 2 ++ goldlib/gall/gvidinit.cpp | 20 +++++++++++++++----- 11 files changed, 47 insertions(+), 5 deletions(-) diff --git a/cfgs/config/advanced.cfg b/cfgs/config/advanced.cfg index c01fece..4ac6cb1 100644 --- a/cfgs/config/advanced.cfg +++ b/cfgs/config/advanced.cfg @@ -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. diff --git a/cfgs/config/advanced.rus b/cfgs/config/advanced.rus index 325990b..41721d9 100644 --- a/cfgs/config/advanced.rus +++ b/cfgs/config/advanced.rus @@ -1443,6 +1443,12 @@ ScreenShadows Yes ;IntenseColors Yes IntenseColors No +// Использовать ли прозрачный фон? +// П/у "No". сли установлено в "Yes", цвет BLACK использованный в +// качестве фона, станет прозрачным. Поддерживается только при +// использовании ncurses, иначе игнорируется. +;TransparentColors Yes + // Выбор цветов по умолчанию. ColorSet Detect ; Авто определение. ;ColorSet Normal ; Стандартный цвет. diff --git a/docs/notework.txt b/docs/notework.txt index d572975..f0c24c2 100644 --- a/docs/notework.txt +++ b/docs/notework.txt @@ -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). diff --git a/golded3/gccfgg.cpp b/golded3/gccfgg.cpp index 09bd16d..4e228e7 100644 --- a/golded3/gccfgg.cpp +++ b/golded3/gccfgg.cpp @@ -748,6 +748,7 @@ CfgGed::CfgGed() { hudsonuserno = 0; ignorecharset = false; intensecolors = false; + transparentcolors = false; internetmsgid = false; internetrfcbody = 0; internetviagate = false; diff --git a/golded3/gccfgg.h b/golded3/gccfgg.h index 4e77192..dee4148 100644 --- a/golded3/gccfgg.h +++ b/golded3/gccfgg.h @@ -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; diff --git a/golded3/gccfgg0.cpp b/golded3/gccfgg0.cpp index 622b7bb..2795cce 100644 --- a/golded3/gccfgg0.cpp +++ b/golded3/gccfgg0.cpp @@ -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; diff --git a/golded3/gccfgg8.cpp b/golded3/gccfgg8.cpp index aace5f3..788a8f5 100644 --- a/golded3/gccfgg8.cpp +++ b/golded3/gccfgg8.cpp @@ -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() { diff --git a/golded3/gcprot.h b/golded3/gcprot.h index 5c3f210..7c2bf94 100644 --- a/golded3/gcprot.h +++ b/golded3/gcprot.h @@ -360,6 +360,7 @@ void CfgTimeout (); void CfgTimeoutsavemsg (); void CfgTitlestatus (); void CfgTranslate (); +void CfgTransparentcolors(); void CfgTwitmode (); void CfgTwitname (); void CfgTwitsubj (); diff --git a/golded3/gecfgg.h b/golded3/gecfgg.h index 3493c94..8ebeab5 100644 --- a/golded3/gecfgg.h +++ b/golded3/gecfgg.h @@ -332,6 +332,7 @@ public: Path inboundpath; Path inputfile; bool intensecolors; + bool transparentcolors; IAdr internetaddress; char internetdomain[96]; Node internetgate; diff --git a/goldlib/gall/gvidall.h b/goldlib/gall/gvidall.h index 48be7e4..babcb0e 100644 --- a/goldlib/gall/gvidall.h +++ b/goldlib/gall/gvidall.h @@ -329,6 +329,8 @@ public: int detectadapter (); void detectinfo (GVidInfo* _info); + static + void setcolorpairs (bool enabletransparent=false); void resetcurr (); diff --git a/goldlib/gall/gvidinit.cpp b/goldlib/gall/gvidinit.cpp index 7cbe2a5..84dffbd 100644 --- a/goldlib/gall/gvidinit.cpp +++ b/goldlib/gall/gvidinit.cpp @@ -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