mirror of https://github.com/aseprite/aseprite.git
				
				
				
			Minor formatting changes
This commit is contained in:
		
							parent
							
								
									e813773445
								
							
						
					
					
						commit
						b1016a419f
					
				|  | @ -440,11 +440,11 @@ | |||
|                  pref="scripts.show_run_script_alert" /> | ||||
| 	  <hbox> | ||||
|             <label text="@.image_format_alerts" /> | ||||
|             <check id="css_options_alert" text="!css" pref="css.show_alert" /> | ||||
|             <check id="gif_options_alert" text="!gif" pref="gif.show_alert" /> | ||||
|             <check id="jpeg_options_alert" text="!jpeg" pref="jpeg.show_alert" /> | ||||
|             <check id="svg_options_alert" text="!svg" pref="svg.show_alert" /> | ||||
|             <check id="tga_options_alert" text="!tga" pref="tga.show_alert" /> | ||||
|             <check id="css_options_alert" text="!css" pref="css.show_alert" /> | ||||
| 	  </hbox> | ||||
|           <separator horizontal="true" /> | ||||
| 	  <hbox> | ||||
|  |  | |||
|  | @ -125,6 +125,7 @@ endif() | |||
| set(file_formats | ||||
|   file/ase_format.cpp | ||||
|   file/bmp_format.cpp | ||||
|   file/css_format.cpp | ||||
|   file/fli_format.cpp | ||||
|   file/gif_format.cpp | ||||
|   file/ico_format.cpp | ||||
|  | @ -132,7 +133,6 @@ set(file_formats | |||
|   file/pcx_format.cpp | ||||
|   file/png_format.cpp | ||||
|   file/svg_format.cpp | ||||
|   file/css_format.cpp | ||||
|   file/tga_format.cpp) | ||||
| if(WITH_WEBP_SUPPORT) | ||||
|   list(APPEND file_formats file/webp_format.cpp) | ||||
|  |  | |||
|  | @ -987,10 +987,10 @@ private: | |||
|     advancedModeAlert()->resetWithDefaultValue(); | ||||
|     invalidFgBgColorAlert()->resetWithDefaultValue(); | ||||
|     runScriptAlert()->resetWithDefaultValue(); | ||||
|     cssOptionsAlert()->resetWithDefaultValue(); | ||||
|     gifOptionsAlert()->resetWithDefaultValue(); | ||||
|     jpegOptionsAlert()->resetWithDefaultValue(); | ||||
|     svgOptionsAlert()->resetWithDefaultValue(); | ||||
|     cssOptionsAlert()->resetWithDefaultValue(); | ||||
|     tgaOptionsAlert()->resetWithDefaultValue(); | ||||
|   } | ||||
| 
 | ||||
|  |  | |||
|  | @ -78,7 +78,10 @@ FileFormat *CreateCssFormat() | |||
|   return new CssFormat; | ||||
| } | ||||
| 
 | ||||
| bool CssFormat::onLoad(FileOp *fop) { return false; } | ||||
| bool CssFormat::onLoad(FileOp* fop) | ||||
| { | ||||
|   return false; | ||||
| } | ||||
| 
 | ||||
| #ifdef ENABLE_SAVE | ||||
| 
 | ||||
