Răsfoiți Sursa

* More work on colors

svn: 1294
Bryan Drewery 22 ani în urmă
părinte
comite
c0e02b4d46
4 a modificat fișierele cu 232 adăugiri și 220 ștergeri
  1. 198 198
      misc/help.txt
  2. 6 0
      src/color.h
  3. 20 10
      src/dccutil.c
  4. 8 12
      src/misc.c

Fișier diff suprimat deoarece este prea mare
+ 198 - 198
misc/help.txt


+ 6 - 0
src/color.h

@@ -3,6 +3,12 @@
 
 #include "misc.h"
 
+#define CFLGS_BOLD 	 	BIT0
+#define CFLGS_REV   		BIT1
+#define CFLGS_UNDERLINE 	BIT2
+#define CFLGS_FLASH 		BIT3
+
+
 #define C_BLACK                 1
 #define C_BLUE                  2
 #define C_GREEN                 3

+ 20 - 10
src/dccutil.c

@@ -126,7 +126,8 @@ void dprintf(int idx, const char *format, ...)
     return;
   } else { /* normal chat text */
     if (coloridx(idx)) {
-      int i, schar = 0, inbold = 0, inunderline = 0;
+      int i, schar = 0;
+      static int cflags;
       char buf3[1024] = "", buf2[1024] = "", c = 0;
 
       for (i = 0 ; i < len ; i++) {
@@ -138,21 +139,30 @@ void dprintf(int idx, const char *format, ...)
 
           switch (c) {
             case 'b':
-              if (!inbold) {
-                sprintf(buf2, "%s", BOLD(idx));
-                inbold++;
-              } else {
+              if (cflags & CFLGS_BOLD) {
                 sprintf(buf2, "%s", BOLD_END(idx));
-                inbold--;
+                cflags &= ~CFLGS_BOLD;
+              } else {
+                cflags |= CFLGS_BOLD;
+                sprintf(buf2, "%s", BOLD(idx));
               }
               break;
             case 'u':
-              if (!inunderline) {
+              if (cflags & CFLGS_UNDERLINE) {
+                sprintf(buf2, "%s", UNDERLINE_END(idx));
+                cflags &= ~CFLGS_UNDERLINE;
+              } else {
                 sprintf(buf2, "%s", UNDERLINE(idx));
-                inunderline++;
+                cflags |= CFLGS_UNDERLINE;
+              }
+              break;
+            case 'f':
+              if (cflags & CFLGS_FLASH) {
+                sprintf(buf2, "%s", FLASH_END(idx));
+                cflags &= ~CFLGS_FLASH;
               } else {
-                sprintf(buf2, "%s", UNDERLINE_END(idx));
-                inunderline--;
+                sprintf(buf2, "%s", FLASH(idx));
+                cflags |= CFLGS_FLASH;
               }
               break;
             default:

+ 8 - 12
src/misc.c

@@ -893,14 +893,8 @@ char *replace(const char *string, const char *oldie, const char *newbie)
   return (newstring);
 }
 
-#define HELP_BOLD  1
-#define HELP_REV   2
-#define HELP_UNDER 4
-#define HELP_FLASH 8
-
 void showhelp(int idx, struct flag_record *flags, char *string)
 {
-  static int help_flags;
   struct flag_record fr = {FR_GLOBAL | FR_CHAN, 0, 0, 0 };
   char *helpstr = NULL, tmp[2] = "", flagstr[10] = "";
   int ok = 1;
@@ -947,25 +941,27 @@ void showhelp(int idx, struct flag_record *flags, char *string)
         while (*string && *string != '}') {
           string++;
         }
+/*
       } else if (*(string + 1) == 'b') {
         string += 2;
-        if (help_flags & HELP_BOLD) {
-          help_flags &= ~HELP_BOLD;
+        if (help_flags & CFLGS_BOLD) {
+          help_flags &= ~CFLGS_BOLD;
           strcat(helpstr, color(idx, BOLD_CLOSE, 0));
         } else {
-          help_flags |= HELP_BOLD;
+          help_flags |= CFLGS_BOLD;
           strcat(helpstr, color(idx, BOLD_OPEN, 0));
         }
       } else if (*(string + 1) == 'f') {
         string += 2;
         
-        if (help_flags & HELP_FLASH) {
+        if (help_flags & CFLGS_FLASH) {
           strcat(helpstr, color(idx, FLASH_CLOSE, 0));
-          help_flags &= ~HELP_FLASH;
+          help_flags &= ~CFLGS_FLASH;
         } else {
-          help_flags |= HELP_FLASH;
+          help_flags |= CFLGS_FLASH;
           strcat(helpstr, color(idx, FLASH_OPEN, 0));
         }
+*/
       } else if (*(string + 1) == 'd') {
         string += 2;
         strcat(helpstr, settings.dcc_prefix);        

Unele fișiere nu au fost afișate deoarece prea multe fișiere au fost modificate în acest diff