Corretto caricamento colori da file di configurazione
git-svn-id: svn://10.65.10.50/trunk@3144 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
		
							parent
							
								
									85a2d7afec
								
							
						
					
					
						commit
						79069687e7
					
				| @ -121,12 +121,11 @@ void TConfig::_write_file() | |||||||
| 
 | 
 | ||||||
|   out.close(); in.close(); |   out.close(); in.close(); | ||||||
|    |    | ||||||
|   while (access(_file, 02) != 0) |   if (fexist(_file)) | ||||||
|     message_box("Il file %s e' gia' in uso", (const char*)_file); |   { | ||||||
|   /*
 |     while (access(_file, 02) != 0) | ||||||
|      TFilename bak(_file); bak.ext("bak"); |       message_box("Il file %s e' gia' in uso", (const char*)_file); | ||||||
|      rename(_file, bak); |   }     | ||||||
|      */ |  | ||||||
|   fcopy(temp, _file);      // Copia dalla tempdir al nuovo .ini
 |   fcopy(temp, _file);      // Copia dalla tempdir al nuovo .ini
 | ||||||
|   remove(temp);            // Cancella file temporaneo
 |   remove(temp);            // Cancella file temporaneo
 | ||||||
| } | } | ||||||
| @ -370,6 +369,25 @@ COLOR TConfig::get_color( | |||||||
|     TString16 d; d << r << ',' << g << ',' << b; |     TString16 d; d << r << ',' << g << ',' << b; | ||||||
|     set(var, d, section, TRUE, index); |     set(var, d, section, TRUE, index); | ||||||
|   }                      |   }                      | ||||||
|  |    | ||||||
|  |   // Se nel colore non compare l'indice cerca di calcolarlo
 | ||||||
|  |   const byte color_index = byte(def >> 12); | ||||||
|  |   if (color_index < 0x1 || color_index > 0xF)                                 | ||||||
|  |   { | ||||||
|  |     const COLOR native_color[11] = { COLOR_RED,     COLOR_GREEN,  COLOR_BLUE,  COLOR_CYAN,  | ||||||
|  |                                      COLOR_MAGENTA, COLOR_YELLOW, COLOR_BLACK, COLOR_DKGRAY, | ||||||
|  |                                      COLOR_GRAY,    COLOR_LTGRAY, COLOR_WHITE }; | ||||||
|  |                                    | ||||||
|  |     for (int c = 0; c < 11; c++) | ||||||
|  |     { | ||||||
|  |       if (def == (native_color[c] & 0x00FFFFFF))    // Confronta solo la terna R,G,B
 | ||||||
|  |       { | ||||||
|  |         def = native_color[c]; | ||||||
|  |         break; | ||||||
|  |       }   | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  |    | ||||||
|   return def; |   return def; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user