|  | @ -92,7 +95,8 @@ bool CssFormat::onSave(FileOp *fop) | |||
|   auto print_color = [f](int r, int g, int b, int a) { | ||||
|     if (a == 255) { | ||||
|       fprintf(f, "#%02X%02X%02X", r, g, b); | ||||
|     } else { | ||||
|     } | ||||
|     else { | ||||
|       fprintf(f, "rgba(%d, %d, %d, %d)", r, g, b, a); | ||||
|     } | ||||
|   }; | ||||
|  | @ -117,8 +121,13 @@ bool CssFormat::onSave(FileOp *fop) | |||
|             x, y, i); | ||||
|   }; | ||||
|   if (css_options->withVars) { | ||||
|     fprintf(f, ":root {\n\t--blur: 0px;\n\t--spread: 0px;\n\t--pixel-size: %dpx;\n\t--gutter-size: %dpx;\n", | ||||
|             css_options->pixelScale, css_options->gutterSize); | ||||
|     fprintf(f, ":root {\n" | ||||
|                "\t--blur: 0px;\n" | ||||
|                "\t--spread: 0px;\n" | ||||
|                "\t--pixel-size: %dpx;\n" | ||||
|                "\t--gutter-size: %dpx;\n", | ||||
|             css_options->pixelScale, | ||||
|             css_options->gutterSize); | ||||
|     fprintf(f, "\t--shadow-mult: calc(var(--gutter-size) + var(--pixel-size));\n"); | ||||
|     if (image->pixelFormat() == IMAGE_INDEXED) { | ||||
|       for (y = 0; y < 256; y++) { | ||||
|  | @ -245,10 +254,8 @@ FormatOptionsPtr CssFormat::onAskUserForFormatOptions(FileOp *fop) | |||
|   auto opts = fop->formatOptionsOfDocument<CssOptions>(); | ||||
| 
 | ||||
| #ifdef ENABLE_UI | ||||
|   if (fop->context() && fop->context()->isUIAvailable()) | ||||
|   { | ||||
|     try | ||||
|     { | ||||
|   if (fop->context() && fop->context()->isUIAvailable()) { | ||||
|     try { | ||||
|       auto &pref = Preferences::instance(); | ||||
| 
 | ||||
|       if (pref.isSet(pref.css.pixelScale)) | ||||
|  | @ -260,16 +267,14 @@ FormatOptionsPtr CssFormat::onAskUserForFormatOptions(FileOp *fop) | |||
|       if (pref.isSet(pref.css.generateHtml)) | ||||
|         opts->generateHtml = pref.css.generateHtml(); | ||||
| 
 | ||||
|       if (pref.css.showAlert()) | ||||
|       { | ||||
|       if (pref.css.showAlert()) { | ||||
|         app::gen::CssOptions win; | ||||
|         win.pixelScale()->setTextf("%d", opts->pixelScale); | ||||
|         win.withVars()->setSelected(opts->withVars); | ||||
|         win.generateHtml()->setSelected(opts->generateHtml); | ||||
|         win.openWindowInForeground(); | ||||
| 
 | ||||
|         if (win.closer() == win.ok()) | ||||
|         { | ||||
|         if (win.closer() == win.ok()) { | ||||
|           pref.css.showAlert(!win.dontShow()->isSelected()); | ||||
|           pref.css.pixelScale((int)win.pixelScale()->textInt()); | ||||
|           pref.css.withVars(win.withVars()->isSelected()); | ||||
|  | @ -279,14 +284,12 @@ FormatOptionsPtr CssFormat::onAskUserForFormatOptions(FileOp *fop) | |||
|           opts->withVars = pref.css.withVars(); | ||||
|           opts->pixelScale = pref.css.pixelScale(); | ||||
|         } | ||||
|         else | ||||
|         { | ||||
|         else { | ||||
|           opts.reset(); | ||||
|         } | ||||
|       } | ||||
|     } | ||||
|     catch (std::exception &e) | ||||
|     { | ||||
|     catch (std::exception &e) { | ||||
|       Console::showException(e); | ||||
|       return std::shared_ptr<CssOptions>(nullptr); | ||||
|     } | ||||
|  |  | |||
|  | @ -22,6 +22,7 @@ namespace app { | |||
| 
 | ||||
| extern FileFormat* CreateAseFormat(); | ||||
| extern FileFormat* CreateBmpFormat(); | ||||
| extern FileFormat* CreateCssFormat(); | ||||
| extern FileFormat* CreateFliFormat(); | ||||
| extern FileFormat* CreateGifFormat(); | ||||
| extern FileFormat* CreateIcoFormat(); | ||||
|  | @ -30,7 +31,6 @@ extern FileFormat* CreatePcxFormat(); | |||
| extern FileFormat* CreatePngFormat(); | ||||
| extern FileFormat* CreateSvgFormat(); | ||||
| extern FileFormat* CreateTgaFormat(); | ||||
| extern FileFormat* CreateCssFormat(); | ||||
| 
 | ||||
| #ifdef ASEPRITE_WITH_WEBP_SUPPORT | ||||
| extern FileFormat* CreateWebPFormat(); | ||||
|  | @ -58,6 +58,7 @@ FileFormatsManager::FileFormatsManager() | |||
|   // The first format is the default image format in FileSelector
 | ||||
|   registerFormat(CreateAseFormat()); | ||||
|   registerFormat(CreateBmpFormat()); | ||||
|   registerFormat(CreateCssFormat()); | ||||
|   registerFormat(CreateFliFormat()); | ||||
|   registerFormat(CreateGifFormat()); | ||||
|   registerFormat(CreateIcoFormat()); | ||||
|  | @ -66,7 +67,6 @@ FileFormatsManager::FileFormatsManager() | |||
|   registerFormat(CreatePngFormat()); | ||||
|   registerFormat(CreateSvgFormat()); | ||||
|   registerFormat(CreateTgaFormat()); | ||||
|   registerFormat(CreateCssFormat()); | ||||
| 
 | ||||
| #ifdef ASEPRITE_WITH_WEBP_SUPPORT | ||||
|   registerFormat(CreateWebPFormat()); | ||||
|  |  | |||
|  | @ -73,7 +73,10 @@ FileFormat* CreateSvgFormat() | |||
|   return new SvgFormat; | ||||
| } | ||||
| 
 | ||||
|   bool SvgFormat::onLoad(FileOp* fop) { return false;} | ||||
| bool SvgFormat::onLoad(FileOp* fop) | ||||
| { | ||||
|   return false; | ||||
| } | ||||
| 
 | ||||
| #ifdef ENABLE_SAVE | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue