| 1 | // Don't modify, generated file from /home/lucius/Code/aseprite/data/pref.xml |
| 2 | |
| 3 | #ifdef HAVE_CONFIG_H |
| 4 | #include "config.h" |
| 5 | #endif |
| 6 | |
| 7 | #include "app/pref/option_io.h" |
| 8 | #include "app/pref/preferences.h" |
| 9 | |
| 10 | #include <cstring> |
| 11 | |
| 12 | namespace app { |
| 13 | namespace gen { |
| 14 | |
| 15 | GlobalPref::GlobalPref(const std::string& name) |
| 16 | : Section(name) |
| 17 | , general(name) |
| 18 | , undo(name) |
| 19 | , editor(name) |
| 20 | , cels(name) |
| 21 | , layers(name) |
| 22 | , sprite(name) |
| 23 | , tags(name) |
| 24 | , timeline(name) |
| 25 | , cursor(name) |
| 26 | , preview(name) |
| 27 | , theme(name) |
| 28 | , tablet(name) |
| 29 | , experimental(name) |
| 30 | , news(name) |
| 31 | , statusBar(name) |
| 32 | , colorBar(name) |
| 33 | , updater(name) |
| 34 | , brush(name) |
| 35 | , saveBrush(name) |
| 36 | , selection(name) |
| 37 | , quantization(name) |
| 38 | , eyedropper(name) |
| 39 | , shared(name) |
| 40 | , newFile(name) |
| 41 | , fileSelector(name) |
| 42 | , textTool(name) |
| 43 | , symmetryMode(name) |
| 44 | , perf(name) |
| 45 | , guides(name) |
| 46 | , slices(name) |
| 47 | , advancedMode(name) |
| 48 | , openFile(name) |
| 49 | , saveFile(name) |
| 50 | , exportFile(name) |
| 51 | , spriteSheet(name) |
| 52 | , gif(name) |
| 53 | , jpeg(name) |
| 54 | , svg(name) |
| 55 | , tga(name) |
| 56 | , css(name) |
| 57 | , webp(name) |
| 58 | , hueSaturation(name) |
| 59 | , filters(name) |
| 60 | , scripts(name) |
| 61 | , color(name) |
| 62 | , canvasSize(name) |
| 63 | , tileset(name) |
| 64 | { |
| 65 | } |
| 66 | |
| 67 | void GlobalPref::load() |
| 68 | { |
| 69 | general.load(); |
| 70 | undo.load(); |
| 71 | editor.load(); |
| 72 | cels.load(); |
| 73 | layers.load(); |
| 74 | sprite.load(); |
| 75 | tags.load(); |
| 76 | timeline.load(); |
| 77 | cursor.load(); |
| 78 | preview.load(); |
| 79 | theme.load(); |
| 80 | tablet.load(); |
| 81 | experimental.load(); |
| 82 | news.load(); |
| 83 | statusBar.load(); |
| 84 | colorBar.load(); |
| 85 | updater.load(); |
| 86 | brush.load(); |
| 87 | saveBrush.load(); |
| 88 | selection.load(); |
| 89 | quantization.load(); |
| 90 | eyedropper.load(); |
| 91 | shared.load(); |
| 92 | newFile.load(); |
| 93 | fileSelector.load(); |
| 94 | textTool.load(); |
| 95 | symmetryMode.load(); |
| 96 | perf.load(); |
| 97 | guides.load(); |
| 98 | slices.load(); |
| 99 | advancedMode.load(); |
| 100 | openFile.load(); |
| 101 | saveFile.load(); |
| 102 | exportFile.load(); |
| 103 | spriteSheet.load(); |
| 104 | gif.load(); |
| 105 | jpeg.load(); |
| 106 | svg.load(); |
| 107 | tga.load(); |
| 108 | css.load(); |
| 109 | webp.load(); |
| 110 | hueSaturation.load(); |
| 111 | filters.load(); |
| 112 | scripts.load(); |
| 113 | color.load(); |
| 114 | canvasSize.load(); |
| 115 | tileset.load(); |
| 116 | } |
| 117 | |
| 118 | void GlobalPref::save() |
| 119 | { |
| 120 | general.save(); |
| 121 | undo.save(); |
| 122 | editor.save(); |
| 123 | cels.save(); |
| 124 | layers.save(); |
| 125 | sprite.save(); |
| 126 | tags.save(); |
| 127 | timeline.save(); |
| 128 | cursor.save(); |
| 129 | preview.save(); |
| 130 | theme.save(); |
| 131 | tablet.save(); |
| 132 | experimental.save(); |
| 133 | news.save(); |
| 134 | statusBar.save(); |
| 135 | colorBar.save(); |
| 136 | updater.save(); |
| 137 | brush.save(); |
| 138 | saveBrush.save(); |
| 139 | selection.save(); |
| 140 | quantization.save(); |
| 141 | eyedropper.save(); |
| 142 | shared.save(); |
| 143 | newFile.save(); |
| 144 | fileSelector.save(); |
| 145 | textTool.save(); |
| 146 | symmetryMode.save(); |
| 147 | perf.save(); |
| 148 | guides.save(); |
| 149 | slices.save(); |
| 150 | advancedMode.save(); |
| 151 | openFile.save(); |
| 152 | saveFile.save(); |
| 153 | exportFile.save(); |
| 154 | spriteSheet.save(); |
| 155 | gif.save(); |
| 156 | jpeg.save(); |
| 157 | svg.save(); |
| 158 | tga.save(); |
| 159 | css.save(); |
| 160 | webp.save(); |
| 161 | hueSaturation.save(); |
| 162 | filters.save(); |
| 163 | scripts.save(); |
| 164 | color.save(); |
| 165 | canvasSize.save(); |
| 166 | tileset.save(); |
| 167 | } |
| 168 | |
| 169 | Section* GlobalPref::section(const char* id) |
| 170 | { |
| 171 | if (std::strcmp(id, general.name()) == 0) return &general; |
| 172 | if (std::strcmp(id, undo.name()) == 0) return &undo; |
| 173 | if (std::strcmp(id, editor.name()) == 0) return &editor; |
| 174 | if (std::strcmp(id, cels.name()) == 0) return &cels; |
| 175 | if (std::strcmp(id, layers.name()) == 0) return &layers; |
| 176 | if (std::strcmp(id, sprite.name()) == 0) return &sprite; |
| 177 | if (std::strcmp(id, tags.name()) == 0) return &tags; |
| 178 | if (std::strcmp(id, timeline.name()) == 0) return &timeline; |
| 179 | if (std::strcmp(id, cursor.name()) == 0) return &cursor; |
| 180 | if (std::strcmp(id, preview.name()) == 0) return &preview; |
| 181 | if (std::strcmp(id, theme.name()) == 0) return &theme; |
| 182 | if (std::strcmp(id, tablet.name()) == 0) return &tablet; |
| 183 | if (std::strcmp(id, experimental.name()) == 0) return &experimental; |
| 184 | if (std::strcmp(id, news.name()) == 0) return &news; |
| 185 | if (std::strcmp(id, statusBar.name()) == 0) return &statusBar; |
| 186 | if (std::strcmp(id, colorBar.name()) == 0) return &colorBar; |
| 187 | if (std::strcmp(id, updater.name()) == 0) return &updater; |
| 188 | if (std::strcmp(id, brush.name()) == 0) return &brush; |
| 189 | if (std::strcmp(id, saveBrush.name()) == 0) return &saveBrush; |
| 190 | if (std::strcmp(id, selection.name()) == 0) return &selection; |
| 191 | if (std::strcmp(id, quantization.name()) == 0) return &quantization; |
| 192 | if (std::strcmp(id, eyedropper.name()) == 0) return &eyedropper; |
| 193 | if (std::strcmp(id, shared.name()) == 0) return &shared; |
| 194 | if (std::strcmp(id, newFile.name()) == 0) return &newFile; |
| 195 | if (std::strcmp(id, fileSelector.name()) == 0) return &fileSelector; |
| 196 | if (std::strcmp(id, textTool.name()) == 0) return &textTool; |
| 197 | if (std::strcmp(id, symmetryMode.name()) == 0) return &symmetryMode; |
| 198 | if (std::strcmp(id, perf.name()) == 0) return &perf; |
| 199 | if (std::strcmp(id, guides.name()) == 0) return &guides; |
| 200 | if (std::strcmp(id, slices.name()) == 0) return &slices; |
| 201 | if (std::strcmp(id, advancedMode.name()) == 0) return &advancedMode; |
| 202 | if (std::strcmp(id, openFile.name()) == 0) return &openFile; |
| 203 | if (std::strcmp(id, saveFile.name()) == 0) return &saveFile; |
| 204 | if (std::strcmp(id, exportFile.name()) == 0) return &exportFile; |
| 205 | if (std::strcmp(id, spriteSheet.name()) == 0) return &spriteSheet; |
| 206 | if (std::strcmp(id, gif.name()) == 0) return &gif; |
| 207 | if (std::strcmp(id, jpeg.name()) == 0) return &jpeg; |
| 208 | if (std::strcmp(id, svg.name()) == 0) return &svg; |
| 209 | if (std::strcmp(id, tga.name()) == 0) return &tga; |
| 210 | if (std::strcmp(id, css.name()) == 0) return &css; |
| 211 | if (std::strcmp(id, webp.name()) == 0) return &webp; |
| 212 | if (std::strcmp(id, hueSaturation.name()) == 0) return &hueSaturation; |
| 213 | if (std::strcmp(id, filters.name()) == 0) return &filters; |
| 214 | if (std::strcmp(id, scripts.name()) == 0) return &scripts; |
| 215 | if (std::strcmp(id, color.name()) == 0) return &color; |
| 216 | if (std::strcmp(id, canvasSize.name()) == 0) return &canvasSize; |
| 217 | if (std::strcmp(id, tileset.name()) == 0) return &tileset; |
| 218 | return nullptr; |
| 219 | } |
| 220 | |
| 221 | OptionBase* GlobalPref::option(const char* id) |
| 222 | { |
| 223 | return nullptr; |
| 224 | } |
| 225 | |
| 226 | GlobalPref::General::General(const std::string& name) |
| 227 | : Section(std::string(!name.empty() ? name + "." : "" ) + "general" ) |
| 228 | , language(this, "language" , "en" ) |
| 229 | , screenScale(this, "screen_scale" , 0) |
| 230 | , uiScale(this, "ui_scale" , 1) |
| 231 | , gpuAcceleration(this, "gpu_acceleration" , false) |
| 232 | , showHome(this, "show_home" , true) |
| 233 | , visibleTimeline(this, "visible_timeline" , false) |
| 234 | , autoshowTimeline(this, "autoshow_timeline" , true) |
| 235 | , rewindOnStop(this, "rewind_on_stop" , false) |
| 236 | , expandMenubarOnMouseover(this, "expand_menubar_on_mouseover" , false) |
| 237 | , dataRecovery(this, "data_recovery" , true) |
| 238 | , dataRecoveryPeriod(this, "data_recovery_period" , 2.0) |
| 239 | , keepEditedSpriteData(this, "keep_edited_sprite_data" , true) |
| 240 | , keepEditedSpriteDataFor(this, "keep_edited_sprite_data_for" , 7) |
| 241 | , keepClosedSpriteOnMemory(this, "keep_closed_sprite_on_memory" , true) |
| 242 | , keepClosedSpriteOnMemoryFor(this, "keep_closed_sprite_on_memory_for" , 15.0) |
| 243 | , showFullPath(this, "show_full_path" , true) |
| 244 | , timelinePosition(this, "timeline_position" , TimelinePosition::BOTTOM) |
| 245 | , timelineLayerPanelWidth(this, "timeline_layer_panel_width" , 100) |
| 246 | , showMenuBar(this, "show_menu_bar" , true) |
| 247 | , recentItems(this, "recent_items" , 16) |
| 248 | , osxAsyncView(this, "osx_async_view" , true) |
| 249 | , x11StylusId(this, "x11_stylus_id" ) |
| 250 | { |
| 251 | } |
| 252 | |
| 253 | void GlobalPref::General::load() |
| 254 | { |
| 255 | load_option(language); |
| 256 | load_option(screenScale); |
| 257 | load_option(uiScale); |
| 258 | load_option(gpuAcceleration); |
| 259 | load_option(showHome); |
| 260 | load_option(visibleTimeline); |
| 261 | load_option(autoshowTimeline); |
| 262 | load_option(rewindOnStop); |
| 263 | load_option(expandMenubarOnMouseover); |
| 264 | load_option(dataRecovery); |
| 265 | load_option(dataRecoveryPeriod); |
| 266 | load_option(keepEditedSpriteData); |
| 267 | load_option(keepEditedSpriteDataFor); |
| 268 | load_option(keepClosedSpriteOnMemory); |
| 269 | load_option(keepClosedSpriteOnMemoryFor); |
| 270 | load_option(showFullPath); |
| 271 | load_option(timelinePosition); |
| 272 | load_option(timelineLayerPanelWidth); |
| 273 | load_option(showMenuBar); |
| 274 | load_option(recentItems); |
| 275 | load_option(osxAsyncView); |
| 276 | load_option(x11StylusId); |
| 277 | } |
| 278 | |
| 279 | void GlobalPref::General::save() |
| 280 | { |
| 281 | save_option(language); |
| 282 | save_option(screenScale); |
| 283 | save_option(uiScale); |
| 284 | save_option(gpuAcceleration); |
| 285 | save_option(showHome); |
| 286 | save_option(visibleTimeline); |
| 287 | save_option(autoshowTimeline); |
| 288 | save_option(rewindOnStop); |
| 289 | save_option(expandMenubarOnMouseover); |
| 290 | save_option(dataRecovery); |
| 291 | save_option(dataRecoveryPeriod); |
| 292 | save_option(keepEditedSpriteData); |
| 293 | save_option(keepEditedSpriteDataFor); |
| 294 | save_option(keepClosedSpriteOnMemory); |
| 295 | save_option(keepClosedSpriteOnMemoryFor); |
| 296 | save_option(showFullPath); |
| 297 | save_option(timelinePosition); |
| 298 | save_option(timelineLayerPanelWidth); |
| 299 | save_option(showMenuBar); |
| 300 | save_option(recentItems); |
| 301 | save_option(osxAsyncView); |
| 302 | save_option(x11StylusId); |
| 303 | } |
| 304 | |
| 305 | Section* GlobalPref::General::section(const char* id) |
| 306 | { |
| 307 | return nullptr; |
| 308 | } |
| 309 | |
| 310 | OptionBase* GlobalPref::General::option(const char* id) |
| 311 | { |
| 312 | if (std::strcmp(id, language.id()) == 0) return &language; |
| 313 | if (std::strcmp(id, screenScale.id()) == 0) return &screenScale; |
| 314 | if (std::strcmp(id, uiScale.id()) == 0) return &uiScale; |
| 315 | if (std::strcmp(id, gpuAcceleration.id()) == 0) return &gpuAcceleration; |
| 316 | if (std::strcmp(id, showHome.id()) == 0) return &showHome; |
| 317 | if (std::strcmp(id, visibleTimeline.id()) == 0) return &visibleTimeline; |
| 318 | if (std::strcmp(id, autoshowTimeline.id()) == 0) return &autoshowTimeline; |
| 319 | if (std::strcmp(id, rewindOnStop.id()) == 0) return &rewindOnStop; |
| 320 | if (std::strcmp(id, expandMenubarOnMouseover.id()) == 0) return &expandMenubarOnMouseover; |
| 321 | if (std::strcmp(id, dataRecovery.id()) == 0) return &dataRecovery; |
| 322 | if (std::strcmp(id, dataRecoveryPeriod.id()) == 0) return &dataRecoveryPeriod; |
| 323 | if (std::strcmp(id, keepEditedSpriteData.id()) == 0) return &keepEditedSpriteData; |
| 324 | if (std::strcmp(id, keepEditedSpriteDataFor.id()) == 0) return &keepEditedSpriteDataFor; |
| 325 | if (std::strcmp(id, keepClosedSpriteOnMemory.id()) == 0) return &keepClosedSpriteOnMemory; |
| 326 | if (std::strcmp(id, keepClosedSpriteOnMemoryFor.id()) == 0) return &keepClosedSpriteOnMemoryFor; |
| 327 | if (std::strcmp(id, showFullPath.id()) == 0) return &showFullPath; |
| 328 | if (std::strcmp(id, timelinePosition.id()) == 0) return &timelinePosition; |
| 329 | if (std::strcmp(id, timelineLayerPanelWidth.id()) == 0) return &timelineLayerPanelWidth; |
| 330 | if (std::strcmp(id, showMenuBar.id()) == 0) return &showMenuBar; |
| 331 | if (std::strcmp(id, recentItems.id()) == 0) return &recentItems; |
| 332 | if (std::strcmp(id, osxAsyncView.id()) == 0) return &osxAsyncView; |
| 333 | if (std::strcmp(id, x11StylusId.id()) == 0) return &x11StylusId; |
| 334 | return nullptr; |
| 335 | } |
| 336 | |
| 337 | GlobalPref::Undo::Undo(const std::string& name) |
| 338 | : Section(std::string(!name.empty() ? name + "." : "" ) + "undo" ) |
| 339 | , sizeLimit(this, "size_limit" , 0) |
| 340 | , gotoModified(this, "goto_modified" , true) |
| 341 | , allowNonlinearHistory(this, "allow_nonlinear_history" , false) |
| 342 | , showTooltip(this, "show_tooltip" , true) |
| 343 | { |
| 344 | } |
| 345 | |
| 346 | void GlobalPref::Undo::load() |
| 347 | { |
| 348 | load_option(sizeLimit); |
| 349 | load_option(gotoModified); |
| 350 | load_option(allowNonlinearHistory); |
| 351 | load_option(showTooltip); |
| 352 | } |
| 353 | |
| 354 | void GlobalPref::Undo::save() |
| 355 | { |
| 356 | save_option(sizeLimit); |
| 357 | save_option(gotoModified); |
| 358 | save_option(allowNonlinearHistory); |
| 359 | save_option(showTooltip); |
| 360 | } |
| 361 | |
| 362 | Section* GlobalPref::Undo::section(const char* id) |
| 363 | { |
| 364 | return nullptr; |
| 365 | } |
| 366 | |
| 367 | OptionBase* GlobalPref::Undo::option(const char* id) |
| 368 | { |
| 369 | if (std::strcmp(id, sizeLimit.id()) == 0) return &sizeLimit; |
| 370 | if (std::strcmp(id, gotoModified.id()) == 0) return &gotoModified; |
| 371 | if (std::strcmp(id, allowNonlinearHistory.id()) == 0) return &allowNonlinearHistory; |
| 372 | if (std::strcmp(id, showTooltip.id()) == 0) return &showTooltip; |
| 373 | return nullptr; |
| 374 | } |
| 375 | |
| 376 | GlobalPref::Editor::Editor(const std::string& name) |
| 377 | : Section(std::string(!name.empty() ? name + "." : "" ) + "editor" ) |
| 378 | , zoomWithWheel(this, "zoom_with_wheel" , true) |
| 379 | , zoomWithSlide(this, "zoom_with_slide" , false) |
| 380 | , zoomFromCenterWithWheel(this, "zoom_from_center_with_wheel" , false) |
| 381 | , zoomFromCenterWithKeys(this, "zoom_from_center_with_keys" , false) |
| 382 | , invertBrushSizeWheel(this, "invert_brush_size_wheel" , false) |
| 383 | , showScrollbars(this, "show_scrollbars" , true) |
| 384 | , autoScroll(this, "auto_scroll" , true) |
| 385 | , rightClickMode(this, "right_click_mode" , RightClickMode::PAINT_BGCOLOR) |
| 386 | , autoSelectLayer(this, "auto_select_layer" , false) |
| 387 | , autoSelectLayerQuick(this, "auto_select_layer_quick" , true) |
| 388 | , straightLinePreview(this, "straight_line_preview" , true) |
| 389 | , playOnce(this, "play_once" , false) |
| 390 | , playAll(this, "play_all" , false) |
| 391 | , autoFit(this, "auto_fit" , false) |
| 392 | , downsampling(this, "downsampling" , Downsampling::BILINEAR_MIPMAP) |
| 393 | { |
| 394 | } |
| 395 | |
| 396 | void GlobalPref::Editor::load() |
| 397 | { |
| 398 | load_option(zoomWithWheel); |
| 399 | load_option(zoomWithSlide); |
| 400 | load_option(zoomFromCenterWithWheel); |
| 401 | load_option(zoomFromCenterWithKeys); |
| 402 | load_option(invertBrushSizeWheel); |
| 403 | load_option(showScrollbars); |
| 404 | load_option(autoScroll); |
| 405 | load_option(rightClickMode); |
| 406 | load_option(autoSelectLayer); |
| 407 | load_option(autoSelectLayerQuick); |
| 408 | load_option(straightLinePreview); |
| 409 | load_option(playOnce); |
| 410 | load_option(playAll); |
| 411 | load_option(autoFit); |
| 412 | load_option(downsampling); |
| 413 | } |
| 414 | |
| 415 | void GlobalPref::Editor::save() |
| 416 | { |
| 417 | save_option(zoomWithWheel); |
| 418 | save_option(zoomWithSlide); |
| 419 | save_option(zoomFromCenterWithWheel); |
| 420 | save_option(zoomFromCenterWithKeys); |
| 421 | save_option(invertBrushSizeWheel); |
| 422 | save_option(showScrollbars); |
| 423 | save_option(autoScroll); |
| 424 | save_option(rightClickMode); |
| 425 | save_option(autoSelectLayer); |
| 426 | save_option(autoSelectLayerQuick); |
| 427 | save_option(straightLinePreview); |
| 428 | save_option(playOnce); |
| 429 | save_option(playAll); |
| 430 | save_option(autoFit); |
| 431 | save_option(downsampling); |
| 432 | } |
| 433 | |
| 434 | Section* GlobalPref::Editor::section(const char* id) |
| 435 | { |
| 436 | return nullptr; |
| 437 | } |
| 438 | |
| 439 | OptionBase* GlobalPref::Editor::option(const char* id) |
| 440 | { |
| 441 | if (std::strcmp(id, zoomWithWheel.id()) == 0) return &zoomWithWheel; |
| 442 | if (std::strcmp(id, zoomWithSlide.id()) == 0) return &zoomWithSlide; |
| 443 | if (std::strcmp(id, zoomFromCenterWithWheel.id()) == 0) return &zoomFromCenterWithWheel; |
| 444 | if (std::strcmp(id, zoomFromCenterWithKeys.id()) == 0) return &zoomFromCenterWithKeys; |
| 445 | if (std::strcmp(id, invertBrushSizeWheel.id()) == 0) return &invertBrushSizeWheel; |
| 446 | if (std::strcmp(id, showScrollbars.id()) == 0) return &showScrollbars; |
| 447 | if (std::strcmp(id, autoScroll.id()) == 0) return &autoScroll; |
| 448 | if (std::strcmp(id, rightClickMode.id()) == 0) return &rightClickMode; |
| 449 | if (std::strcmp(id, autoSelectLayer.id()) == 0) return &autoSelectLayer; |
| 450 | if (std::strcmp(id, autoSelectLayerQuick.id()) == 0) return &autoSelectLayerQuick; |
| 451 | if (std::strcmp(id, straightLinePreview.id()) == 0) return &straightLinePreview; |
| 452 | if (std::strcmp(id, playOnce.id()) == 0) return &playOnce; |
| 453 | if (std::strcmp(id, playAll.id()) == 0) return &playAll; |
| 454 | if (std::strcmp(id, autoFit.id()) == 0) return &autoFit; |
| 455 | if (std::strcmp(id, downsampling.id()) == 0) return &downsampling; |
| 456 | return nullptr; |
| 457 | } |
| 458 | |
| 459 | GlobalPref::Cels::Cels(const std::string& name) |
| 460 | : Section(std::string(!name.empty() ? name + "." : "" ) + "cels" ) |
| 461 | , userDataVisibility(this, "user_data_visibility" , false) |
| 462 | { |
| 463 | } |
| 464 | |
| 465 | void GlobalPref::Cels::load() |
| 466 | { |
| 467 | load_option(userDataVisibility); |
| 468 | } |
| 469 | |
| 470 | void GlobalPref::Cels::save() |
| 471 | { |
| 472 | save_option(userDataVisibility); |
| 473 | } |
| 474 | |
| 475 | Section* GlobalPref::Cels::section(const char* id) |
| 476 | { |
| 477 | return nullptr; |
| 478 | } |
| 479 | |
| 480 | OptionBase* GlobalPref::Cels::option(const char* id) |
| 481 | { |
| 482 | if (std::strcmp(id, userDataVisibility.id()) == 0) return &userDataVisibility; |
| 483 | return nullptr; |
| 484 | } |
| 485 | |
| 486 | GlobalPref::Layers::Layers(const std::string& name) |
| 487 | : Section(std::string(!name.empty() ? name + "." : "" ) + "layers" ) |
| 488 | , userDataVisibility(this, "user_data_visibility" , false) |
| 489 | { |
| 490 | } |
| 491 | |
| 492 | void GlobalPref::Layers::load() |
| 493 | { |
| 494 | load_option(userDataVisibility); |
| 495 | } |
| 496 | |
| 497 | void GlobalPref::Layers::save() |
| 498 | { |
| 499 | save_option(userDataVisibility); |
| 500 | } |
| 501 | |
| 502 | Section* GlobalPref::Layers::section(const char* id) |
| 503 | { |
| 504 | return nullptr; |
| 505 | } |
| 506 | |
| 507 | OptionBase* GlobalPref::Layers::option(const char* id) |
| 508 | { |
| 509 | if (std::strcmp(id, userDataVisibility.id()) == 0) return &userDataVisibility; |
| 510 | return nullptr; |
| 511 | } |
| 512 | |
| 513 | GlobalPref::Sprite::Sprite(const std::string& name) |
| 514 | : Section(std::string(!name.empty() ? name + "." : "" ) + "sprite" ) |
| 515 | , userDataVisibility(this, "user_data_visibility" , false) |
| 516 | { |
| 517 | } |
| 518 | |
| 519 | void GlobalPref::Sprite::load() |
| 520 | { |
| 521 | load_option(userDataVisibility); |
| 522 | } |
| 523 | |
| 524 | void GlobalPref::Sprite::save() |
| 525 | { |
| 526 | save_option(userDataVisibility); |
| 527 | } |
| 528 | |
| 529 | Section* GlobalPref::Sprite::section(const char* id) |
| 530 | { |
| 531 | return nullptr; |
| 532 | } |
| 533 | |
| 534 | OptionBase* GlobalPref::Sprite::option(const char* id) |
| 535 | { |
| 536 | if (std::strcmp(id, userDataVisibility.id()) == 0) return &userDataVisibility; |
| 537 | return nullptr; |
| 538 | } |
| 539 | |
| 540 | GlobalPref::Tags::Tags(const std::string& name) |
| 541 | : Section(std::string(!name.empty() ? name + "." : "" ) + "tags" ) |
| 542 | , userDataVisibility(this, "user_data_visibility" , false) |
| 543 | { |
| 544 | } |
| 545 | |
| 546 | void GlobalPref::Tags::load() |
| 547 | { |
| 548 | load_option(userDataVisibility); |
| 549 | } |
| 550 | |
| 551 | void GlobalPref::Tags::save() |
| 552 | { |
| 553 | save_option(userDataVisibility); |
| 554 | } |
| 555 | |
| 556 | Section* GlobalPref::Tags::section(const char* id) |
| 557 | { |
| 558 | return nullptr; |
| 559 | } |
| 560 | |
| 561 | OptionBase* GlobalPref::Tags::option(const char* id) |
| 562 | { |
| 563 | if (std::strcmp(id, userDataVisibility.id()) == 0) return &userDataVisibility; |
| 564 | return nullptr; |
| 565 | } |
| 566 | |
| 567 | GlobalPref::Timeline::Timeline(const std::string& name) |
| 568 | : Section(std::string(!name.empty() ? name + "." : "" ) + "timeline" ) |
| 569 | , keepSelection(this, "keep_selection" , false) |
| 570 | { |
| 571 | } |
| 572 | |
| 573 | void GlobalPref::Timeline::load() |
| 574 | { |
| 575 | load_option(keepSelection); |
| 576 | } |
| 577 | |
| 578 | void GlobalPref::Timeline::save() |
| 579 | { |
| 580 | save_option(keepSelection); |
| 581 | } |
| 582 | |
| 583 | Section* GlobalPref::Timeline::section(const char* id) |
| 584 | { |
| 585 | return nullptr; |
| 586 | } |
| 587 | |
| 588 | OptionBase* GlobalPref::Timeline::option(const char* id) |
| 589 | { |
| 590 | if (std::strcmp(id, keepSelection.id()) == 0) return &keepSelection; |
| 591 | return nullptr; |
| 592 | } |
| 593 | |
| 594 | GlobalPref::Cursor::Cursor(const std::string& name) |
| 595 | : Section(std::string(!name.empty() ? name + "." : "" ) + "cursor" ) |
| 596 | , useNativeCursor(this, "use_native_cursor" , false) |
| 597 | , cursorScale(this, "cursor_scale" , 1) |
| 598 | , cursorColor(this, "cursor_color" , app::Color::fromMask()) |
| 599 | , paintingCursorType(this, "painting_cursor_type" , PaintingCursorType::CROSSHAIR_ON_SPRITE) |
| 600 | , brushPreview(this, "brush_preview" , BrushPreview::FULL) |
| 601 | { |
| 602 | } |
| 603 | |
| 604 | void GlobalPref::Cursor::load() |
| 605 | { |
| 606 | load_option(useNativeCursor); |
| 607 | load_option(cursorScale); |
| 608 | load_option(cursorColor); |
| 609 | load_option(paintingCursorType); |
| 610 | load_option(brushPreview); |
| 611 | } |
| 612 | |
| 613 | void GlobalPref::Cursor::save() |
| 614 | { |
| 615 | save_option(useNativeCursor); |
| 616 | save_option(cursorScale); |
| 617 | save_option(cursorColor); |
| 618 | save_option(paintingCursorType); |
| 619 | save_option(brushPreview); |
| 620 | } |
| 621 | |
| 622 | Section* GlobalPref::Cursor::section(const char* id) |
| 623 | { |
| 624 | return nullptr; |
| 625 | } |
| 626 | |
| 627 | OptionBase* GlobalPref::Cursor::option(const char* id) |
| 628 | { |
| 629 | if (std::strcmp(id, useNativeCursor.id()) == 0) return &useNativeCursor; |
| 630 | if (std::strcmp(id, cursorScale.id()) == 0) return &cursorScale; |
| 631 | if (std::strcmp(id, cursorColor.id()) == 0) return &cursorColor; |
| 632 | if (std::strcmp(id, paintingCursorType.id()) == 0) return &paintingCursorType; |
| 633 | if (std::strcmp(id, brushPreview.id()) == 0) return &brushPreview; |
| 634 | return nullptr; |
| 635 | } |
| 636 | |
| 637 | GlobalPref::Preview::Preview(const std::string& name) |
| 638 | : Section(std::string(!name.empty() ? name + "." : "" ) + "preview" ) |
| 639 | , playOnce(this, "play_once" , false) |
| 640 | , playAll(this, "play_all" , false) |
| 641 | { |
| 642 | } |
| 643 | |
| 644 | void GlobalPref::Preview::load() |
| 645 | { |
| 646 | load_option(playOnce); |
| 647 | load_option(playAll); |
| 648 | } |
| 649 | |
| 650 | void GlobalPref::Preview::save() |
| 651 | { |
| 652 | save_option(playOnce); |
| 653 | save_option(playAll); |
| 654 | } |
| 655 | |
| 656 | Section* GlobalPref::Preview::section(const char* id) |
| 657 | { |
| 658 | return nullptr; |
| 659 | } |
| 660 | |
| 661 | OptionBase* GlobalPref::Preview::option(const char* id) |
| 662 | { |
| 663 | if (std::strcmp(id, playOnce.id()) == 0) return &playOnce; |
| 664 | if (std::strcmp(id, playAll.id()) == 0) return &playAll; |
| 665 | return nullptr; |
| 666 | } |
| 667 | |
| 668 | GlobalPref::Theme::Theme(const std::string& name) |
| 669 | : Section(std::string(!name.empty() ? name + "." : "" ) + "theme" ) |
| 670 | , selected(this, "selected" , "default" ) |
| 671 | , font(this, "font" ) |
| 672 | , miniFont(this, "mini_font" ) |
| 673 | { |
| 674 | } |
| 675 | |
| 676 | void GlobalPref::Theme::load() |
| 677 | { |
| 678 | load_option(selected); |
| 679 | load_option(font); |
| 680 | load_option(miniFont); |
| 681 | } |
| 682 | |
| 683 | void GlobalPref::Theme::save() |
| 684 | { |
| 685 | save_option(selected); |
| 686 | save_option(font); |
| 687 | save_option(miniFont); |
| 688 | } |
| 689 | |
| 690 | Section* GlobalPref::Theme::section(const char* id) |
| 691 | { |
| 692 | return nullptr; |
| 693 | } |
| 694 | |
| 695 | OptionBase* GlobalPref::Theme::option(const char* id) |
| 696 | { |
| 697 | if (std::strcmp(id, selected.id()) == 0) return &selected; |
| 698 | if (std::strcmp(id, font.id()) == 0) return &font; |
| 699 | if (std::strcmp(id, miniFont.id()) == 0) return &miniFont; |
| 700 | return nullptr; |
| 701 | } |
| 702 | |
| 703 | GlobalPref::Tablet::Tablet(const std::string& name) |
| 704 | : Section(std::string(!name.empty() ? name + "." : "" ) + "tablet" ) |
| 705 | , api(this, "api" ) |
| 706 | { |
| 707 | } |
| 708 | |
| 709 | void GlobalPref::Tablet::load() |
| 710 | { |
| 711 | load_option(api); |
| 712 | } |
| 713 | |
| 714 | void GlobalPref::Tablet::save() |
| 715 | { |
| 716 | save_option(api); |
| 717 | } |
| 718 | |
| 719 | Section* GlobalPref::Tablet::section(const char* id) |
| 720 | { |
| 721 | return nullptr; |
| 722 | } |
| 723 | |
| 724 | OptionBase* GlobalPref::Tablet::option(const char* id) |
| 725 | { |
| 726 | if (std::strcmp(id, api.id()) == 0) return &api; |
| 727 | return nullptr; |
| 728 | } |
| 729 | |
| 730 | GlobalPref::Experimental::Experimental(const std::string& name) |
| 731 | : Section(std::string(!name.empty() ? name + "." : "" ) + "experimental" ) |
| 732 | , multipleWindows(this, "multiple_windows" , false) |
| 733 | , newRenderEngine(this, "new_render_engine" , true) |
| 734 | , newBlend(this, "new_blend" , true) |
| 735 | , useNativeClipboard(this, "use_native_clipboard" , true) |
| 736 | , useNativeFileDialog(this, "use_native_file_dialog" , false) |
| 737 | , useShadersForColorSelectors(this, "use_shaders_for_color_selectors" , true) |
| 738 | , hueWithSatValueForColorSelector(this, "hue_with_sat_value_for_color_selector" , false) |
| 739 | , oneFingerAsMouseMovement(this, "one_finger_as_mouse_movement" , true) |
| 740 | , loadWintabDriver(this, "load_wintab_driver" , false) |
| 741 | , flashLayer(this, "flash_layer" , false) |
| 742 | , nonactiveLayersOpacity(this, "nonactive_layers_opacity" , 255) |
| 743 | { |
| 744 | } |
| 745 | |
| 746 | void GlobalPref::Experimental::load() |
| 747 | { |
| 748 | load_option(multipleWindows); |
| 749 | load_option(newRenderEngine); |
| 750 | load_option(newBlend); |
| 751 | load_option(useNativeClipboard); |
| 752 | load_option(useNativeFileDialog); |
| 753 | load_option(useShadersForColorSelectors); |
| 754 | load_option(hueWithSatValueForColorSelector); |
| 755 | load_option(oneFingerAsMouseMovement); |
| 756 | load_option(loadWintabDriver); |
| 757 | load_option(flashLayer); |
| 758 | load_option(nonactiveLayersOpacity); |
| 759 | } |
| 760 | |
| 761 | void GlobalPref::Experimental::save() |
| 762 | { |
| 763 | save_option(multipleWindows); |
| 764 | save_option(newRenderEngine); |
| 765 | save_option(newBlend); |
| 766 | save_option(useNativeClipboard); |
| 767 | save_option(useNativeFileDialog); |
| 768 | save_option(useShadersForColorSelectors); |
| 769 | save_option(hueWithSatValueForColorSelector); |
| 770 | save_option(oneFingerAsMouseMovement); |
| 771 | save_option(loadWintabDriver); |
| 772 | save_option(flashLayer); |
| 773 | save_option(nonactiveLayersOpacity); |
| 774 | } |
| 775 | |
| 776 | Section* GlobalPref::Experimental::section(const char* id) |
| 777 | { |
| 778 | return nullptr; |
| 779 | } |
| 780 | |
| 781 | OptionBase* GlobalPref::Experimental::option(const char* id) |
| 782 | { |
| 783 | if (std::strcmp(id, multipleWindows.id()) == 0) return &multipleWindows; |
| 784 | if (std::strcmp(id, newRenderEngine.id()) == 0) return &newRenderEngine; |
| 785 | if (std::strcmp(id, newBlend.id()) == 0) return &newBlend; |
| 786 | if (std::strcmp(id, useNativeClipboard.id()) == 0) return &useNativeClipboard; |
| 787 | if (std::strcmp(id, useNativeFileDialog.id()) == 0) return &useNativeFileDialog; |
| 788 | if (std::strcmp(id, useShadersForColorSelectors.id()) == 0) return &useShadersForColorSelectors; |
| 789 | if (std::strcmp(id, hueWithSatValueForColorSelector.id()) == 0) return &hueWithSatValueForColorSelector; |
| 790 | if (std::strcmp(id, oneFingerAsMouseMovement.id()) == 0) return &oneFingerAsMouseMovement; |
| 791 | if (std::strcmp(id, loadWintabDriver.id()) == 0) return &loadWintabDriver; |
| 792 | if (std::strcmp(id, flashLayer.id()) == 0) return &flashLayer; |
| 793 | if (std::strcmp(id, nonactiveLayersOpacity.id()) == 0) return &nonactiveLayersOpacity; |
| 794 | return nullptr; |
| 795 | } |
| 796 | |
| 797 | GlobalPref::News::News(const std::string& name) |
| 798 | : Section(std::string(!name.empty() ? name + "." : "" ) + "news" ) |
| 799 | , cacheFile(this, "cache_file" ) |
| 800 | { |
| 801 | } |
| 802 | |
| 803 | void GlobalPref::News::load() |
| 804 | { |
| 805 | load_option(cacheFile); |
| 806 | } |
| 807 | |
| 808 | void GlobalPref::News::save() |
| 809 | { |
| 810 | save_option(cacheFile); |
| 811 | } |
| 812 | |
| 813 | Section* GlobalPref::News::section(const char* id) |
| 814 | { |
| 815 | return nullptr; |
| 816 | } |
| 817 | |
| 818 | OptionBase* GlobalPref::News::option(const char* id) |
| 819 | { |
| 820 | if (std::strcmp(id, cacheFile.id()) == 0) return &cacheFile; |
| 821 | return nullptr; |
| 822 | } |
| 823 | |
| 824 | GlobalPref::StatusBar::StatusBar(const std::string& name) |
| 825 | : Section(std::string(!name.empty() ? name + "." : "" ) + "status_bar" ) |
| 826 | , focusFrameFieldOnMouseover(this, "focus_frame_field_on_mouseover" , false) |
| 827 | { |
| 828 | } |
| 829 | |
| 830 | void GlobalPref::StatusBar::load() |
| 831 | { |
| 832 | load_option(focusFrameFieldOnMouseover); |
| 833 | } |
| 834 | |
| 835 | void GlobalPref::StatusBar::save() |
| 836 | { |
| 837 | save_option(focusFrameFieldOnMouseover); |
| 838 | } |
| 839 | |
| 840 | Section* GlobalPref::StatusBar::section(const char* id) |
| 841 | { |
| 842 | return nullptr; |
| 843 | } |
| 844 | |
| 845 | OptionBase* GlobalPref::StatusBar::option(const char* id) |
| 846 | { |
| 847 | if (std::strcmp(id, focusFrameFieldOnMouseover.id()) == 0) return &focusFrameFieldOnMouseover; |
| 848 | return nullptr; |
| 849 | } |
| 850 | |
| 851 | GlobalPref::ColorBar::ColorBar(const std::string& name) |
| 852 | : Section(std::string(!name.empty() ? name + "." : "" ) + "color_bar" ) |
| 853 | , boxSize(this, "box_size" , 11) |
| 854 | , tilesBoxSize(this, "tiles_box_size" , 16) |
| 855 | , fgColor(this, "fg_color" , app::Color::fromRgb(255, 255, 255)) |
| 856 | , bgColor(this, "bg_color" , app::Color::fromRgb(0, 0, 0)) |
| 857 | , fgTile(this, "fg_tile" , doc::notile) |
| 858 | , bgTile(this, "bg_tile" , doc::notile) |
| 859 | , selector(this, "selector" , app::ColorBar::ColorSelector::TINT_SHADE_TONE) |
| 860 | , discreteWheel(this, "discrete_wheel" , false) |
| 861 | , wheelModel(this, "wheel_model" , 0) |
| 862 | , harmony(this, "harmony" , 0) |
| 863 | , showInvalidFgBgColorAlert(this, "show_invalid_fg_bg_color_alert" , true) |
| 864 | , entriesSeparator(this, "entries_separator" , true) |
| 865 | , showColorAndTiles(this, "show_color_and_tiles" , true) |
| 866 | { |
| 867 | } |
| 868 | |
| 869 | void GlobalPref::ColorBar::load() |
| 870 | { |
| 871 | load_option(boxSize); |
| 872 | load_option(tilesBoxSize); |
| 873 | load_option(fgColor); |
| 874 | load_option(bgColor); |
| 875 | load_option(fgTile); |
| 876 | load_option(bgTile); |
| 877 | load_option(selector); |
| 878 | load_option(discreteWheel); |
| 879 | load_option(wheelModel); |
| 880 | load_option(harmony); |
| 881 | load_option(showInvalidFgBgColorAlert); |
| 882 | load_option(entriesSeparator); |
| 883 | load_option(showColorAndTiles); |
| 884 | } |
| 885 | |
| 886 | void GlobalPref::ColorBar::save() |
| 887 | { |
| 888 | save_option(boxSize); |
| 889 | save_option(tilesBoxSize); |
| 890 | save_option(fgColor); |
| 891 | save_option(bgColor); |
| 892 | save_option(fgTile); |
| 893 | save_option(bgTile); |
| 894 | save_option(selector); |
| 895 | save_option(discreteWheel); |
| 896 | save_option(wheelModel); |
| 897 | save_option(harmony); |
| 898 | save_option(showInvalidFgBgColorAlert); |
| 899 | save_option(entriesSeparator); |
| 900 | save_option(showColorAndTiles); |
| 901 | } |
| 902 | |
| 903 | Section* GlobalPref::ColorBar::section(const char* id) |
| 904 | { |
| 905 | return nullptr; |
| 906 | } |
| 907 | |
| 908 | OptionBase* GlobalPref::ColorBar::option(const char* id) |
| 909 | { |
| 910 | if (std::strcmp(id, boxSize.id()) == 0) return &boxSize; |
| 911 | if (std::strcmp(id, tilesBoxSize.id()) == 0) return &tilesBoxSize; |
| 912 | if (std::strcmp(id, fgColor.id()) == 0) return &fgColor; |
| 913 | if (std::strcmp(id, bgColor.id()) == 0) return &bgColor; |
| 914 | if (std::strcmp(id, fgTile.id()) == 0) return &fgTile; |
| 915 | if (std::strcmp(id, bgTile.id()) == 0) return &bgTile; |
| 916 | if (std::strcmp(id, selector.id()) == 0) return &selector; |
| 917 | if (std::strcmp(id, discreteWheel.id()) == 0) return &discreteWheel; |
| 918 | if (std::strcmp(id, wheelModel.id()) == 0) return &wheelModel; |
| 919 | if (std::strcmp(id, harmony.id()) == 0) return &harmony; |
| 920 | if (std::strcmp(id, showInvalidFgBgColorAlert.id()) == 0) return &showInvalidFgBgColorAlert; |
| 921 | if (std::strcmp(id, entriesSeparator.id()) == 0) return &entriesSeparator; |
| 922 | if (std::strcmp(id, showColorAndTiles.id()) == 0) return &showColorAndTiles; |
| 923 | return nullptr; |
| 924 | } |
| 925 | |
| 926 | GlobalPref::Updater::Updater(const std::string& name) |
| 927 | : Section(std::string(!name.empty() ? name + "." : "" ) + "updater" ) |
| 928 | , inits(this, "inits" , 0) |
| 929 | , exits(this, "exits" , 0) |
| 930 | , isDeveloper(this, "is_developer" , false) |
| 931 | , waitDays(this, "wait_days" , 0.0) |
| 932 | , lastCheck(this, "last_check" , 0) |
| 933 | , uuid(this, "uuid" ) |
| 934 | , currentVersion(this, "current_version" ) |
| 935 | , newVersion(this, "new_version" ) |
| 936 | , newUrl(this, "new_url" ) |
| 937 | { |
| 938 | } |
| 939 | |
| 940 | void GlobalPref::Updater::load() |
| 941 | { |
| 942 | load_option(inits); |
| 943 | load_option(exits); |
| 944 | load_option(isDeveloper); |
| 945 | load_option(waitDays); |
| 946 | load_option(lastCheck); |
| 947 | load_option(uuid); |
| 948 | load_option(currentVersion); |
| 949 | load_option(newVersion); |
| 950 | load_option(newUrl); |
| 951 | } |
| 952 | |
| 953 | void GlobalPref::Updater::save() |
| 954 | { |
| 955 | save_option(inits); |
| 956 | save_option(exits); |
| 957 | save_option(isDeveloper); |
| 958 | save_option(waitDays); |
| 959 | save_option(lastCheck); |
| 960 | save_option(uuid); |
| 961 | save_option(currentVersion); |
| 962 | save_option(newVersion); |
| 963 | save_option(newUrl); |
| 964 | } |
| 965 | |
| 966 | Section* GlobalPref::Updater::section(const char* id) |
| 967 | { |
| 968 | return nullptr; |
| 969 | } |
| 970 | |
| 971 | OptionBase* GlobalPref::Updater::option(const char* id) |
| 972 | { |
| 973 | if (std::strcmp(id, inits.id()) == 0) return &inits; |
| 974 | if (std::strcmp(id, exits.id()) == 0) return &exits; |
| 975 | if (std::strcmp(id, isDeveloper.id()) == 0) return &isDeveloper; |
| 976 | if (std::strcmp(id, waitDays.id()) == 0) return &waitDays; |
| 977 | if (std::strcmp(id, lastCheck.id()) == 0) return &lastCheck; |
| 978 | if (std::strcmp(id, uuid.id()) == 0) return &uuid; |
| 979 | if (std::strcmp(id, currentVersion.id()) == 0) return ¤tVersion; |
| 980 | if (std::strcmp(id, newVersion.id()) == 0) return &newVersion; |
| 981 | if (std::strcmp(id, newUrl.id()) == 0) return &newUrl; |
| 982 | return nullptr; |
| 983 | } |
| 984 | |
| 985 | GlobalPref::Brush::Brush(const std::string& name) |
| 986 | : Section(std::string(!name.empty() ? name + "." : "" ) + "brush" ) |
| 987 | , pattern(this, "pattern" , doc::BrushPattern::DEFAULT) |
| 988 | { |
| 989 | } |
| 990 | |
| 991 | void GlobalPref::Brush::load() |
| 992 | { |
| 993 | load_option(pattern); |
| 994 | } |
| 995 | |
| 996 | void GlobalPref::Brush::save() |
| 997 | { |
| 998 | save_option(pattern); |
| 999 | } |
| 1000 | |
| 1001 | Section* GlobalPref::Brush::section(const char* id) |
| 1002 | { |
| 1003 | return nullptr; |
| 1004 | } |
| 1005 | |
| 1006 | OptionBase* GlobalPref::Brush::option(const char* id) |
| 1007 | { |
| 1008 | if (std::strcmp(id, pattern.id()) == 0) return &pattern; |
| 1009 | return nullptr; |
| 1010 | } |
| 1011 | |
| 1012 | GlobalPref::SaveBrush::SaveBrush(const std::string& name) |
| 1013 | : Section(std::string(!name.empty() ? name + "." : "" ) + "save_brush" ) |
| 1014 | , brushType(this, "brush_type" , true) |
| 1015 | , brushSize(this, "brush_size" , true) |
| 1016 | , brushAngle(this, "brush_angle" , true) |
| 1017 | , fgColor(this, "fg_color" , false) |
| 1018 | , bgColor(this, "bg_color" , false) |
| 1019 | , imageColor(this, "image_color" , true) |
| 1020 | , inkType(this, "ink_type" , true) |
| 1021 | , inkOpacity(this, "ink_opacity" , true) |
| 1022 | , shade(this, "shade" , true) |
| 1023 | , pixelPerfect(this, "pixel_perfect" , false) |
| 1024 | { |
| 1025 | } |
| 1026 | |
| 1027 | void GlobalPref::SaveBrush::load() |
| 1028 | { |
| 1029 | load_option(brushType); |
| 1030 | load_option(brushSize); |
| 1031 | load_option(brushAngle); |
| 1032 | load_option(fgColor); |
| 1033 | load_option(bgColor); |
| 1034 | load_option(imageColor); |
| 1035 | load_option(inkType); |
| 1036 | load_option(inkOpacity); |
| 1037 | load_option(shade); |
| 1038 | load_option(pixelPerfect); |
| 1039 | } |
| 1040 | |
| 1041 | void GlobalPref::SaveBrush::save() |
| 1042 | { |
| 1043 | save_option(brushType); |
| 1044 | save_option(brushSize); |
| 1045 | save_option(brushAngle); |
| 1046 | save_option(fgColor); |
| 1047 | save_option(bgColor); |
| 1048 | save_option(imageColor); |
| 1049 | save_option(inkType); |
| 1050 | save_option(inkOpacity); |
| 1051 | save_option(shade); |
| 1052 | save_option(pixelPerfect); |
| 1053 | } |
| 1054 | |
| 1055 | Section* GlobalPref::SaveBrush::section(const char* id) |
| 1056 | { |
| 1057 | return nullptr; |
| 1058 | } |
| 1059 | |
| 1060 | OptionBase* GlobalPref::SaveBrush::option(const char* id) |
| 1061 | { |
| 1062 | if (std::strcmp(id, brushType.id()) == 0) return &brushType; |
| 1063 | if (std::strcmp(id, brushSize.id()) == 0) return &brushSize; |
| 1064 | if (std::strcmp(id, brushAngle.id()) == 0) return &brushAngle; |
| 1065 | if (std::strcmp(id, fgColor.id()) == 0) return &fgColor; |
| 1066 | if (std::strcmp(id, bgColor.id()) == 0) return &bgColor; |
| 1067 | if (std::strcmp(id, imageColor.id()) == 0) return &imageColor; |
| 1068 | if (std::strcmp(id, inkType.id()) == 0) return &inkType; |
| 1069 | if (std::strcmp(id, inkOpacity.id()) == 0) return &inkOpacity; |
| 1070 | if (std::strcmp(id, shade.id()) == 0) return &shade; |
| 1071 | if (std::strcmp(id, pixelPerfect.id()) == 0) return &pixelPerfect; |
| 1072 | return nullptr; |
| 1073 | } |
| 1074 | |
| 1075 | GlobalPref::Selection::Selection(const std::string& name) |
| 1076 | : Section(std::string(!name.empty() ? name + "." : "" ) + "selection" ) |
| 1077 | , mode(this, "mode" , SelectionMode::DEFAULT) |
| 1078 | , moveEdges(this, "move_edges" , true) |
| 1079 | , modifiersDisableHandles(this, "modifiers_disable_handles" , true) |
| 1080 | , moveOnAddMode(this, "move_on_add_mode" , true) |
| 1081 | , pivotVisibility(this, "pivot_visibility" , false) |
| 1082 | , pivotPosition(this, "pivot_position" , PivotPosition::CENTER) |
| 1083 | , opaque(this, "opaque" , false) |
| 1084 | , autoOpaque(this, "auto_opaque" , true) |
| 1085 | , keepSelectionAfterClear(this, "keep_selection_after_clear" , false) |
| 1086 | , autoShowSelectionEdges(this, "auto_show_selection_edges" , true) |
| 1087 | , transparentColor(this, "transparent_color" ) |
| 1088 | , rotationAlgorithm(this, "rotation_algorithm" , app::tools::RotationAlgorithm::DEFAULT) |
| 1089 | , modifySelectionQuantity(this, "modify_selection_quantity" , 1) |
| 1090 | , modifySelectionBrush(this, "modify_selection_brush" , BrushType::CIRCLE) |
| 1091 | , doubleclickSelectTile(this, "doubleclick_select_tile" , true) |
| 1092 | , forceRotsprite(this, "force_rotsprite" , false) |
| 1093 | , multicelWhenLayersOrFrames(this, "multicel_when_layers_or_frames" , true) |
| 1094 | { |
| 1095 | } |
| 1096 | |
| 1097 | void GlobalPref::Selection::load() |
| 1098 | { |
| 1099 | load_option(mode); |
| 1100 | load_option(moveEdges); |
| 1101 | load_option(modifiersDisableHandles); |
| 1102 | load_option(moveOnAddMode); |
| 1103 | load_option(pivotVisibility); |
| 1104 | load_option(pivotPosition); |
| 1105 | load_option(opaque); |
| 1106 | load_option(autoOpaque); |
| 1107 | load_option(keepSelectionAfterClear); |
| 1108 | load_option(autoShowSelectionEdges); |
| 1109 | load_option(transparentColor); |
| 1110 | load_option(rotationAlgorithm); |
| 1111 | load_option(modifySelectionQuantity); |
| 1112 | load_option(modifySelectionBrush); |
| 1113 | load_option(doubleclickSelectTile); |
| 1114 | load_option(forceRotsprite); |
| 1115 | load_option(multicelWhenLayersOrFrames); |
| 1116 | } |
| 1117 | |
| 1118 | void GlobalPref::Selection::save() |
| 1119 | { |
| 1120 | save_option(mode); |
| 1121 | save_option(moveEdges); |
| 1122 | save_option(modifiersDisableHandles); |
| 1123 | save_option(moveOnAddMode); |
| 1124 | save_option(pivotVisibility); |
| 1125 | save_option(pivotPosition); |
| 1126 | save_option(opaque); |
| 1127 | save_option(autoOpaque); |
| 1128 | save_option(keepSelectionAfterClear); |
| 1129 | save_option(autoShowSelectionEdges); |
| 1130 | save_option(transparentColor); |
| 1131 | save_option(rotationAlgorithm); |
| 1132 | save_option(modifySelectionQuantity); |
| 1133 | save_option(modifySelectionBrush); |
| 1134 | save_option(doubleclickSelectTile); |
| 1135 | save_option(forceRotsprite); |
| 1136 | save_option(multicelWhenLayersOrFrames); |
| 1137 | } |
| 1138 | |
| 1139 | Section* GlobalPref::Selection::section(const char* id) |
| 1140 | { |
| 1141 | return nullptr; |
| 1142 | } |
| 1143 | |
| 1144 | OptionBase* GlobalPref::Selection::option(const char* id) |
| 1145 | { |
| 1146 | if (std::strcmp(id, mode.id()) == 0) return &mode; |
| 1147 | if (std::strcmp(id, moveEdges.id()) == 0) return &moveEdges; |
| 1148 | if (std::strcmp(id, modifiersDisableHandles.id()) == 0) return &modifiersDisableHandles; |
| 1149 | if (std::strcmp(id, moveOnAddMode.id()) == 0) return &moveOnAddMode; |
| 1150 | if (std::strcmp(id, pivotVisibility.id()) == 0) return &pivotVisibility; |
| 1151 | if (std::strcmp(id, pivotPosition.id()) == 0) return &pivotPosition; |
| 1152 | if (std::strcmp(id, opaque.id()) == 0) return &opaque; |
| 1153 | if (std::strcmp(id, autoOpaque.id()) == 0) return &autoOpaque; |
| 1154 | if (std::strcmp(id, keepSelectionAfterClear.id()) == 0) return &keepSelectionAfterClear; |
| 1155 | if (std::strcmp(id, autoShowSelectionEdges.id()) == 0) return &autoShowSelectionEdges; |
| 1156 | if (std::strcmp(id, transparentColor.id()) == 0) return &transparentColor; |
| 1157 | if (std::strcmp(id, rotationAlgorithm.id()) == 0) return &rotationAlgorithm; |
| 1158 | if (std::strcmp(id, modifySelectionQuantity.id()) == 0) return &modifySelectionQuantity; |
| 1159 | if (std::strcmp(id, modifySelectionBrush.id()) == 0) return &modifySelectionBrush; |
| 1160 | if (std::strcmp(id, doubleclickSelectTile.id()) == 0) return &doubleclickSelectTile; |
| 1161 | if (std::strcmp(id, forceRotsprite.id()) == 0) return &forceRotsprite; |
| 1162 | if (std::strcmp(id, multicelWhenLayersOrFrames.id()) == 0) return &multicelWhenLayersOrFrames; |
| 1163 | return nullptr; |
| 1164 | } |
| 1165 | |
| 1166 | GlobalPref::Quantization::Quantization(const std::string& name) |
| 1167 | : Section(std::string(!name.empty() ? name + "." : "" ) + "quantization" ) |
| 1168 | , withAlpha(this, "with_alpha" , true) |
| 1169 | , ditheringAlgorithm(this, "dithering_algorithm" ) |
| 1170 | , ditheringFactor(this, "dithering_factor" , 100) |
| 1171 | , toGray(this, "to_gray" , ToGrayAlgorithm::DEFAULT) |
| 1172 | , advanced(this, "advanced" , false) |
| 1173 | , rgbmapAlgorithm(this, "rgbmap_algorithm" , doc::RgbMapAlgorithm::DEFAULT) |
| 1174 | { |
| 1175 | } |
| 1176 | |
| 1177 | void GlobalPref::Quantization::load() |
| 1178 | { |
| 1179 | load_option(withAlpha); |
| 1180 | load_option(ditheringAlgorithm); |
| 1181 | load_option(ditheringFactor); |
| 1182 | load_option(toGray); |
| 1183 | load_option(advanced); |
| 1184 | load_option(rgbmapAlgorithm); |
| 1185 | } |
| 1186 | |
| 1187 | void GlobalPref::Quantization::save() |
| 1188 | { |
| 1189 | save_option(withAlpha); |
| 1190 | save_option(ditheringAlgorithm); |
| 1191 | save_option(ditheringFactor); |
| 1192 | save_option(toGray); |
| 1193 | save_option(advanced); |
| 1194 | save_option(rgbmapAlgorithm); |
| 1195 | } |
| 1196 | |
| 1197 | Section* GlobalPref::Quantization::section(const char* id) |
| 1198 | { |
| 1199 | return nullptr; |
| 1200 | } |
| 1201 | |
| 1202 | OptionBase* GlobalPref::Quantization::option(const char* id) |
| 1203 | { |
| 1204 | if (std::strcmp(id, withAlpha.id()) == 0) return &withAlpha; |
| 1205 | if (std::strcmp(id, ditheringAlgorithm.id()) == 0) return &ditheringAlgorithm; |
| 1206 | if (std::strcmp(id, ditheringFactor.id()) == 0) return &ditheringFactor; |
| 1207 | if (std::strcmp(id, toGray.id()) == 0) return &toGray; |
| 1208 | if (std::strcmp(id, advanced.id()) == 0) return &advanced; |
| 1209 | if (std::strcmp(id, rgbmapAlgorithm.id()) == 0) return &rgbmapAlgorithm; |
| 1210 | return nullptr; |
| 1211 | } |
| 1212 | |
| 1213 | GlobalPref::Eyedropper::Eyedropper(const std::string& name) |
| 1214 | : Section(std::string(!name.empty() ? name + "." : "" ) + "eyedropper" ) |
| 1215 | , channel(this, "channel" , EyedropperChannel::COLOR_ALPHA) |
| 1216 | , sample(this, "sample" , EyedropperSample::ALL_LAYERS) |
| 1217 | , discardBrush(this, "discard_brush" , false) |
| 1218 | { |
| 1219 | } |
| 1220 | |
| 1221 | void GlobalPref::Eyedropper::load() |
| 1222 | { |
| 1223 | load_option(channel); |
| 1224 | load_option(sample); |
| 1225 | load_option(discardBrush); |
| 1226 | } |
| 1227 | |
| 1228 | void GlobalPref::Eyedropper::save() |
| 1229 | { |
| 1230 | save_option(channel); |
| 1231 | save_option(sample); |
| 1232 | save_option(discardBrush); |
| 1233 | } |
| 1234 | |
| 1235 | Section* GlobalPref::Eyedropper::section(const char* id) |
| 1236 | { |
| 1237 | return nullptr; |
| 1238 | } |
| 1239 | |
| 1240 | OptionBase* GlobalPref::Eyedropper::option(const char* id) |
| 1241 | { |
| 1242 | if (std::strcmp(id, channel.id()) == 0) return &channel; |
| 1243 | if (std::strcmp(id, sample.id()) == 0) return &sample; |
| 1244 | if (std::strcmp(id, discardBrush.id()) == 0) return &discardBrush; |
| 1245 | return nullptr; |
| 1246 | } |
| 1247 | |
| 1248 | GlobalPref::Shared::Shared(const std::string& name) |
| 1249 | : Section(std::string(!name.empty() ? name + "." : "" ) + "shared" ) |
| 1250 | , shareInk(this, "share_ink" , false) |
| 1251 | , ink(this, "ink" , app::tools::InkType::DEFAULT) |
| 1252 | { |
| 1253 | } |
| 1254 | |
| 1255 | void GlobalPref::Shared::load() |
| 1256 | { |
| 1257 | load_option(shareInk); |
| 1258 | load_option(ink); |
| 1259 | } |
| 1260 | |
| 1261 | void GlobalPref::Shared::save() |
| 1262 | { |
| 1263 | save_option(shareInk); |
| 1264 | save_option(ink); |
| 1265 | } |
| 1266 | |
| 1267 | Section* GlobalPref::Shared::section(const char* id) |
| 1268 | { |
| 1269 | return nullptr; |
| 1270 | } |
| 1271 | |
| 1272 | OptionBase* GlobalPref::Shared::option(const char* id) |
| 1273 | { |
| 1274 | if (std::strcmp(id, shareInk.id()) == 0) return &shareInk; |
| 1275 | if (std::strcmp(id, ink.id()) == 0) return &ink; |
| 1276 | return nullptr; |
| 1277 | } |
| 1278 | |
| 1279 | GlobalPref::NewFile::NewFile(const std::string& name) |
| 1280 | : Section(std::string(!name.empty() ? name + "." : "" ) + "new_file" ) |
| 1281 | , width(this, "width" , 32) |
| 1282 | , height(this, "height" , 32) |
| 1283 | , colorMode(this, "color_mode" , doc::ColorMode::RGB) |
| 1284 | , backgroundColor(this, "background_color" , 0) |
| 1285 | , advanced(this, "advanced" , false) |
| 1286 | , pixelRatio(this, "pixel_ratio" ) |
| 1287 | { |
| 1288 | } |
| 1289 | |
| 1290 | void GlobalPref::NewFile::load() |
| 1291 | { |
| 1292 | load_option(width); |
| 1293 | load_option(height); |
| 1294 | load_option(colorMode); |
| 1295 | load_option(backgroundColor); |
| 1296 | load_option(advanced); |
| 1297 | load_option(pixelRatio); |
| 1298 | } |
| 1299 | |
| 1300 | void GlobalPref::NewFile::save() |
| 1301 | { |
| 1302 | save_option(width); |
| 1303 | save_option(height); |
| 1304 | save_option(colorMode); |
| 1305 | save_option(backgroundColor); |
| 1306 | save_option(advanced); |
| 1307 | save_option(pixelRatio); |
| 1308 | } |
| 1309 | |
| 1310 | Section* GlobalPref::NewFile::section(const char* id) |
| 1311 | { |
| 1312 | return nullptr; |
| 1313 | } |
| 1314 | |
| 1315 | OptionBase* GlobalPref::NewFile::option(const char* id) |
| 1316 | { |
| 1317 | if (std::strcmp(id, width.id()) == 0) return &width; |
| 1318 | if (std::strcmp(id, height.id()) == 0) return &height; |
| 1319 | if (std::strcmp(id, colorMode.id()) == 0) return &colorMode; |
| 1320 | if (std::strcmp(id, backgroundColor.id()) == 0) return &backgroundColor; |
| 1321 | if (std::strcmp(id, advanced.id()) == 0) return &advanced; |
| 1322 | if (std::strcmp(id, pixelRatio.id()) == 0) return &pixelRatio; |
| 1323 | return nullptr; |
| 1324 | } |
| 1325 | |
| 1326 | GlobalPref::FileSelector::FileSelector(const std::string& name) |
| 1327 | : Section(std::string(!name.empty() ? name + "." : "" ) + "file_selector" ) |
| 1328 | , currentFolder(this, "current_folder" , "<empty>" ) |
| 1329 | , zoom(this, "zoom" , 1.0) |
| 1330 | { |
| 1331 | } |
| 1332 | |
| 1333 | void GlobalPref::FileSelector::load() |
| 1334 | { |
| 1335 | load_option(currentFolder); |
| 1336 | load_option(zoom); |
| 1337 | } |
| 1338 | |
| 1339 | void GlobalPref::FileSelector::save() |
| 1340 | { |
| 1341 | save_option(currentFolder); |
| 1342 | save_option(zoom); |
| 1343 | } |
| 1344 | |
| 1345 | Section* GlobalPref::FileSelector::section(const char* id) |
| 1346 | { |
| 1347 | return nullptr; |
| 1348 | } |
| 1349 | |
| 1350 | OptionBase* GlobalPref::FileSelector::option(const char* id) |
| 1351 | { |
| 1352 | if (std::strcmp(id, currentFolder.id()) == 0) return ¤tFolder; |
| 1353 | if (std::strcmp(id, zoom.id()) == 0) return &zoom; |
| 1354 | return nullptr; |
| 1355 | } |
| 1356 | |
| 1357 | GlobalPref::TextTool::TextTool(const std::string& name) |
| 1358 | : Section(std::string(!name.empty() ? name + "." : "" ) + "text_tool" ) |
| 1359 | , fontFace(this, "font_face" ) |
| 1360 | , fontSize(this, "font_size" , 12) |
| 1361 | , antialias(this, "antialias" , false) |
| 1362 | { |
| 1363 | } |
| 1364 | |
| 1365 | void GlobalPref::TextTool::load() |
| 1366 | { |
| 1367 | load_option(fontFace); |
| 1368 | load_option(fontSize); |
| 1369 | load_option(antialias); |
| 1370 | } |
| 1371 | |
| 1372 | void GlobalPref::TextTool::save() |
| 1373 | { |
| 1374 | save_option(fontFace); |
| 1375 | save_option(fontSize); |
| 1376 | save_option(antialias); |
| 1377 | } |
| 1378 | |
| 1379 | Section* GlobalPref::TextTool::section(const char* id) |
| 1380 | { |
| 1381 | return nullptr; |
| 1382 | } |
| 1383 | |
| 1384 | OptionBase* GlobalPref::TextTool::option(const char* id) |
| 1385 | { |
| 1386 | if (std::strcmp(id, fontFace.id()) == 0) return &fontFace; |
| 1387 | if (std::strcmp(id, fontSize.id()) == 0) return &fontSize; |
| 1388 | if (std::strcmp(id, antialias.id()) == 0) return &antialias; |
| 1389 | return nullptr; |
| 1390 | } |
| 1391 | |
| 1392 | GlobalPref::SymmetryMode::SymmetryMode(const std::string& name) |
| 1393 | : Section(std::string(!name.empty() ? name + "." : "" ) + "symmetry_mode" ) |
| 1394 | , enabled(this, "enabled" , false) |
| 1395 | { |
| 1396 | } |
| 1397 | |
| 1398 | void GlobalPref::SymmetryMode::load() |
| 1399 | { |
| 1400 | load_option(enabled); |
| 1401 | } |
| 1402 | |
| 1403 | void GlobalPref::SymmetryMode::save() |
| 1404 | { |
| 1405 | save_option(enabled); |
| 1406 | } |
| 1407 | |
| 1408 | Section* GlobalPref::SymmetryMode::section(const char* id) |
| 1409 | { |
| 1410 | return nullptr; |
| 1411 | } |
| 1412 | |
| 1413 | OptionBase* GlobalPref::SymmetryMode::option(const char* id) |
| 1414 | { |
| 1415 | if (std::strcmp(id, enabled.id()) == 0) return &enabled; |
| 1416 | return nullptr; |
| 1417 | } |
| 1418 | |
| 1419 | GlobalPref::Perf::Perf(const std::string& name) |
| 1420 | : Section(std::string(!name.empty() ? name + "." : "" ) + "perf" ) |
| 1421 | , showRenderTime(this, "show_render_time" , false) |
| 1422 | { |
| 1423 | } |
| 1424 | |
| 1425 | void GlobalPref::Perf::load() |
| 1426 | { |
| 1427 | load_option(showRenderTime); |
| 1428 | } |
| 1429 | |
| 1430 | void GlobalPref::Perf::save() |
| 1431 | { |
| 1432 | save_option(showRenderTime); |
| 1433 | } |
| 1434 | |
| 1435 | Section* GlobalPref::Perf::section(const char* id) |
| 1436 | { |
| 1437 | return nullptr; |
| 1438 | } |
| 1439 | |
| 1440 | OptionBase* GlobalPref::Perf::option(const char* id) |
| 1441 | { |
| 1442 | if (std::strcmp(id, showRenderTime.id()) == 0) return &showRenderTime; |
| 1443 | return nullptr; |
| 1444 | } |
| 1445 | |
| 1446 | GlobalPref::Guides::Guides(const std::string& name) |
| 1447 | : Section(std::string(!name.empty() ? name + "." : "" ) + "guides" ) |
| 1448 | , layerEdgesColor(this, "layer_edges_color" , app::Color::fromRgb(0, 0, 255)) |
| 1449 | , autoGuidesColor(this, "auto_guides_color" , app::Color::fromRgb(0, 0, 255, 128)) |
| 1450 | { |
| 1451 | } |
| 1452 | |
| 1453 | void GlobalPref::Guides::load() |
| 1454 | { |
| 1455 | load_option(layerEdgesColor); |
| 1456 | load_option(autoGuidesColor); |
| 1457 | } |
| 1458 | |
| 1459 | void GlobalPref::Guides::save() |
| 1460 | { |
| 1461 | save_option(layerEdgesColor); |
| 1462 | save_option(autoGuidesColor); |
| 1463 | } |
| 1464 | |
| 1465 | Section* GlobalPref::Guides::section(const char* id) |
| 1466 | { |
| 1467 | return nullptr; |
| 1468 | } |
| 1469 | |
| 1470 | OptionBase* GlobalPref::Guides::option(const char* id) |
| 1471 | { |
| 1472 | if (std::strcmp(id, layerEdgesColor.id()) == 0) return &layerEdgesColor; |
| 1473 | if (std::strcmp(id, autoGuidesColor.id()) == 0) return &autoGuidesColor; |
| 1474 | return nullptr; |
| 1475 | } |
| 1476 | |
| 1477 | GlobalPref::Slices::Slices(const std::string& name) |
| 1478 | : Section(std::string(!name.empty() ? name + "." : "" ) + "slices" ) |
| 1479 | , defaultColor(this, "default_color" , app::Color::fromRgb(0, 0, 255)) |
| 1480 | , userDataVisibility(this, "user_data_visibility" , false) |
| 1481 | { |
| 1482 | } |
| 1483 | |
| 1484 | void GlobalPref::Slices::load() |
| 1485 | { |
| 1486 | load_option(defaultColor); |
| 1487 | load_option(userDataVisibility); |
| 1488 | } |
| 1489 | |
| 1490 | void GlobalPref::Slices::save() |
| 1491 | { |
| 1492 | save_option(defaultColor); |
| 1493 | save_option(userDataVisibility); |
| 1494 | } |
| 1495 | |
| 1496 | Section* GlobalPref::Slices::section(const char* id) |
| 1497 | { |
| 1498 | return nullptr; |
| 1499 | } |
| 1500 | |
| 1501 | OptionBase* GlobalPref::Slices::option(const char* id) |
| 1502 | { |
| 1503 | if (std::strcmp(id, defaultColor.id()) == 0) return &defaultColor; |
| 1504 | if (std::strcmp(id, userDataVisibility.id()) == 0) return &userDataVisibility; |
| 1505 | return nullptr; |
| 1506 | } |
| 1507 | |
| 1508 | GlobalPref::AdvancedMode::AdvancedMode(const std::string& name) |
| 1509 | : Section(std::string(!name.empty() ? name + "." : "" ) + "advanced_mode" ) |
| 1510 | , showAlert(this, "show_alert" , true) |
| 1511 | { |
| 1512 | } |
| 1513 | |
| 1514 | void GlobalPref::AdvancedMode::load() |
| 1515 | { |
| 1516 | load_option(showAlert); |
| 1517 | } |
| 1518 | |
| 1519 | void GlobalPref::AdvancedMode::save() |
| 1520 | { |
| 1521 | save_option(showAlert); |
| 1522 | } |
| 1523 | |
| 1524 | Section* GlobalPref::AdvancedMode::section(const char* id) |
| 1525 | { |
| 1526 | return nullptr; |
| 1527 | } |
| 1528 | |
| 1529 | OptionBase* GlobalPref::AdvancedMode::option(const char* id) |
| 1530 | { |
| 1531 | if (std::strcmp(id, showAlert.id()) == 0) return &showAlert; |
| 1532 | return nullptr; |
| 1533 | } |
| 1534 | |
| 1535 | GlobalPref::OpenFile::OpenFile(const std::string& name) |
| 1536 | : Section(std::string(!name.empty() ? name + "." : "" ) + "open_file" ) |
| 1537 | , openSequence(this, "open_sequence" , SequenceDecision::ASK) |
| 1538 | { |
| 1539 | } |
| 1540 | |
| 1541 | void GlobalPref::OpenFile::load() |
| 1542 | { |
| 1543 | load_option(openSequence); |
| 1544 | } |
| 1545 | |
| 1546 | void GlobalPref::OpenFile::save() |
| 1547 | { |
| 1548 | save_option(openSequence); |
| 1549 | } |
| 1550 | |
| 1551 | Section* GlobalPref::OpenFile::section(const char* id) |
| 1552 | { |
| 1553 | return nullptr; |
| 1554 | } |
| 1555 | |
| 1556 | OptionBase* GlobalPref::OpenFile::option(const char* id) |
| 1557 | { |
| 1558 | if (std::strcmp(id, openSequence.id()) == 0) return &openSequence; |
| 1559 | return nullptr; |
| 1560 | } |
| 1561 | |
| 1562 | GlobalPref::SaveFile::SaveFile(const std::string& name) |
| 1563 | : Section(std::string(!name.empty() ? name + "." : "" ) + "save_file" ) |
| 1564 | , showFileFormatDoesntSupportAlert(this, "show_file_format_doesnt_support_alert" , true) |
| 1565 | , showExportAnimationInSequenceAlert(this, "show_export_animation_in_sequence_alert" , true) |
| 1566 | , defaultExtension(this, "default_extension" , "aseprite" ) |
| 1567 | { |
| 1568 | } |
| 1569 | |
| 1570 | void GlobalPref::SaveFile::load() |
| 1571 | { |
| 1572 | load_option(showFileFormatDoesntSupportAlert); |
| 1573 | load_option(showExportAnimationInSequenceAlert); |
| 1574 | load_option(defaultExtension); |
| 1575 | } |
| 1576 | |
| 1577 | void GlobalPref::SaveFile::save() |
| 1578 | { |
| 1579 | save_option(showFileFormatDoesntSupportAlert); |
| 1580 | save_option(showExportAnimationInSequenceAlert); |
| 1581 | save_option(defaultExtension); |
| 1582 | } |
| 1583 | |
| 1584 | Section* GlobalPref::SaveFile::section(const char* id) |
| 1585 | { |
| 1586 | return nullptr; |
| 1587 | } |
| 1588 | |
| 1589 | OptionBase* GlobalPref::SaveFile::option(const char* id) |
| 1590 | { |
| 1591 | if (std::strcmp(id, showFileFormatDoesntSupportAlert.id()) == 0) return &showFileFormatDoesntSupportAlert; |
| 1592 | if (std::strcmp(id, showExportAnimationInSequenceAlert.id()) == 0) return &showExportAnimationInSequenceAlert; |
| 1593 | if (std::strcmp(id, defaultExtension.id()) == 0) return &defaultExtension; |
| 1594 | return nullptr; |
| 1595 | } |
| 1596 | |
| 1597 | GlobalPref::ExportFile::ExportFile(const std::string& name) |
| 1598 | : Section(std::string(!name.empty() ? name + "." : "" ) + "export_file" ) |
| 1599 | , showOverwriteFilesAlert(this, "show_overwrite_files_alert" , true) |
| 1600 | , imageDefaultExtension(this, "image_default_extension" , "png" ) |
| 1601 | , animationDefaultExtension(this, "animation_default_extension" , "gif" ) |
| 1602 | { |
| 1603 | } |
| 1604 | |
| 1605 | void GlobalPref::ExportFile::load() |
| 1606 | { |
| 1607 | load_option(showOverwriteFilesAlert); |
| 1608 | load_option(imageDefaultExtension); |
| 1609 | load_option(animationDefaultExtension); |
| 1610 | } |
| 1611 | |
| 1612 | void GlobalPref::ExportFile::save() |
| 1613 | { |
| 1614 | save_option(showOverwriteFilesAlert); |
| 1615 | save_option(imageDefaultExtension); |
| 1616 | save_option(animationDefaultExtension); |
| 1617 | } |
| 1618 | |
| 1619 | Section* GlobalPref::ExportFile::section(const char* id) |
| 1620 | { |
| 1621 | return nullptr; |
| 1622 | } |
| 1623 | |
| 1624 | OptionBase* GlobalPref::ExportFile::option(const char* id) |
| 1625 | { |
| 1626 | if (std::strcmp(id, showOverwriteFilesAlert.id()) == 0) return &showOverwriteFilesAlert; |
| 1627 | if (std::strcmp(id, imageDefaultExtension.id()) == 0) return &imageDefaultExtension; |
| 1628 | if (std::strcmp(id, animationDefaultExtension.id()) == 0) return &animationDefaultExtension; |
| 1629 | return nullptr; |
| 1630 | } |
| 1631 | |
| 1632 | GlobalPref::SpriteSheet::SpriteSheet(const std::string& name) |
| 1633 | : Section(std::string(!name.empty() ? name + "." : "" ) + "sprite_sheet" ) |
| 1634 | , showOverwriteFilesAlert(this, "show_overwrite_files_alert" , true) |
| 1635 | , defaultExtension(this, "default_extension" , "png" ) |
| 1636 | , preview(this, "preview" , true) |
| 1637 | , sections(this, "sections" ) |
| 1638 | { |
| 1639 | } |
| 1640 | |
| 1641 | void GlobalPref::SpriteSheet::load() |
| 1642 | { |
| 1643 | load_option(showOverwriteFilesAlert); |
| 1644 | load_option(defaultExtension); |
| 1645 | load_option(preview); |
| 1646 | load_option(sections); |
| 1647 | } |
| 1648 | |
| 1649 | void GlobalPref::SpriteSheet::save() |
| 1650 | { |
| 1651 | save_option(showOverwriteFilesAlert); |
| 1652 | save_option(defaultExtension); |
| 1653 | save_option(preview); |
| 1654 | save_option(sections); |
| 1655 | } |
| 1656 | |
| 1657 | Section* GlobalPref::SpriteSheet::section(const char* id) |
| 1658 | { |
| 1659 | return nullptr; |
| 1660 | } |
| 1661 | |
| 1662 | OptionBase* GlobalPref::SpriteSheet::option(const char* id) |
| 1663 | { |
| 1664 | if (std::strcmp(id, showOverwriteFilesAlert.id()) == 0) return &showOverwriteFilesAlert; |
| 1665 | if (std::strcmp(id, defaultExtension.id()) == 0) return &defaultExtension; |
| 1666 | if (std::strcmp(id, preview.id()) == 0) return &preview; |
| 1667 | if (std::strcmp(id, sections.id()) == 0) return §ions; |
| 1668 | return nullptr; |
| 1669 | } |
| 1670 | |
| 1671 | GlobalPref::Gif::Gif(const std::string& name) |
| 1672 | : Section(std::string(!name.empty() ? name + "." : "" ) + "gif" ) |
| 1673 | , showAlert(this, "show_alert" , true) |
| 1674 | , interlaced(this, "interlaced" , false) |
| 1675 | , loop(this, "loop" , true) |
| 1676 | , preservePaletteOrder(this, "preserve_palette_order" , true) |
| 1677 | { |
| 1678 | } |
| 1679 | |
| 1680 | void GlobalPref::Gif::load() |
| 1681 | { |
| 1682 | load_option(showAlert); |
| 1683 | load_option(interlaced); |
| 1684 | load_option(loop); |
| 1685 | load_option(preservePaletteOrder); |
| 1686 | } |
| 1687 | |
| 1688 | void GlobalPref::Gif::save() |
| 1689 | { |
| 1690 | save_option(showAlert); |
| 1691 | save_option(interlaced); |
| 1692 | save_option(loop); |
| 1693 | save_option(preservePaletteOrder); |
| 1694 | } |
| 1695 | |
| 1696 | Section* GlobalPref::Gif::section(const char* id) |
| 1697 | { |
| 1698 | return nullptr; |
| 1699 | } |
| 1700 | |
| 1701 | OptionBase* GlobalPref::Gif::option(const char* id) |
| 1702 | { |
| 1703 | if (std::strcmp(id, showAlert.id()) == 0) return &showAlert; |
| 1704 | if (std::strcmp(id, interlaced.id()) == 0) return &interlaced; |
| 1705 | if (std::strcmp(id, loop.id()) == 0) return &loop; |
| 1706 | if (std::strcmp(id, preservePaletteOrder.id()) == 0) return &preservePaletteOrder; |
| 1707 | return nullptr; |
| 1708 | } |
| 1709 | |
| 1710 | GlobalPref::Jpeg::Jpeg(const std::string& name) |
| 1711 | : Section(std::string(!name.empty() ? name + "." : "" ) + "jpeg" ) |
| 1712 | , showAlert(this, "show_alert" , true) |
| 1713 | , quality(this, "quality" , 1.0) |
| 1714 | { |
| 1715 | } |
| 1716 | |
| 1717 | void GlobalPref::Jpeg::load() |
| 1718 | { |
| 1719 | load_option(showAlert); |
| 1720 | load_option(quality); |
| 1721 | } |
| 1722 | |
| 1723 | void GlobalPref::Jpeg::save() |
| 1724 | { |
| 1725 | save_option(showAlert); |
| 1726 | save_option(quality); |
| 1727 | } |
| 1728 | |
| 1729 | Section* GlobalPref::Jpeg::section(const char* id) |
| 1730 | { |
| 1731 | return nullptr; |
| 1732 | } |
| 1733 | |
| 1734 | OptionBase* GlobalPref::Jpeg::option(const char* id) |
| 1735 | { |
| 1736 | if (std::strcmp(id, showAlert.id()) == 0) return &showAlert; |
| 1737 | if (std::strcmp(id, quality.id()) == 0) return &quality; |
| 1738 | return nullptr; |
| 1739 | } |
| 1740 | |
| 1741 | GlobalPref::Svg::Svg(const std::string& name) |
| 1742 | : Section(std::string(!name.empty() ? name + "." : "" ) + "svg" ) |
| 1743 | , showAlert(this, "show_alert" , true) |
| 1744 | , pixelScale(this, "pixel_scale" , 1) |
| 1745 | { |
| 1746 | } |
| 1747 | |
| 1748 | void GlobalPref::Svg::load() |
| 1749 | { |
| 1750 | load_option(showAlert); |
| 1751 | load_option(pixelScale); |
| 1752 | } |
| 1753 | |
| 1754 | void GlobalPref::Svg::save() |
| 1755 | { |
| 1756 | save_option(showAlert); |
| 1757 | save_option(pixelScale); |
| 1758 | } |
| 1759 | |
| 1760 | Section* GlobalPref::Svg::section(const char* id) |
| 1761 | { |
| 1762 | return nullptr; |
| 1763 | } |
| 1764 | |
| 1765 | OptionBase* GlobalPref::Svg::option(const char* id) |
| 1766 | { |
| 1767 | if (std::strcmp(id, showAlert.id()) == 0) return &showAlert; |
| 1768 | if (std::strcmp(id, pixelScale.id()) == 0) return &pixelScale; |
| 1769 | return nullptr; |
| 1770 | } |
| 1771 | |
| 1772 | GlobalPref::Tga::Tga(const std::string& name) |
| 1773 | : Section(std::string(!name.empty() ? name + "." : "" ) + "tga" ) |
| 1774 | , showAlert(this, "show_alert" , true) |
| 1775 | , bitsPerPixel(this, "bits_per_pixel" , 0) |
| 1776 | , compress(this, "compress" , true) |
| 1777 | { |
| 1778 | } |
| 1779 | |
| 1780 | void GlobalPref::Tga::load() |
| 1781 | { |
| 1782 | load_option(showAlert); |
| 1783 | load_option(bitsPerPixel); |
| 1784 | load_option(compress); |
| 1785 | } |
| 1786 | |
| 1787 | void GlobalPref::Tga::save() |
| 1788 | { |
| 1789 | save_option(showAlert); |
| 1790 | save_option(bitsPerPixel); |
| 1791 | save_option(compress); |
| 1792 | } |
| 1793 | |
| 1794 | Section* GlobalPref::Tga::section(const char* id) |
| 1795 | { |
| 1796 | return nullptr; |
| 1797 | } |
| 1798 | |
| 1799 | OptionBase* GlobalPref::Tga::option(const char* id) |
| 1800 | { |
| 1801 | if (std::strcmp(id, showAlert.id()) == 0) return &showAlert; |
| 1802 | if (std::strcmp(id, bitsPerPixel.id()) == 0) return &bitsPerPixel; |
| 1803 | if (std::strcmp(id, compress.id()) == 0) return &compress; |
| 1804 | return nullptr; |
| 1805 | } |
| 1806 | |
| 1807 | GlobalPref::Css::Css(const std::string& name) |
| 1808 | : Section(std::string(!name.empty() ? name + "." : "" ) + "css" ) |
| 1809 | , showAlert(this, "show_alert" , true) |
| 1810 | , pixelScale(this, "pixel_scale" , 1) |
| 1811 | , withVars(this, "with_vars" , false) |
| 1812 | , generateHtml(this, "generate_html" , false) |
| 1813 | { |
| 1814 | } |
| 1815 | |
| 1816 | void GlobalPref::Css::load() |
| 1817 | { |
| 1818 | load_option(showAlert); |
| 1819 | load_option(pixelScale); |
| 1820 | load_option(withVars); |
| 1821 | load_option(generateHtml); |
| 1822 | } |
| 1823 | |
| 1824 | void GlobalPref::Css::save() |
| 1825 | { |
| 1826 | save_option(showAlert); |
| 1827 | save_option(pixelScale); |
| 1828 | save_option(withVars); |
| 1829 | save_option(generateHtml); |
| 1830 | } |
| 1831 | |
| 1832 | Section* GlobalPref::Css::section(const char* id) |
| 1833 | { |
| 1834 | return nullptr; |
| 1835 | } |
| 1836 | |
| 1837 | OptionBase* GlobalPref::Css::option(const char* id) |
| 1838 | { |
| 1839 | if (std::strcmp(id, showAlert.id()) == 0) return &showAlert; |
| 1840 | if (std::strcmp(id, pixelScale.id()) == 0) return &pixelScale; |
| 1841 | if (std::strcmp(id, withVars.id()) == 0) return &withVars; |
| 1842 | if (std::strcmp(id, generateHtml.id()) == 0) return &generateHtml; |
| 1843 | return nullptr; |
| 1844 | } |
| 1845 | |
| 1846 | GlobalPref::Webp::Webp(const std::string& name) |
| 1847 | : Section(std::string(!name.empty() ? name + "." : "" ) + "webp" ) |
| 1848 | , showAlert(this, "show_alert" , true) |
| 1849 | , loop(this, "loop" , true) |
| 1850 | , type(this, "type" , 0) |
| 1851 | , quality(this, "quality" , 100) |
| 1852 | , compression(this, "compression" , 6) |
| 1853 | , imageHint(this, "image_hint" , 0) |
| 1854 | , imagePreset(this, "image_preset" , 0) |
| 1855 | { |
| 1856 | } |
| 1857 | |
| 1858 | void GlobalPref::Webp::load() |
| 1859 | { |
| 1860 | load_option(showAlert); |
| 1861 | load_option(loop); |
| 1862 | load_option(type); |
| 1863 | load_option(quality); |
| 1864 | load_option(compression); |
| 1865 | load_option(imageHint); |
| 1866 | load_option(imagePreset); |
| 1867 | } |
| 1868 | |
| 1869 | void GlobalPref::Webp::save() |
| 1870 | { |
| 1871 | save_option(showAlert); |
| 1872 | save_option(loop); |
| 1873 | save_option(type); |
| 1874 | save_option(quality); |
| 1875 | save_option(compression); |
| 1876 | save_option(imageHint); |
| 1877 | save_option(imagePreset); |
| 1878 | } |
| 1879 | |
| 1880 | Section* GlobalPref::Webp::section(const char* id) |
| 1881 | { |
| 1882 | return nullptr; |
| 1883 | } |
| 1884 | |
| 1885 | OptionBase* GlobalPref::Webp::option(const char* id) |
| 1886 | { |
| 1887 | if (std::strcmp(id, showAlert.id()) == 0) return &showAlert; |
| 1888 | if (std::strcmp(id, loop.id()) == 0) return &loop; |
| 1889 | if (std::strcmp(id, type.id()) == 0) return &type; |
| 1890 | if (std::strcmp(id, quality.id()) == 0) return &quality; |
| 1891 | if (std::strcmp(id, compression.id()) == 0) return &compression; |
| 1892 | if (std::strcmp(id, imageHint.id()) == 0) return &imageHint; |
| 1893 | if (std::strcmp(id, imagePreset.id()) == 0) return &imagePreset; |
| 1894 | return nullptr; |
| 1895 | } |
| 1896 | |
| 1897 | GlobalPref::HueSaturation::HueSaturation(const std::string& name) |
| 1898 | : Section(std::string(!name.empty() ? name + "." : "" ) + "hue_saturation" ) |
| 1899 | , mode(this, "mode" , filters::HueSaturationFilter::Mode::HSL_MUL) |
| 1900 | { |
| 1901 | } |
| 1902 | |
| 1903 | void GlobalPref::HueSaturation::load() |
| 1904 | { |
| 1905 | load_option(mode); |
| 1906 | } |
| 1907 | |
| 1908 | void GlobalPref::HueSaturation::save() |
| 1909 | { |
| 1910 | save_option(mode); |
| 1911 | } |
| 1912 | |
| 1913 | Section* GlobalPref::HueSaturation::section(const char* id) |
| 1914 | { |
| 1915 | return nullptr; |
| 1916 | } |
| 1917 | |
| 1918 | OptionBase* GlobalPref::HueSaturation::option(const char* id) |
| 1919 | { |
| 1920 | if (std::strcmp(id, mode.id()) == 0) return &mode; |
| 1921 | return nullptr; |
| 1922 | } |
| 1923 | |
| 1924 | GlobalPref::Filters::Filters(const std::string& name) |
| 1925 | : Section(std::string(!name.empty() ? name + "." : "" ) + "filters" ) |
| 1926 | , celsTarget(this, "cels_target" , CelsTarget::Selected) |
| 1927 | { |
| 1928 | } |
| 1929 | |
| 1930 | void GlobalPref::Filters::load() |
| 1931 | { |
| 1932 | load_option(celsTarget); |
| 1933 | } |
| 1934 | |
| 1935 | void GlobalPref::Filters::save() |
| 1936 | { |
| 1937 | save_option(celsTarget); |
| 1938 | } |
| 1939 | |
| 1940 | Section* GlobalPref::Filters::section(const char* id) |
| 1941 | { |
| 1942 | return nullptr; |
| 1943 | } |
| 1944 | |
| 1945 | OptionBase* GlobalPref::Filters::option(const char* id) |
| 1946 | { |
| 1947 | if (std::strcmp(id, celsTarget.id()) == 0) return &celsTarget; |
| 1948 | return nullptr; |
| 1949 | } |
| 1950 | |
| 1951 | GlobalPref::Scripts::Scripts(const std::string& name) |
| 1952 | : Section(std::string(!name.empty() ? name + "." : "" ) + "scripts" ) |
| 1953 | , showRunScriptAlert(this, "show_run_script_alert" , true) |
| 1954 | { |
| 1955 | } |
| 1956 | |
| 1957 | void GlobalPref::Scripts::load() |
| 1958 | { |
| 1959 | load_option(showRunScriptAlert); |
| 1960 | } |
| 1961 | |
| 1962 | void GlobalPref::Scripts::save() |
| 1963 | { |
| 1964 | save_option(showRunScriptAlert); |
| 1965 | } |
| 1966 | |
| 1967 | Section* GlobalPref::Scripts::section(const char* id) |
| 1968 | { |
| 1969 | return nullptr; |
| 1970 | } |
| 1971 | |
| 1972 | OptionBase* GlobalPref::Scripts::option(const char* id) |
| 1973 | { |
| 1974 | if (std::strcmp(id, showRunScriptAlert.id()) == 0) return &showRunScriptAlert; |
| 1975 | return nullptr; |
| 1976 | } |
| 1977 | |
| 1978 | GlobalPref::Color::Color(const std::string& name) |
| 1979 | : Section(std::string(!name.empty() ? name + "." : "" ) + "color" ) |
| 1980 | , manage(this, "manage" , true) |
| 1981 | , workingRgbSpace(this, "working_rgb_space" , "sRGB" ) |
| 1982 | , filesWithProfile(this, "files_with_profile" , ColorProfileBehavior::EMBEDDED) |
| 1983 | , missingProfile(this, "missing_profile" , ColorProfileBehavior::ASSIGN) |
| 1984 | , windowProfile(this, "window_profile" , WindowColorProfile::MONITOR) |
| 1985 | , windowProfileName(this, "window_profile_name" ) |
| 1986 | { |
| 1987 | } |
| 1988 | |
| 1989 | void GlobalPref::Color::load() |
| 1990 | { |
| 1991 | load_option(manage); |
| 1992 | load_option(workingRgbSpace); |
| 1993 | load_option(filesWithProfile); |
| 1994 | load_option(missingProfile); |
| 1995 | load_option(windowProfile); |
| 1996 | load_option(windowProfileName); |
| 1997 | } |
| 1998 | |
| 1999 | void GlobalPref::Color::save() |
| 2000 | { |
| 2001 | save_option(manage); |
| 2002 | save_option(workingRgbSpace); |
| 2003 | save_option(filesWithProfile); |
| 2004 | save_option(missingProfile); |
| 2005 | save_option(windowProfile); |
| 2006 | save_option(windowProfileName); |
| 2007 | } |
| 2008 | |
| 2009 | Section* GlobalPref::Color::section(const char* id) |
| 2010 | { |
| 2011 | return nullptr; |
| 2012 | } |
| 2013 | |
| 2014 | OptionBase* GlobalPref::Color::option(const char* id) |
| 2015 | { |
| 2016 | if (std::strcmp(id, manage.id()) == 0) return &manage; |
| 2017 | if (std::strcmp(id, workingRgbSpace.id()) == 0) return &workingRgbSpace; |
| 2018 | if (std::strcmp(id, filesWithProfile.id()) == 0) return &filesWithProfile; |
| 2019 | if (std::strcmp(id, missingProfile.id()) == 0) return &missingProfile; |
| 2020 | if (std::strcmp(id, windowProfile.id()) == 0) return &windowProfile; |
| 2021 | if (std::strcmp(id, windowProfileName.id()) == 0) return &windowProfileName; |
| 2022 | return nullptr; |
| 2023 | } |
| 2024 | |
| 2025 | GlobalPref::CanvasSize::CanvasSize(const std::string& name) |
| 2026 | : Section(std::string(!name.empty() ? name + "." : "" ) + "canvas_size" ) |
| 2027 | , trimOutside(this, "trim_outside" , false) |
| 2028 | { |
| 2029 | } |
| 2030 | |
| 2031 | void GlobalPref::CanvasSize::load() |
| 2032 | { |
| 2033 | load_option(trimOutside); |
| 2034 | } |
| 2035 | |
| 2036 | void GlobalPref::CanvasSize::save() |
| 2037 | { |
| 2038 | save_option(trimOutside); |
| 2039 | } |
| 2040 | |
| 2041 | Section* GlobalPref::CanvasSize::section(const char* id) |
| 2042 | { |
| 2043 | return nullptr; |
| 2044 | } |
| 2045 | |
| 2046 | OptionBase* GlobalPref::CanvasSize::option(const char* id) |
| 2047 | { |
| 2048 | if (std::strcmp(id, trimOutside.id()) == 0) return &trimOutside; |
| 2049 | return nullptr; |
| 2050 | } |
| 2051 | |
| 2052 | GlobalPref::Tileset::Tileset(const std::string& name) |
| 2053 | : Section(std::string(!name.empty() ? name + "." : "" ) + "tileset" ) |
| 2054 | , baseIndex(this, "base_index" , 1) |
| 2055 | { |
| 2056 | } |
| 2057 | |
| 2058 | void GlobalPref::Tileset::load() |
| 2059 | { |
| 2060 | load_option(baseIndex); |
| 2061 | } |
| 2062 | |
| 2063 | void GlobalPref::Tileset::save() |
| 2064 | { |
| 2065 | save_option(baseIndex); |
| 2066 | } |
| 2067 | |
| 2068 | Section* GlobalPref::Tileset::section(const char* id) |
| 2069 | { |
| 2070 | return nullptr; |
| 2071 | } |
| 2072 | |
| 2073 | OptionBase* GlobalPref::Tileset::option(const char* id) |
| 2074 | { |
| 2075 | if (std::strcmp(id, baseIndex.id()) == 0) return &baseIndex; |
| 2076 | return nullptr; |
| 2077 | } |
| 2078 | |
| 2079 | ToolPref::ToolPref(const std::string& name) |
| 2080 | : Section(name) |
| 2081 | , opacity(this, "opacity" , 255) |
| 2082 | , tolerance(this, "tolerance" , 0) |
| 2083 | , contiguous(this, "contiguous" , true) |
| 2084 | , filled(this, "filled" , false) |
| 2085 | , filledPreview(this, "filled_preview" , false) |
| 2086 | , ink(this, "ink" , app::tools::InkType::DEFAULT) |
| 2087 | , freehandAlgorithm(this, "freehand_algorithm" , app::tools::FreehandAlgorithm::DEFAULT) |
| 2088 | , brush(name) |
| 2089 | , spray(name) |
| 2090 | , floodfill(name) |
| 2091 | { |
| 2092 | } |
| 2093 | |
| 2094 | void ToolPref::load() |
| 2095 | { |
| 2096 | load_option(opacity); |
| 2097 | load_option(tolerance); |
| 2098 | load_option(contiguous); |
| 2099 | load_option(filled); |
| 2100 | load_option(filledPreview); |
| 2101 | load_option(ink); |
| 2102 | load_option(freehandAlgorithm); |
| 2103 | brush.load(); |
| 2104 | spray.load(); |
| 2105 | floodfill.load(); |
| 2106 | } |
| 2107 | |
| 2108 | void ToolPref::save() |
| 2109 | { |
| 2110 | save_option(opacity); |
| 2111 | save_option(tolerance); |
| 2112 | save_option(contiguous); |
| 2113 | save_option(filled); |
| 2114 | save_option(filledPreview); |
| 2115 | save_option(ink); |
| 2116 | save_option(freehandAlgorithm); |
| 2117 | brush.save(); |
| 2118 | spray.save(); |
| 2119 | floodfill.save(); |
| 2120 | } |
| 2121 | |
| 2122 | Section* ToolPref::section(const char* id) |
| 2123 | { |
| 2124 | if (std::strcmp(id, brush.name()) == 0) return &brush; |
| 2125 | if (std::strcmp(id, spray.name()) == 0) return &spray; |
| 2126 | if (std::strcmp(id, floodfill.name()) == 0) return &floodfill; |
| 2127 | return nullptr; |
| 2128 | } |
| 2129 | |
| 2130 | OptionBase* ToolPref::option(const char* id) |
| 2131 | { |
| 2132 | if (std::strcmp(id, opacity.id()) == 0) return &opacity; |
| 2133 | if (std::strcmp(id, tolerance.id()) == 0) return &tolerance; |
| 2134 | if (std::strcmp(id, contiguous.id()) == 0) return &contiguous; |
| 2135 | if (std::strcmp(id, filled.id()) == 0) return &filled; |
| 2136 | if (std::strcmp(id, filledPreview.id()) == 0) return &filledPreview; |
| 2137 | if (std::strcmp(id, ink.id()) == 0) return &ink; |
| 2138 | if (std::strcmp(id, freehandAlgorithm.id()) == 0) return &freehandAlgorithm; |
| 2139 | return nullptr; |
| 2140 | } |
| 2141 | |
| 2142 | ToolPref::Brush::Brush(const std::string& name) |
| 2143 | : Section(std::string(!name.empty() ? name + "." : "" ) + "brush" ) |
| 2144 | , type(this, "type" , BrushType::CIRCLE) |
| 2145 | , size(this, "size" , 1) |
| 2146 | , angle(this, "angle" , 0) |
| 2147 | { |
| 2148 | } |
| 2149 | |
| 2150 | void ToolPref::Brush::load() |
| 2151 | { |
| 2152 | load_option(type); |
| 2153 | load_option(size); |
| 2154 | load_option(angle); |
| 2155 | } |
| 2156 | |
| 2157 | void ToolPref::Brush::save() |
| 2158 | { |
| 2159 | save_option(type); |
| 2160 | save_option(size); |
| 2161 | save_option(angle); |
| 2162 | } |
| 2163 | |
| 2164 | Section* ToolPref::Brush::section(const char* id) |
| 2165 | { |
| 2166 | return nullptr; |
| 2167 | } |
| 2168 | |
| 2169 | OptionBase* ToolPref::Brush::option(const char* id) |
| 2170 | { |
| 2171 | if (std::strcmp(id, type.id()) == 0) return &type; |
| 2172 | if (std::strcmp(id, size.id()) == 0) return &size; |
| 2173 | if (std::strcmp(id, angle.id()) == 0) return ∠ |
| 2174 | return nullptr; |
| 2175 | } |
| 2176 | |
| 2177 | ToolPref::Spray::Spray(const std::string& name) |
| 2178 | : Section(std::string(!name.empty() ? name + "." : "" ) + "spray" ) |
| 2179 | , width(this, "width" , 16) |
| 2180 | , speed(this, "speed" , 32) |
| 2181 | { |
| 2182 | } |
| 2183 | |
| 2184 | void ToolPref::Spray::load() |
| 2185 | { |
| 2186 | load_option(width); |
| 2187 | load_option(speed); |
| 2188 | } |
| 2189 | |
| 2190 | void ToolPref::Spray::save() |
| 2191 | { |
| 2192 | save_option(width); |
| 2193 | save_option(speed); |
| 2194 | } |
| 2195 | |
| 2196 | Section* ToolPref::Spray::section(const char* id) |
| 2197 | { |
| 2198 | return nullptr; |
| 2199 | } |
| 2200 | |
| 2201 | OptionBase* ToolPref::Spray::option(const char* id) |
| 2202 | { |
| 2203 | if (std::strcmp(id, width.id()) == 0) return &width; |
| 2204 | if (std::strcmp(id, speed.id()) == 0) return &speed; |
| 2205 | return nullptr; |
| 2206 | } |
| 2207 | |
| 2208 | ToolPref::Floodfill::Floodfill(const std::string& name) |
| 2209 | : Section(std::string(!name.empty() ? name + "." : "" ) + "floodfill" ) |
| 2210 | , stopAtGrid(this, "stop_at_grid" , StopAtGrid::NEVER) |
| 2211 | , referTo(this, "refer_to" , FillReferTo::ACTIVE_LAYER) |
| 2212 | , pixelConnectivity(this, "pixel_connectivity" , PixelConnectivity::FOUR_CONNECTED) |
| 2213 | { |
| 2214 | } |
| 2215 | |
| 2216 | void ToolPref::Floodfill::load() |
| 2217 | { |
| 2218 | load_option(stopAtGrid); |
| 2219 | load_option(referTo); |
| 2220 | load_option(pixelConnectivity); |
| 2221 | } |
| 2222 | |
| 2223 | void ToolPref::Floodfill::save() |
| 2224 | { |
| 2225 | save_option(stopAtGrid); |
| 2226 | save_option(referTo); |
| 2227 | save_option(pixelConnectivity); |
| 2228 | } |
| 2229 | |
| 2230 | Section* ToolPref::Floodfill::section(const char* id) |
| 2231 | { |
| 2232 | return nullptr; |
| 2233 | } |
| 2234 | |
| 2235 | OptionBase* ToolPref::Floodfill::option(const char* id) |
| 2236 | { |
| 2237 | if (std::strcmp(id, stopAtGrid.id()) == 0) return &stopAtGrid; |
| 2238 | if (std::strcmp(id, referTo.id()) == 0) return &referTo; |
| 2239 | if (std::strcmp(id, pixelConnectivity.id()) == 0) return &pixelConnectivity; |
| 2240 | return nullptr; |
| 2241 | } |
| 2242 | |
| 2243 | DocPref::DocPref(const std::string& name) |
| 2244 | : Section(name) |
| 2245 | , site(name) |
| 2246 | , tiled(name) |
| 2247 | , symmetry(name) |
| 2248 | , grid(name) |
| 2249 | , pixelGrid(name) |
| 2250 | , bg(name) |
| 2251 | , timeline(name) |
| 2252 | , thumbnails(name) |
| 2253 | , onionskin(name) |
| 2254 | , saveCopy(name) |
| 2255 | , spriteSheet(name) |
| 2256 | , importSpriteSheet(name) |
| 2257 | , preview(name) |
| 2258 | , show(name) |
| 2259 | { |
| 2260 | } |
| 2261 | |
| 2262 | void DocPref::load() |
| 2263 | { |
| 2264 | site.load(); |
| 2265 | tiled.load(); |
| 2266 | symmetry.load(); |
| 2267 | grid.load(); |
| 2268 | pixelGrid.load(); |
| 2269 | bg.load(); |
| 2270 | timeline.load(); |
| 2271 | thumbnails.load(); |
| 2272 | onionskin.load(); |
| 2273 | saveCopy.load(); |
| 2274 | spriteSheet.load(); |
| 2275 | importSpriteSheet.load(); |
| 2276 | preview.load(); |
| 2277 | show.load(); |
| 2278 | } |
| 2279 | |
| 2280 | void DocPref::save() |
| 2281 | { |
| 2282 | site.save(); |
| 2283 | tiled.save(); |
| 2284 | symmetry.save(); |
| 2285 | grid.save(); |
| 2286 | pixelGrid.save(); |
| 2287 | bg.save(); |
| 2288 | timeline.save(); |
| 2289 | thumbnails.save(); |
| 2290 | onionskin.save(); |
| 2291 | saveCopy.save(); |
| 2292 | spriteSheet.save(); |
| 2293 | importSpriteSheet.save(); |
| 2294 | preview.save(); |
| 2295 | show.save(); |
| 2296 | } |
| 2297 | |
| 2298 | Section* DocPref::section(const char* id) |
| 2299 | { |
| 2300 | if (std::strcmp(id, site.name()) == 0) return &site; |
| 2301 | if (std::strcmp(id, tiled.name()) == 0) return &tiled; |
| 2302 | if (std::strcmp(id, symmetry.name()) == 0) return &symmetry; |
| 2303 | if (std::strcmp(id, grid.name()) == 0) return &grid; |
| 2304 | if (std::strcmp(id, pixelGrid.name()) == 0) return &pixelGrid; |
| 2305 | if (std::strcmp(id, bg.name()) == 0) return &bg; |
| 2306 | if (std::strcmp(id, timeline.name()) == 0) return &timeline; |
| 2307 | if (std::strcmp(id, thumbnails.name()) == 0) return &thumbnails; |
| 2308 | if (std::strcmp(id, onionskin.name()) == 0) return &onionskin; |
| 2309 | if (std::strcmp(id, saveCopy.name()) == 0) return &saveCopy; |
| 2310 | if (std::strcmp(id, spriteSheet.name()) == 0) return &spriteSheet; |
| 2311 | if (std::strcmp(id, importSpriteSheet.name()) == 0) return &importSpriteSheet; |
| 2312 | if (std::strcmp(id, preview.name()) == 0) return &preview; |
| 2313 | if (std::strcmp(id, show.name()) == 0) return &show; |
| 2314 | return nullptr; |
| 2315 | } |
| 2316 | |
| 2317 | OptionBase* DocPref::option(const char* id) |
| 2318 | { |
| 2319 | return nullptr; |
| 2320 | } |
| 2321 | |
| 2322 | DocPref::Site::Site(const std::string& name) |
| 2323 | : Section(std::string(!name.empty() ? name + "." : "" ) + "site" ) |
| 2324 | , frame(this, "frame" , doc::frame_t(0)) |
| 2325 | , layer(this, "layer" , doc::layer_t(0)) |
| 2326 | { |
| 2327 | } |
| 2328 | |
| 2329 | void DocPref::Site::load() |
| 2330 | { |
| 2331 | load_option(frame); |
| 2332 | load_option(layer); |
| 2333 | } |
| 2334 | |
| 2335 | void DocPref::Site::save() |
| 2336 | { |
| 2337 | save_option(frame); |
| 2338 | save_option(layer); |
| 2339 | } |
| 2340 | |
| 2341 | Section* DocPref::Site::section(const char* id) |
| 2342 | { |
| 2343 | return nullptr; |
| 2344 | } |
| 2345 | |
| 2346 | OptionBase* DocPref::Site::option(const char* id) |
| 2347 | { |
| 2348 | if (std::strcmp(id, frame.id()) == 0) return &frame; |
| 2349 | if (std::strcmp(id, layer.id()) == 0) return &layer; |
| 2350 | return nullptr; |
| 2351 | } |
| 2352 | |
| 2353 | DocPref::Tiled::Tiled(const std::string& name) |
| 2354 | : Section(std::string(!name.empty() ? name + "." : "" ) + "tiled" ) |
| 2355 | , mode(this, "mode" , filters::TiledMode::NONE) |
| 2356 | { |
| 2357 | } |
| 2358 | |
| 2359 | void DocPref::Tiled::load() |
| 2360 | { |
| 2361 | load_option(mode); |
| 2362 | } |
| 2363 | |
| 2364 | void DocPref::Tiled::save() |
| 2365 | { |
| 2366 | save_option(mode); |
| 2367 | } |
| 2368 | |
| 2369 | Section* DocPref::Tiled::section(const char* id) |
| 2370 | { |
| 2371 | return nullptr; |
| 2372 | } |
| 2373 | |
| 2374 | OptionBase* DocPref::Tiled::option(const char* id) |
| 2375 | { |
| 2376 | if (std::strcmp(id, mode.id()) == 0) return &mode; |
| 2377 | return nullptr; |
| 2378 | } |
| 2379 | |
| 2380 | DocPref::Symmetry::Symmetry(const std::string& name) |
| 2381 | : Section(std::string(!name.empty() ? name + "." : "" ) + "symmetry" ) |
| 2382 | , mode(this, "mode" , SymmetryMode::NONE) |
| 2383 | , xAxis(this, "x_axis" , 0) |
| 2384 | , yAxis(this, "y_axis" , 0) |
| 2385 | { |
| 2386 | } |
| 2387 | |
| 2388 | void DocPref::Symmetry::load() |
| 2389 | { |
| 2390 | load_option(mode); |
| 2391 | load_option(xAxis); |
| 2392 | load_option(yAxis); |
| 2393 | } |
| 2394 | |
| 2395 | void DocPref::Symmetry::save() |
| 2396 | { |
| 2397 | save_option(mode); |
| 2398 | save_option(xAxis); |
| 2399 | save_option(yAxis); |
| 2400 | } |
| 2401 | |
| 2402 | Section* DocPref::Symmetry::section(const char* id) |
| 2403 | { |
| 2404 | return nullptr; |
| 2405 | } |
| 2406 | |
| 2407 | OptionBase* DocPref::Symmetry::option(const char* id) |
| 2408 | { |
| 2409 | if (std::strcmp(id, mode.id()) == 0) return &mode; |
| 2410 | if (std::strcmp(id, xAxis.id()) == 0) return &xAxis; |
| 2411 | if (std::strcmp(id, yAxis.id()) == 0) return &yAxis; |
| 2412 | return nullptr; |
| 2413 | } |
| 2414 | |
| 2415 | DocPref::Grid::Grid(const std::string& name) |
| 2416 | : Section(std::string(!name.empty() ? name + "." : "" ) + "grid" ) |
| 2417 | , snap(this, "snap" , false) |
| 2418 | , bounds(this, "bounds" , doc::Sprite::DefaultGridBounds()) |
| 2419 | , color(this, "color" , app::Color::fromRgb(0, 0, 255)) |
| 2420 | , opacity(this, "opacity" , 160) |
| 2421 | , autoOpacity(this, "auto_opacity" , true) |
| 2422 | { |
| 2423 | } |
| 2424 | |
| 2425 | void DocPref::Grid::forceSection() |
| 2426 | { |
| 2427 | snap.forceDirtyFlag(); |
| 2428 | bounds.forceDirtyFlag(); |
| 2429 | color.forceDirtyFlag(); |
| 2430 | opacity.forceDirtyFlag(); |
| 2431 | autoOpacity.forceDirtyFlag(); |
| 2432 | } |
| 2433 | |
| 2434 | void DocPref::Grid::load() |
| 2435 | { |
| 2436 | load_option(snap); |
| 2437 | load_option(bounds); |
| 2438 | load_option(color); |
| 2439 | load_option(opacity); |
| 2440 | load_option(autoOpacity); |
| 2441 | } |
| 2442 | |
| 2443 | void DocPref::Grid::save() |
| 2444 | { |
| 2445 | save_option(snap); |
| 2446 | save_option(bounds); |
| 2447 | save_option(color); |
| 2448 | save_option(opacity); |
| 2449 | save_option(autoOpacity); |
| 2450 | } |
| 2451 | |
| 2452 | Section* DocPref::Grid::section(const char* id) |
| 2453 | { |
| 2454 | return nullptr; |
| 2455 | } |
| 2456 | |
| 2457 | OptionBase* DocPref::Grid::option(const char* id) |
| 2458 | { |
| 2459 | if (std::strcmp(id, snap.id()) == 0) return &snap; |
| 2460 | if (std::strcmp(id, bounds.id()) == 0) return &bounds; |
| 2461 | if (std::strcmp(id, color.id()) == 0) return &color; |
| 2462 | if (std::strcmp(id, opacity.id()) == 0) return &opacity; |
| 2463 | if (std::strcmp(id, autoOpacity.id()) == 0) return &autoOpacity; |
| 2464 | return nullptr; |
| 2465 | } |
| 2466 | |
| 2467 | DocPref::PixelGrid::PixelGrid(const std::string& name) |
| 2468 | : Section(std::string(!name.empty() ? name + "." : "" ) + "pixel_grid" ) |
| 2469 | , color(this, "color" , app::Color::fromRgb(200, 200, 200)) |
| 2470 | , opacity(this, "opacity" , 160) |
| 2471 | , autoOpacity(this, "auto_opacity" , true) |
| 2472 | { |
| 2473 | } |
| 2474 | |
| 2475 | void DocPref::PixelGrid::forceSection() |
| 2476 | { |
| 2477 | color.forceDirtyFlag(); |
| 2478 | opacity.forceDirtyFlag(); |
| 2479 | autoOpacity.forceDirtyFlag(); |
| 2480 | } |
| 2481 | |
| 2482 | void DocPref::PixelGrid::load() |
| 2483 | { |
| 2484 | load_option(color); |
| 2485 | load_option(opacity); |
| 2486 | load_option(autoOpacity); |
| 2487 | } |
| 2488 | |
| 2489 | void DocPref::PixelGrid::save() |
| 2490 | { |
| 2491 | save_option(color); |
| 2492 | save_option(opacity); |
| 2493 | save_option(autoOpacity); |
| 2494 | } |
| 2495 | |
| 2496 | Section* DocPref::PixelGrid::section(const char* id) |
| 2497 | { |
| 2498 | return nullptr; |
| 2499 | } |
| 2500 | |
| 2501 | OptionBase* DocPref::PixelGrid::option(const char* id) |
| 2502 | { |
| 2503 | if (std::strcmp(id, color.id()) == 0) return &color; |
| 2504 | if (std::strcmp(id, opacity.id()) == 0) return &opacity; |
| 2505 | if (std::strcmp(id, autoOpacity.id()) == 0) return &autoOpacity; |
| 2506 | return nullptr; |
| 2507 | } |
| 2508 | |
| 2509 | DocPref::Bg::Bg(const std::string& name) |
| 2510 | : Section(std::string(!name.empty() ? name + "." : "" ) + "bg" ) |
| 2511 | , type(this, "type" , BgType::CHECKERED_16x16) |
| 2512 | , size(this, "size" , gfx::Size(16, 16)) |
| 2513 | , zoom(this, "zoom" , true) |
| 2514 | , color1(this, "color1" , app::Color::fromRgb(128, 128, 128)) |
| 2515 | , color2(this, "color2" , app::Color::fromRgb(192, 192, 192)) |
| 2516 | { |
| 2517 | } |
| 2518 | |
| 2519 | void DocPref::Bg::forceSection() |
| 2520 | { |
| 2521 | type.forceDirtyFlag(); |
| 2522 | size.forceDirtyFlag(); |
| 2523 | zoom.forceDirtyFlag(); |
| 2524 | color1.forceDirtyFlag(); |
| 2525 | color2.forceDirtyFlag(); |
| 2526 | } |
| 2527 | |
| 2528 | void DocPref::Bg::load() |
| 2529 | { |
| 2530 | load_option(type); |
| 2531 | load_option(size); |
| 2532 | load_option(zoom); |
| 2533 | load_option(color1); |
| 2534 | load_option(color2); |
| 2535 | } |
| 2536 | |
| 2537 | void DocPref::Bg::save() |
| 2538 | { |
| 2539 | save_option(type); |
| 2540 | save_option(size); |
| 2541 | save_option(zoom); |
| 2542 | save_option(color1); |
| 2543 | save_option(color2); |
| 2544 | } |
| 2545 | |
| 2546 | Section* DocPref::Bg::section(const char* id) |
| 2547 | { |
| 2548 | return nullptr; |
| 2549 | } |
| 2550 | |
| 2551 | OptionBase* DocPref::Bg::option(const char* id) |
| 2552 | { |
| 2553 | if (std::strcmp(id, type.id()) == 0) return &type; |
| 2554 | if (std::strcmp(id, size.id()) == 0) return &size; |
| 2555 | if (std::strcmp(id, zoom.id()) == 0) return &zoom; |
| 2556 | if (std::strcmp(id, color1.id()) == 0) return &color1; |
| 2557 | if (std::strcmp(id, color2.id()) == 0) return &color2; |
| 2558 | return nullptr; |
| 2559 | } |
| 2560 | |
| 2561 | DocPref::Timeline::Timeline(const std::string& name) |
| 2562 | : Section(std::string(!name.empty() ? name + "." : "" ) + "timeline" ) |
| 2563 | , firstFrame(this, "first_frame" , 1) |
| 2564 | { |
| 2565 | } |
| 2566 | |
| 2567 | void DocPref::Timeline::load() |
| 2568 | { |
| 2569 | load_option(firstFrame); |
| 2570 | } |
| 2571 | |
| 2572 | void DocPref::Timeline::save() |
| 2573 | { |
| 2574 | save_option(firstFrame); |
| 2575 | } |
| 2576 | |
| 2577 | Section* DocPref::Timeline::section(const char* id) |
| 2578 | { |
| 2579 | return nullptr; |
| 2580 | } |
| 2581 | |
| 2582 | OptionBase* DocPref::Timeline::option(const char* id) |
| 2583 | { |
| 2584 | if (std::strcmp(id, firstFrame.id()) == 0) return &firstFrame; |
| 2585 | return nullptr; |
| 2586 | } |
| 2587 | |
| 2588 | DocPref::Thumbnails::Thumbnails(const std::string& name) |
| 2589 | : Section(std::string(!name.empty() ? name + "." : "" ) + "thumbnails" ) |
| 2590 | , zoom(this, "zoom" , 1) |
| 2591 | , enabled(this, "enabled" , false) |
| 2592 | , overlayEnabled(this, "overlay_enabled" , false) |
| 2593 | , overlaySize(this, "overlay_size" , 5) |
| 2594 | { |
| 2595 | } |
| 2596 | |
| 2597 | void DocPref::Thumbnails::load() |
| 2598 | { |
| 2599 | load_option(zoom); |
| 2600 | load_option(enabled); |
| 2601 | load_option(overlayEnabled); |
| 2602 | load_option(overlaySize); |
| 2603 | } |
| 2604 | |
| 2605 | void DocPref::Thumbnails::save() |
| 2606 | { |
| 2607 | save_option(zoom); |
| 2608 | save_option(enabled); |
| 2609 | save_option(overlayEnabled); |
| 2610 | save_option(overlaySize); |
| 2611 | } |
| 2612 | |
| 2613 | Section* DocPref::Thumbnails::section(const char* id) |
| 2614 | { |
| 2615 | return nullptr; |
| 2616 | } |
| 2617 | |
| 2618 | OptionBase* DocPref::Thumbnails::option(const char* id) |
| 2619 | { |
| 2620 | if (std::strcmp(id, zoom.id()) == 0) return &zoom; |
| 2621 | if (std::strcmp(id, enabled.id()) == 0) return &enabled; |
| 2622 | if (std::strcmp(id, overlayEnabled.id()) == 0) return &overlayEnabled; |
| 2623 | if (std::strcmp(id, overlaySize.id()) == 0) return &overlaySize; |
| 2624 | return nullptr; |
| 2625 | } |
| 2626 | |
| 2627 | DocPref::Onionskin::Onionskin(const std::string& name) |
| 2628 | : Section(std::string(!name.empty() ? name + "." : "" ) + "onionskin" ) |
| 2629 | , active(this, "active" , false) |
| 2630 | , prevFrames(this, "prev_frames" , 1) |
| 2631 | , nextFrames(this, "next_frames" , 1) |
| 2632 | , opacityBase(this, "opacity_base" , 68) |
| 2633 | , opacityStep(this, "opacity_step" , 28) |
| 2634 | , type(this, "type" , OnionskinType::MERGE) |
| 2635 | , loopTag(this, "loop_tag" , true) |
| 2636 | , currentLayer(this, "current_layer" , false) |
| 2637 | , position(this, "position" , render::OnionskinPosition::BEHIND) |
| 2638 | { |
| 2639 | } |
| 2640 | |
| 2641 | void DocPref::Onionskin::load() |
| 2642 | { |
| 2643 | load_option(active); |
| 2644 | load_option(prevFrames); |
| 2645 | load_option(nextFrames); |
| 2646 | load_option(opacityBase); |
| 2647 | load_option(opacityStep); |
| 2648 | load_option(type); |
| 2649 | load_option(loopTag); |
| 2650 | load_option(currentLayer); |
| 2651 | load_option(position); |
| 2652 | } |
| 2653 | |
| 2654 | void DocPref::Onionskin::save() |
| 2655 | { |
| 2656 | save_option(active); |
| 2657 | save_option(prevFrames); |
| 2658 | save_option(nextFrames); |
| 2659 | save_option(opacityBase); |
| 2660 | save_option(opacityStep); |
| 2661 | save_option(type); |
| 2662 | save_option(loopTag); |
| 2663 | save_option(currentLayer); |
| 2664 | save_option(position); |
| 2665 | } |
| 2666 | |
| 2667 | Section* DocPref::Onionskin::section(const char* id) |
| 2668 | { |
| 2669 | return nullptr; |
| 2670 | } |
| 2671 | |
| 2672 | OptionBase* DocPref::Onionskin::option(const char* id) |
| 2673 | { |
| 2674 | if (std::strcmp(id, active.id()) == 0) return &active; |
| 2675 | if (std::strcmp(id, prevFrames.id()) == 0) return &prevFrames; |
| 2676 | if (std::strcmp(id, nextFrames.id()) == 0) return &nextFrames; |
| 2677 | if (std::strcmp(id, opacityBase.id()) == 0) return &opacityBase; |
| 2678 | if (std::strcmp(id, opacityStep.id()) == 0) return &opacityStep; |
| 2679 | if (std::strcmp(id, type.id()) == 0) return &type; |
| 2680 | if (std::strcmp(id, loopTag.id()) == 0) return &loopTag; |
| 2681 | if (std::strcmp(id, currentLayer.id()) == 0) return ¤tLayer; |
| 2682 | if (std::strcmp(id, position.id()) == 0) return &position; |
| 2683 | return nullptr; |
| 2684 | } |
| 2685 | |
| 2686 | DocPref::SaveCopy::SaveCopy(const std::string& name) |
| 2687 | : Section(std::string(!name.empty() ? name + "." : "" ) + "save_copy" ) |
| 2688 | , filename(this, "filename" ) |
| 2689 | , resizeScale(this, "resize_scale" , 1) |
| 2690 | , area(this, "area" ) |
| 2691 | , layer(this, "layer" ) |
| 2692 | , layerIndex(this, "layer_index" , -1) |
| 2693 | , frameTag(this, "frame_tag" ) |
| 2694 | , aniDir(this, "ani_dir" , doc::AniDir::FORWARD) |
| 2695 | , applyPixelRatio(this, "apply_pixel_ratio" , false) |
| 2696 | , forTwitter(this, "for_twitter" , false) |
| 2697 | { |
| 2698 | } |
| 2699 | |
| 2700 | void DocPref::SaveCopy::clearSection() |
| 2701 | { |
| 2702 | filename.clearValue(); |
| 2703 | resizeScale.clearValue(); |
| 2704 | area.clearValue(); |
| 2705 | layer.clearValue(); |
| 2706 | layerIndex.clearValue(); |
| 2707 | frameTag.clearValue(); |
| 2708 | aniDir.clearValue(); |
| 2709 | applyPixelRatio.clearValue(); |
| 2710 | forTwitter.clearValue(); |
| 2711 | } |
| 2712 | |
| 2713 | void DocPref::SaveCopy::load() |
| 2714 | { |
| 2715 | load_option(filename); |
| 2716 | load_option(resizeScale); |
| 2717 | load_option(area); |
| 2718 | load_option(layer); |
| 2719 | load_option(layerIndex); |
| 2720 | load_option(frameTag); |
| 2721 | load_option(aniDir); |
| 2722 | load_option(applyPixelRatio); |
| 2723 | load_option(forTwitter); |
| 2724 | } |
| 2725 | |
| 2726 | void DocPref::SaveCopy::save() |
| 2727 | { |
| 2728 | save_option(filename); |
| 2729 | save_option(resizeScale); |
| 2730 | save_option(area); |
| 2731 | save_option(layer); |
| 2732 | save_option(layerIndex); |
| 2733 | save_option(frameTag); |
| 2734 | save_option(aniDir); |
| 2735 | save_option(applyPixelRatio); |
| 2736 | save_option(forTwitter); |
| 2737 | } |
| 2738 | |
| 2739 | Section* DocPref::SaveCopy::section(const char* id) |
| 2740 | { |
| 2741 | return nullptr; |
| 2742 | } |
| 2743 | |
| 2744 | OptionBase* DocPref::SaveCopy::option(const char* id) |
| 2745 | { |
| 2746 | if (std::strcmp(id, filename.id()) == 0) return &filename; |
| 2747 | if (std::strcmp(id, resizeScale.id()) == 0) return &resizeScale; |
| 2748 | if (std::strcmp(id, area.id()) == 0) return &area; |
| 2749 | if (std::strcmp(id, layer.id()) == 0) return &layer; |
| 2750 | if (std::strcmp(id, layerIndex.id()) == 0) return &layerIndex; |
| 2751 | if (std::strcmp(id, frameTag.id()) == 0) return &frameTag; |
| 2752 | if (std::strcmp(id, aniDir.id()) == 0) return &aniDir; |
| 2753 | if (std::strcmp(id, applyPixelRatio.id()) == 0) return &applyPixelRatio; |
| 2754 | if (std::strcmp(id, forTwitter.id()) == 0) return &forTwitter; |
| 2755 | return nullptr; |
| 2756 | } |
| 2757 | |
| 2758 | DocPref::SpriteSheet::SpriteSheet(const std::string& name) |
| 2759 | : Section(std::string(!name.empty() ? name + "." : "" ) + "sprite_sheet" ) |
| 2760 | , defined(this, "defined" , false) |
| 2761 | , type(this, "type" , app::SpriteSheetType::None) |
| 2762 | , columns(this, "columns" , 0) |
| 2763 | , rows(this, "rows" , 0) |
| 2764 | , width(this, "width" , 0) |
| 2765 | , height(this, "height" , 0) |
| 2766 | , textureFilename(this, "texture_filename" ) |
| 2767 | , dataFilename(this, "data_filename" ) |
| 2768 | , dataFormat(this, "data_format" , SpriteSheetDataFormat::Default) |
| 2769 | , filenameFormat(this, "filename_format" ) |
| 2770 | , borderPadding(this, "border_padding" , 0) |
| 2771 | , shapePadding(this, "shape_padding" , 0) |
| 2772 | , innerPadding(this, "inner_padding" , 0) |
| 2773 | , trimSprite(this, "trim_sprite" , false) |
| 2774 | , trim(this, "trim" , false) |
| 2775 | , trimByGrid(this, "trim_by_grid" , false) |
| 2776 | , extrude(this, "extrude" , false) |
| 2777 | , mergeDuplicates(this, "merge_duplicates" , false) |
| 2778 | , ignoreEmpty(this, "ignore_empty" , false) |
| 2779 | , openGenerated(this, "open_generated" , false) |
| 2780 | , layer(this, "layer" ) |
| 2781 | , layerIndex(this, "layer_index" , -1) |
| 2782 | , frameTag(this, "frame_tag" ) |
| 2783 | , splitLayers(this, "split_layers" , false) |
| 2784 | , splitTags(this, "split_tags" , false) |
| 2785 | , splitGrid(this, "split_grid" , false) |
| 2786 | , listLayers(this, "list_layers" , true) |
| 2787 | , listFrameTags(this, "list_frame_tags" , true) |
| 2788 | , listSlices(this, "list_slices" , true) |
| 2789 | { |
| 2790 | } |
| 2791 | |
| 2792 | void DocPref::SpriteSheet::load() |
| 2793 | { |
| 2794 | load_option(defined); |
| 2795 | load_option(type); |
| 2796 | load_option(columns); |
| 2797 | load_option(rows); |
| 2798 | load_option(width); |
| 2799 | load_option(height); |
| 2800 | load_option(textureFilename); |
| 2801 | load_option(dataFilename); |
| 2802 | load_option(dataFormat); |
| 2803 | load_option(filenameFormat); |
| 2804 | load_option(borderPadding); |
| 2805 | load_option(shapePadding); |
| 2806 | load_option(innerPadding); |
| 2807 | load_option(trimSprite); |
| 2808 | load_option(trim); |
| 2809 | load_option(trimByGrid); |
| 2810 | load_option(extrude); |
| 2811 | load_option(mergeDuplicates); |
| 2812 | load_option(ignoreEmpty); |
| 2813 | load_option(openGenerated); |
| 2814 | load_option(layer); |
| 2815 | load_option(layerIndex); |
| 2816 | load_option(frameTag); |
| 2817 | load_option(splitLayers); |
| 2818 | load_option(splitTags); |
| 2819 | load_option(splitGrid); |
| 2820 | load_option(listLayers); |
| 2821 | load_option(listFrameTags); |
| 2822 | load_option(listSlices); |
| 2823 | } |
| 2824 | |
| 2825 | void DocPref::SpriteSheet::save() |
| 2826 | { |
| 2827 | save_option(defined); |
| 2828 | save_option(type); |
| 2829 | save_option(columns); |
| 2830 | save_option(rows); |
| 2831 | save_option(width); |
| 2832 | save_option(height); |
| 2833 | save_option(textureFilename); |
| 2834 | save_option(dataFilename); |
| 2835 | save_option(dataFormat); |
| 2836 | save_option(filenameFormat); |
| 2837 | save_option(borderPadding); |
| 2838 | save_option(shapePadding); |
| 2839 | save_option(innerPadding); |
| 2840 | save_option(trimSprite); |
| 2841 | save_option(trim); |
| 2842 | save_option(trimByGrid); |
| 2843 | save_option(extrude); |
| 2844 | save_option(mergeDuplicates); |
| 2845 | save_option(ignoreEmpty); |
| 2846 | save_option(openGenerated); |
| 2847 | save_option(layer); |
| 2848 | save_option(layerIndex); |
| 2849 | save_option(frameTag); |
| 2850 | save_option(splitLayers); |
| 2851 | save_option(splitTags); |
| 2852 | save_option(splitGrid); |
| 2853 | save_option(listLayers); |
| 2854 | save_option(listFrameTags); |
| 2855 | save_option(listSlices); |
| 2856 | } |
| 2857 | |
| 2858 | Section* DocPref::SpriteSheet::section(const char* id) |
| 2859 | { |
| 2860 | return nullptr; |
| 2861 | } |
| 2862 | |
| 2863 | OptionBase* DocPref::SpriteSheet::option(const char* id) |
| 2864 | { |
| 2865 | if (std::strcmp(id, defined.id()) == 0) return &defined; |
| 2866 | if (std::strcmp(id, type.id()) == 0) return &type; |
| 2867 | if (std::strcmp(id, columns.id()) == 0) return &columns; |
| 2868 | if (std::strcmp(id, rows.id()) == 0) return &rows; |
| 2869 | if (std::strcmp(id, width.id()) == 0) return &width; |
| 2870 | if (std::strcmp(id, height.id()) == 0) return &height; |
| 2871 | if (std::strcmp(id, textureFilename.id()) == 0) return &textureFilename; |
| 2872 | if (std::strcmp(id, dataFilename.id()) == 0) return &dataFilename; |
| 2873 | if (std::strcmp(id, dataFormat.id()) == 0) return &dataFormat; |
| 2874 | if (std::strcmp(id, filenameFormat.id()) == 0) return &filenameFormat; |
| 2875 | if (std::strcmp(id, borderPadding.id()) == 0) return &borderPadding; |
| 2876 | if (std::strcmp(id, shapePadding.id()) == 0) return &shapePadding; |
| 2877 | if (std::strcmp(id, innerPadding.id()) == 0) return &innerPadding; |
| 2878 | if (std::strcmp(id, trimSprite.id()) == 0) return &trimSprite; |
| 2879 | if (std::strcmp(id, trim.id()) == 0) return &trim; |
| 2880 | if (std::strcmp(id, trimByGrid.id()) == 0) return &trimByGrid; |
| 2881 | if (std::strcmp(id, extrude.id()) == 0) return &extrude; |
| 2882 | if (std::strcmp(id, mergeDuplicates.id()) == 0) return &mergeDuplicates; |
| 2883 | if (std::strcmp(id, ignoreEmpty.id()) == 0) return &ignoreEmpty; |
| 2884 | if (std::strcmp(id, openGenerated.id()) == 0) return &openGenerated; |
| 2885 | if (std::strcmp(id, layer.id()) == 0) return &layer; |
| 2886 | if (std::strcmp(id, layerIndex.id()) == 0) return &layerIndex; |
| 2887 | if (std::strcmp(id, frameTag.id()) == 0) return &frameTag; |
| 2888 | if (std::strcmp(id, splitLayers.id()) == 0) return &splitLayers; |
| 2889 | if (std::strcmp(id, splitTags.id()) == 0) return &splitTags; |
| 2890 | if (std::strcmp(id, splitGrid.id()) == 0) return &splitGrid; |
| 2891 | if (std::strcmp(id, listLayers.id()) == 0) return &listLayers; |
| 2892 | if (std::strcmp(id, listFrameTags.id()) == 0) return &listFrameTags; |
| 2893 | if (std::strcmp(id, listSlices.id()) == 0) return &listSlices; |
| 2894 | return nullptr; |
| 2895 | } |
| 2896 | |
| 2897 | DocPref::ImportSpriteSheet::ImportSpriteSheet(const std::string& name) |
| 2898 | : Section(std::string(!name.empty() ? name + "." : "" ) + "import_sprite_sheet" ) |
| 2899 | , type(this, "type" , app::SpriteSheetType::Rows) |
| 2900 | , bounds(this, "bounds" , gfx::Rect(0, 0, 0, 0)) |
| 2901 | , paddingEnabled(this, "padding_enabled" , false) |
| 2902 | , paddingBounds(this, "padding_bounds" , gfx::Size(0, 0)) |
| 2903 | , partialTiles(this, "partial_tiles" , false) |
| 2904 | { |
| 2905 | } |
| 2906 | |
| 2907 | void DocPref::ImportSpriteSheet::load() |
| 2908 | { |
| 2909 | load_option(type); |
| 2910 | load_option(bounds); |
| 2911 | load_option(paddingEnabled); |
| 2912 | load_option(paddingBounds); |
| 2913 | load_option(partialTiles); |
| 2914 | } |
| 2915 | |
| 2916 | void DocPref::ImportSpriteSheet::save() |
| 2917 | { |
| 2918 | save_option(type); |
| 2919 | save_option(bounds); |
| 2920 | save_option(paddingEnabled); |
| 2921 | save_option(paddingBounds); |
| 2922 | save_option(partialTiles); |
| 2923 | } |
| 2924 | |
| 2925 | Section* DocPref::ImportSpriteSheet::section(const char* id) |
| 2926 | { |
| 2927 | return nullptr; |
| 2928 | } |
| 2929 | |
| 2930 | OptionBase* DocPref::ImportSpriteSheet::option(const char* id) |
| 2931 | { |
| 2932 | if (std::strcmp(id, type.id()) == 0) return &type; |
| 2933 | if (std::strcmp(id, bounds.id()) == 0) return &bounds; |
| 2934 | if (std::strcmp(id, paddingEnabled.id()) == 0) return &paddingEnabled; |
| 2935 | if (std::strcmp(id, paddingBounds.id()) == 0) return &paddingBounds; |
| 2936 | if (std::strcmp(id, partialTiles.id()) == 0) return &partialTiles; |
| 2937 | return nullptr; |
| 2938 | } |
| 2939 | |
| 2940 | DocPref::Preview::Preview(const std::string& name) |
| 2941 | : Section(std::string(!name.empty() ? name + "." : "" ) + "preview" ) |
| 2942 | , zoom(this, "zoom" , 1.0) |
| 2943 | , scroll(this, "scroll" ) |
| 2944 | , autoScroll(this, "auto_scroll" , true) |
| 2945 | { |
| 2946 | } |
| 2947 | |
| 2948 | void DocPref::Preview::load() |
| 2949 | { |
| 2950 | load_option(zoom); |
| 2951 | load_option(scroll); |
| 2952 | load_option(autoScroll); |
| 2953 | } |
| 2954 | |
| 2955 | void DocPref::Preview::save() |
| 2956 | { |
| 2957 | save_option(zoom); |
| 2958 | save_option(scroll); |
| 2959 | save_option(autoScroll); |
| 2960 | } |
| 2961 | |
| 2962 | Section* DocPref::Preview::section(const char* id) |
| 2963 | { |
| 2964 | return nullptr; |
| 2965 | } |
| 2966 | |
| 2967 | OptionBase* DocPref::Preview::option(const char* id) |
| 2968 | { |
| 2969 | if (std::strcmp(id, zoom.id()) == 0) return &zoom; |
| 2970 | if (std::strcmp(id, scroll.id()) == 0) return &scroll; |
| 2971 | if (std::strcmp(id, autoScroll.id()) == 0) return &autoScroll; |
| 2972 | return nullptr; |
| 2973 | } |
| 2974 | |
| 2975 | DocPref::Show::Show(const std::string& name) |
| 2976 | : Section(std::string(!name.empty() ? name + "." : "" ) + "show" ) |
| 2977 | , layerEdges(this, "layer_edges" , false) |
| 2978 | , selectionEdges(this, "selection_edges" , true) |
| 2979 | , grid(this, "grid" , false) |
| 2980 | , pixelGrid(this, "pixel_grid" , false) |
| 2981 | , brushPreview(this, "brush_preview" , true) |
| 2982 | , slices(this, "slices" , true) |
| 2983 | , autoGuides(this, "auto_guides" , true) |
| 2984 | , tileNumbers(this, "tile_numbers" , true) |
| 2985 | { |
| 2986 | } |
| 2987 | |
| 2988 | void DocPref::Show::load() |
| 2989 | { |
| 2990 | load_option(layerEdges); |
| 2991 | load_option(selectionEdges); |
| 2992 | load_option(grid); |
| 2993 | load_option(pixelGrid); |
| 2994 | load_option(brushPreview); |
| 2995 | load_option(slices); |
| 2996 | load_option(autoGuides); |
| 2997 | load_option(tileNumbers); |
| 2998 | } |
| 2999 | |
| 3000 | void DocPref::Show::save() |
| 3001 | { |
| 3002 | save_option(layerEdges); |
| 3003 | save_option(selectionEdges); |
| 3004 | save_option(grid); |
| 3005 | save_option(pixelGrid); |
| 3006 | save_option(brushPreview); |
| 3007 | save_option(slices); |
| 3008 | save_option(autoGuides); |
| 3009 | save_option(tileNumbers); |
| 3010 | } |
| 3011 | |
| 3012 | Section* DocPref::Show::section(const char* id) |
| 3013 | { |
| 3014 | return nullptr; |
| 3015 | } |
| 3016 | |
| 3017 | OptionBase* DocPref::Show::option(const char* id) |
| 3018 | { |
| 3019 | if (std::strcmp(id, layerEdges.id()) == 0) return &layerEdges; |
| 3020 | if (std::strcmp(id, selectionEdges.id()) == 0) return &selectionEdges; |
| 3021 | if (std::strcmp(id, grid.id()) == 0) return &grid; |
| 3022 | if (std::strcmp(id, pixelGrid.id()) == 0) return &pixelGrid; |
| 3023 | if (std::strcmp(id, brushPreview.id()) == 0) return &brushPreview; |
| 3024 | if (std::strcmp(id, slices.id()) == 0) return &slices; |
| 3025 | if (std::strcmp(id, autoGuides.id()) == 0) return &autoGuides; |
| 3026 | if (std::strcmp(id, tileNumbers.id()) == 0) return &tileNumbers; |
| 3027 | return nullptr; |
| 3028 | } |
| 3029 | |
| 3030 | } // namespace gen |
| 3031 | } // namespace app |
| 3032 | |