From 49294f1f5676f857a6df1fe07120ced6193a1a51 Mon Sep 17 00:00:00 2001 From: Stas Degteff Date: Mon, 3 Oct 2005 16:55:00 +0000 Subject: [PATCH] Stylecodes now may be used in random system groups. Patch from Ianos Gnatiuc 2:5030/830.17 --- cfgs/config/advanced.rus | 1 + docs/notework.txt | 2 ++ golded3/gccfgg8.cpp | 21 +++++++++++++++------ golded3/gectnr.cpp | 2 +- golded3/geedit.cpp | 22 +++++++++++----------- golded3/gerand.cpp | 4 ++++ golded3/geread.cpp | 14 +++++++------- golded3/geread2.cpp | 6 +++--- golded3/geview.cpp | 4 ++-- golded3/gmarea.h | 2 ++ goldlib/gall/gutlgrp.h | 4 +++- 11 files changed, 51 insertions(+), 31 deletions(-) diff --git a/cfgs/config/advanced.rus b/cfgs/config/advanced.rus index 95f9a70..d6f46e6 100644 --- a/cfgs/config/advanced.rus +++ b/cfgs/config/advanced.rus @@ -2285,6 +2285,7 @@ EndGroup // QuoteChars // QuoteString // SearchFor +// StyleCodes // Tagline // TaglineChar // TaglineFile diff --git a/docs/notework.txt b/docs/notework.txt index 6f73dbd..8964b55 100644 --- a/docs/notework.txt +++ b/docs/notework.txt @@ -10,6 +10,8 @@ ______________________________________________________________________ Notes for GoldED+ 1.1.5, /snapshot/ ______________________________________________________________________ ++ Stylecodes now may be used in random system groups. + + New color config file item: "COLOR HEADER LOCATION". This is used for define colors of the originate node location information (see DISPHDRLOCATION and LOCATIONALIAS). diff --git a/golded3/gccfgg8.cpp b/golded3/gccfgg8.cpp index c50a404..c6c9715 100644 --- a/golded3/gccfgg8.cpp +++ b/golded3/gccfgg8.cpp @@ -88,13 +88,22 @@ void CfgStylecodepunct() { void CfgStylecodes() { - if(strieql(val, "HIDE")) { - CFG->hidestylies = true; - CFG->usestylies = true; + bool flag1 = false, flag2; + + if (strieql(val, "HIDE")) + flag1 = flag2 = true; + else + flag2 = GetYesno(val); + + if (cfgingroup) + { + CFG->grp.AddItm(GRP_HIDESTYLIES, flag1); + CFG->grp.AddItm(GRP_USESTYLIES, flag2); } - else { - CFG->hidestylies = false; - CFG->usestylies = GetYesno(val); + else + { + CFG->hidestylies = flag1; + CFG->usestylies = flag2; } } diff --git a/golded3/gectnr.cpp b/golded3/gectnr.cpp index 8d8b640..28dc3a6 100644 --- a/golded3/gectnr.cpp +++ b/golded3/gectnr.cpp @@ -91,7 +91,7 @@ void Container::StyleCodeHighlight(const char* text, int row, int col, bool dohi char* punctchars = CFG->stylecodepunct; char* stylestopchars = CFG->stylecodestops; char prevchar = ' '; - bool usestylies = dohide or CFG->usestylies; + bool usestylies = dohide or AA->adat->usestylies; if(usestylies or CFG->highlighturls) { while(*ptr) { diff --git a/golded3/geedit.cpp b/golded3/geedit.cpp index 4c7df19..d1dfe66 100644 --- a/golded3/geedit.cpp +++ b/golded3/geedit.cpp @@ -293,12 +293,12 @@ void IEclass::dispstring(const char* __string, uint __row, int attr, Line* line) savechar = _buf[endblock]; _buf[endblock] = NUL; - bool oldusestylies = CFG->usestylies; + bool oldusestylies = AA->adat->usestylies; bool oldhighlighturls = CFG->highlighturls; - CFG->usestylies = false; + AA->adat->usestylies = false; CFG->highlighturls = false; StyleCodeHighlight(_buf+begblock, __row, mincol+begblock, false, C_READA); - CFG->usestylies = oldusestylies; + AA->adat->usestylies = oldusestylies; CFG->highlighturls = oldhighlighturls; _buf[endblock] = savechar; StyleCodeHighlight(_buf+endblock, __row, mincol+endblock, false, attr); @@ -308,32 +308,32 @@ void IEclass::dispstring(const char* __string, uint __row, int attr, Line* line) char savechar = _buf[blockmark]; _buf[blockmark] = NUL; - bool oldusestylies = CFG->usestylies; + bool oldusestylies = AA->adat->usestylies; bool oldhighlighturls = CFG->highlighturls; if(selected) { - CFG->usestylies = false; + AA->adat->usestylies = false; CFG->highlighturls = false; } StyleCodeHighlight(_buf, __row, mincol, false, selected ? C_READA : attr); - CFG->usestylies = oldusestylies; + AA->adat->usestylies = oldusestylies; _buf[blockmark] = savechar; if(not selected) { - CFG->usestylies = false; + AA->adat->usestylies = false; CFG->highlighturls = false; } StyleCodeHighlight(_buf+blockmark, __row, mincol+blockmark, false, selected ? attr : C_READA); - CFG->usestylies = oldusestylies; + AA->adat->usestylies = oldusestylies; CFG->highlighturls = oldhighlighturls; } else { - bool oldusestylies = CFG->usestylies; + bool oldusestylies = AA->adat->usestylies; bool oldhighlighturls = CFG->highlighturls; if(selected) { - CFG->usestylies = false; + AA->adat->usestylies = false; CFG->highlighturls = false; } StyleCodeHighlight(_buf, __row, mincol, false, selected ? C_READA : attr); - CFG->usestylies = oldusestylies; + AA->adat->usestylies = oldusestylies; CFG->highlighturls = oldhighlighturls; } } diff --git a/golded3/gerand.cpp b/golded3/gerand.cpp index b17395b..b699f15 100644 --- a/golded3/gerand.cpp +++ b/golded3/gerand.cpp @@ -140,6 +140,8 @@ void Area::InitData() { adat->edithardterm = EDIT->HardTerm(); adat->editmixcase = EDIT->MixCase(); adat->forcetemplate = CFG->forcetemplate; + adat->hidestylies = CFG->hidestylies; + adat->usestylies = CFG->usestylies; strcpy(adat->inputfile, CFG->inputfile); strcpy(adat->internetaddress, CFG->internetaddress); memcpy(&adat->internetgate, &CFG->internetgate, sizeof(Node)); @@ -292,6 +294,8 @@ void Area::RandomizeData(int mode) { CFG->grp.GetItm(GRP_EDITMIXCASE, adat->editmixcase); CFG->grp.GetItm(GRP_EDITREPLYRE, adat->replyre); CFG->grp.GetItm(GRP_FORCETEMPLATE, adat->forcetemplate); + CFG->grp.GetItm(GRP_HIDESTYLIES, adat->hidestylies); + CFG->grp.GetItm(GRP_USESTYLIES, adat->usestylies); CFG->grp.GetItm(GRP_INPUTFILE, adat->inputfile, sizeof(adat->inputfile)); CFG->grp.GetItm(GRP_INTERNETADDRESS, adat->internetaddress, sizeof(adat->internetaddress)); CFG->grp.GetItm(GRP_INTERNETGATE, &adat->internetgate, sizeof(Node)); diff --git a/golded3/geread.cpp b/golded3/geread.cpp index 6f2c4b8..91e87eb 100644 --- a/golded3/geread.cpp +++ b/golded3/geread.cpp @@ -491,24 +491,24 @@ void Reader() { break; case KK_ReadStylesNone: - if(CFG->usestylies or CFG->hidestylies) - CFG->usestylies = CFG->hidestylies = false; + if (AA->adat->usestylies or AA->adat->hidestylies) + AA->adat->usestylies = AA->adat->hidestylies = false; else reader_keyok = true; break; case KK_ReadStylesShow: - if(not CFG->usestylies or CFG->hidestylies) { - CFG->usestylies = true; - CFG->hidestylies = false; + if (not AA->adat->usestylies or AA->adat->hidestylies) { + AA->adat->usestylies = true; + AA->adat->hidestylies = false; } else reader_keyok = true; break; case KK_ReadStylesStrip: - if(not CFG->usestylies or not CFG->hidestylies) - CFG->usestylies = CFG->hidestylies = true; + if (not AA->adat->usestylies or not AA->adat->hidestylies) + AA->adat->usestylies = AA->adat->hidestylies = true; else reader_keyok = true; break; diff --git a/golded3/geread2.cpp b/golded3/geread2.cpp index 5d802f8..604c5ac 100644 --- a/golded3/geread2.cpp +++ b/golded3/geread2.cpp @@ -253,7 +253,7 @@ void ToggleTwits() { void ToggleStyles() { gkey k; - int setting = CFG->usestylies + CFG->hidestylies*2; + int setting = AA->adat->usestylies + AA->adat->hidestylies*2; do { switch(setting) { @@ -267,8 +267,8 @@ void ToggleStyles() { w_info(NULL); if(k != Key_Esc) { - CFG->usestylies = (setting & 1) ? true : false; - CFG->hidestylies = (setting & 2) ? true : false; + AA->adat->usestylies = (setting & 1) ? true : false; + AA->adat->hidestylies = (setting & 2) ? true : false; } } diff --git a/golded3/geview.cpp b/golded3/geview.cpp index 99dced7..dea2275 100644 --- a/golded3/geview.cpp +++ b/golded3/geview.cpp @@ -464,10 +464,10 @@ void GMsgBodyView::PaintLine(int row, Line *line) { if(not SearchHighlight(line, vrow, visible_width, highlight_color)) { if(line->type & GLINE_ORIG and strneql(line->txt.c_str(), " * Origin: ", 11)) { vputs(vrow, 0, color, " * Origin: "); - StyleCodeHighlight(line->txt.c_str()+11, vrow, 11, not AA->attr().hex() and CFG->hidestylies, color); + StyleCodeHighlight(line->txt.c_str()+11, vrow, 11, not AA->attr().hex() and AA->adat->hidestylies, color); } else - StyleCodeHighlight(line->txt.c_str(), vrow, 0, not AA->attr().hex() and CFG->hidestylies, color); + StyleCodeHighlight(line->txt.c_str(), vrow, 0, not AA->attr().hex() and AA->adat->hidestylies, color); int tlen = strlen(line->txt.c_str()); vputns(vrow, tlen, color, "", visible_width-tlen); } diff --git a/golded3/gmarea.h b/golded3/gmarea.h index 1402b26..750b3d7 100644 --- a/golded3/gmarea.h +++ b/golded3/gmarea.h @@ -278,6 +278,8 @@ struct AreaData { bool edithardterm; bool editmixcase; bool forcetemplate; + bool hidestylies; + bool usestylies; IAdr internetaddress; Node internetgate; bool internetmsgid; diff --git a/goldlib/gall/gutlgrp.h b/goldlib/gall/gutlgrp.h index dde0001..4b51b29 100644 --- a/goldlib/gall/gutlgrp.h +++ b/goldlib/gall/gutlgrp.h @@ -61,6 +61,8 @@ enum { GRP_EDITMIXCASE, GRP_EDITREPLYRE, GRP_FORCETEMPLATE, + GRP_HIDESTYLIES, + GRP_USESTYLIES, GRP_INPUTFILE, GRP_INTERNETADDRESS, GRP_INTERNETGATE, @@ -128,7 +130,7 @@ private: TYPE_INT, TYPE_STRING, TYPE_OBJECT - }; + }; int type; union {