1 /* 2 For general Scribus (>=1.3.2) copyright and licensing information please refer 3 to the COPYING file provided with the program. Following this notice may exist 4 a copyright and/or license notice that predates the release of Scribus 1.3.2 5 for which a new license (GPL+exception) is in place. 6 */ 7 #ifndef PREFSSTRUCTS_H 8 #define PREFSSTRUCTS_H 9 10 #ifdef HAVE_CONFIG_H 11 #include "scconfig.h" 12 #endif 13 14 #include <cstring> 15 16 #include <QColor> 17 #include <QString> 18 #include <QList> 19 #include <QSet> 20 #include <QHash> 21 22 #include "documentinformation.h" 23 #include "pagestructs.h" 24 #include "pdfoptions.h" 25 #include "scfonts.h" 26 #include "scpattern.h" 27 #include "sctextstruct.h" 28 #include "vgradient.h" 29 30 struct CheckerPrefs 31 { CheckerPrefsCheckerPrefs32 CheckerPrefs() { 33 memset(this, 0, sizeof(CheckerPrefs)); 34 } 35 36 bool ignoreErrors; 37 bool autoCheck; 38 bool checkGlyphs; 39 bool checkOverflow; 40 bool checkOrphans; 41 bool checkPictures; 42 bool checkResolution; 43 double minResolution; 44 double maxResolution; 45 bool checkTransparency; 46 bool checkAnnotations; 47 bool checkRasterPDF; 48 bool checkForGIF; 49 bool ignoreOffLayers; 50 bool checkOffConflictLayers; //Check whether layers are marked as visible but not to be printed or vice versa 51 bool checkNotCMYKOrSpot; // colors must be either CMYK or spot (PDF/X-1a) 52 bool checkDeviceColorsAndOutputIntent; // unmanaged colors (device colors) must agree with output intend 53 bool checkFontNotEmbedded; // embedded PDF might use fonts without embedding 54 bool checkFontIsOpenType; // embedded PDF might use OpenType font program (only allowed in PDF/X-4 and PDF 1.6) 55 bool checkPartFilledImageFrames; 56 bool checkOppositePageMaster; 57 bool checkAppliedMasterDifferentSide; 58 bool checkEmptyTextFrames; 59 }; 60 61 typedef QMap<QString, CheckerPrefs> CheckerPrefsList; 62 63 struct VerifierPrefs 64 { 65 CheckerPrefsList checkerPrefsList; 66 bool showPagesWithoutErrors; 67 bool showNonPrintingLayerErrors; 68 QString curCheckProfile; 69 }; 70 71 struct TypoPrefs 72 { 73 int valueSuperScript; //! Displacement of superscript 74 int scalingSuperScript; //! Scaling of superscript 75 int valueSubScript; //! Displacement of subscript 76 int scalingSubScript; //! Scaling of subscript 77 int valueSmallCaps; //! Scaling of small caps 78 int autoLineSpacing; //! Automatic line spacing percentage 79 int valueUnderlinePos; //! Underline displacement 80 int valueUnderlineWidth; //! Underline width 81 int valueStrikeThruPos; //! Strike-through displacement 82 int valueStrikeThruWidth; //! Strike-through line width 83 84 inline bool operator==(const TypoPrefs &other) const 85 { 86 return (memcmp(this, &other, sizeof(TypoPrefs)) == 0); 87 } 88 inline bool operator!=(const TypoPrefs &other) const 89 { 90 return (memcmp(this, &other, sizeof(TypoPrefs)) != 0); 91 } 92 }; 93 94 struct WindowPrefs 95 { 96 int xPosition {0}; 97 int yPosition {0}; 98 int width {640}; 99 int height {480}; 100 bool visible {true}; 101 bool docked {false}; 102 bool maximized {false}; 103 int screenNumber {0}; 104 }; 105 106 struct tabPrefs 107 { 108 int activeTab; 109 QStringList palettes; 110 }; 111 112 //User Interface 113 struct UIPrefs 114 { 115 int mouseMoveTimeout {150}; //! Mouse move timeout for move/resize operations 116 int wheelJump {40}; //! Distance to jump with mouse wheel scrolling 117 int applicationFontSize {12}; //! Font size to use in the application, apart from pßalettes 118 int paletteFontSize {10}; //! Font size to use in the palettes 119 QString style; //! Currently used QStyle name 120 int recentDocCount {5}; //! Number of recent documents to remember 121 QStringList RecentDocs; //! List of recent documents 122 QString language; //! Language of the user interface 123 QString userPreferredLocale; //! System or interface language number formats 124 bool useSmallWidgets {false}; //! Use small widgets in the palettes 125 bool useTabs {false}; //! Use a tabbed MainWidget a la FireFox 126 bool showStartupDialog {true}; //! Whether to show the startup dialog or not 127 bool showSplashOnStartup {true}; //! Whether to show the splashscreen or not 128 bool stickyTools {false}; //! Whether a user's tool section remains after use or the normal tool is reselected 129 bool grayscaleIcons {false}; //! Show icons in toolbars as grayscale 130 QString iconSet; //! Icon set name 131 WindowPrefs mainWinSettings; 132 QByteArray mainWinState; 133 QList<tabPrefs> tabbedPalettes; 134 }; 135 136 //Paths 137 struct PathPrefs 138 { 139 QString documents; //! Default document location 140 QString colorProfiles; //! Default color profile location 141 QString scripts; //! Default script location 142 QString documentTemplates; //! Default document template location 143 }; 144 145 //Document Setup 146 struct DocumentSetupPrefs 147 { 148 QString language; //! Default language of a document 149 QString pageSize; //! Default page size of a document 150 int pageOrientation; //! Default orientation of the page 151 double pageWidth; //! Width of a page 152 double pageHeight; //! Height of a page 153 MarginStruct margins; //! Margins for a page 154 MarginStruct bleeds; //! Bleeds for a page 155 int marginPreset; //! Use a preset ratio margin setup 156 int pagePositioning; //! Show pages in 1,2,3,4 pages side by side on screen 157 int docUnitIndex; //! The index of the default unit 158 bool AutoSave; 159 int AutoSaveTime; 160 int AutoSaveCount; 161 bool AutoSaveKeep; 162 bool AutoSaveLocation; 163 QString AutoSaveDir; 164 bool saveCompressed; 165 }; 166 167 //Guides 168 struct GuidesPrefs 169 { 170 QList<int> renderStackOrder; 171 // render stack id 0 = PageMargins 172 // render stack id 1 = BaselineGrid 173 // render stack id 2 = Grid 174 // render stack id 3 = Guides 175 // render stack id 4 = Items 176 int gridType; 177 // type 0 lines 178 // type 1 crosses and dots 179 180 int grabRadius; 181 double guideRad; 182 183 bool guidesShown; //! Show the guides or not 184 bool marginsShown; //! Show the margins or not 185 bool gridShown; //! Show the grid or not 186 bool baselineGridShown; //! Show the baseline grid or not 187 bool framesShown; //! Show frame borders or not 188 bool colBordersShown; //! Show text frame column borders or not 189 bool layerMarkersShown; //! Show a layer indicator when layers are active or not 190 bool linkShown; //! Show text frame links or not 191 bool rulersShown; //! Show the page rulers or not 192 193 double majorGridSpacing; //! Major grid spacing 194 double minorGridSpacing; //! Minor grid spacing 195 double valueBaselineGrid; //! Baseline grid spacing 196 double offsetBaselineGrid; //! Offset of first line of baseline grid from top of page 197 198 bool showPic; 199 bool showControls; 200 bool showBleed; 201 bool rulerMode; 202 203 204 205 QColor guideColor; //! Color of guides 206 QColor marginColor; //! Color of margins 207 QColor majorGridColor; //! Color of major grid 208 QColor minorGridColor; //! Color of minor grid 209 QColor baselineGridColor; //! Color of baseline grid 210 }; 211 212 struct ItemToolPrefs 213 { 214 /* Texttool */ 215 QString textFont; //! Default font for text frames, should be default font for default style 216 int textSize; //! Default font size 217 QString textColor; //! Default text color 218 int textShade; //! Default text color shade 219 QString textStrokeColor; //! Default text stroke color 220 int textStrokeShade; //! Default text stroke color shade 221 QString textFillColor; //! Default text frame fill color 222 QString textLineColor; //! Default text frame line color 223 int textFillColorShade; //! Default text frame fill shade 224 int textLineColorShade; //! Default text frame line shade 225 int textColumns; //! Default number of columns in a text frame 226 double textColumnGap; //! Default gap between columns of a text frame 227 QString textTabFillChar; //! Default tab fill character 228 MarginStruct textDistances; //! Default text to frame distances 229 double textTabWidth; //! Default tab width 230 FirstLineOffsetPolicy firstLineOffset; //! Default first line offset of text frame 231 /* ShapeTool */ 232 QString shapeLineColor; //! Default shape line color 233 QString shapeFillColor; //! Default shape fill color 234 int shapeFillColorShade; //! Default shape fill color shade 235 int shapeLineColorShade; //! Default shape line color shade 236 int shapeLineStyle; //! Line style of shapes 237 double shapeLineWidth; //! Line width of shape 238 /* Line Tool */ 239 QString lineColor; //! Color of a line 240 int lineColorShade; //! Shade of line color 241 double lineWidth; //! Width of line 242 int lineStyle; //! Style of line 243 int lineStartArrow; //! Starting arrow, 0 = none 244 int lineEndArrow; //! Ending arrow, 0 = none 245 /* Regular Polygon Tool */ 246 int polyCorners; //! Number of corners for a polygon 247 double polyFactor; //! Convex/Concave factor as a double 248 bool polyUseFactor; //! Whether to use a factor for shaping 249 double polyRotation; //! Rotation of a polygon 250 double polyInnerRot; //! Rotation of the inner points of a star 251 double polyCurvature; //! Curvature of polygon 252 double polyOuterCurvature; //! outer Curvature of polygon 253 /* Image Tool */ 254 QString imageFillColor; //! Default fill color of an image frame 255 int imageFillColorShade; //! Default shade of fill color of an image grame 256 QString imageStrokeColor; //! Default stroke color of an image frame 257 int imageStrokeColorShade; //! Default shade of stroke color of an image grame 258 double imageScaleX; //! X scale of an image within an image frame 259 double imageScaleY; //! Y scale of an image within an image frame 260 bool imageScaleType; //! Scale type of image 261 bool imageAspectRatio; //! Use stored aspect ratio for the image 262 int imageLowResType; //! Preview type for an image frame 263 bool imageUseEmbeddedPath; //! Use embedded path, eg from an EPS etc. 264 /* Calligraphic Pen Tool */ 265 QString calligraphicPenFillColor; //! Default calligrapicPen fill color 266 QString calligraphicPenLineColor; //! Default calligrapicPen line color 267 int calligraphicPenFillColorShade; //! Default calligrapicPen fill shade 268 int calligraphicPenLineColorShade; //! Default calligrapicPen line shade 269 double calligraphicPenLineWidth; //! Width of line 270 double calligraphicPenAngle; //! Angle of the calligraphics Brush 271 double calligraphicPenWidth; //! Width of the calligraphics Brush 272 int calligraphicPenStyle; //! Line style of the calligraphics Brush 273 /* Arc Tool */ 274 double arcStartAngle; //! angle where the arc starts 275 double arcSweepAngle; //! angle the arc spans 276 /* Spiral Tool */ 277 double spiralStartAngle; //! angle where the spiral starts 278 double spiralEndAngle; //! angle where the spiral ends 279 double spiralFactor; //! factor the spiral gets smaller 280 }; 281 282 struct OperatorToolPrefs 283 { 284 /* Magnifier Tool */ 285 int magMin; //! Magnification minimum 286 int magMax; //! Magnification maximum 287 int magStep; //! Default step between magnification levels 288 /* Item Duplicate Offset */ 289 double dispX; 290 double dispY; 291 /* Rotation Tool constrain value */ 292 double constrain; //! Angle to constrain rotation to when constraining is active 293 }; 294 295 struct HyphenatorPrefs 296 { 297 QHash<QString, QString> specialWords; //! List of special words to hyphenate 298 QSet<QString> ignoredWords; //! List of words the hyphenator ignores 299 bool Automatic; 300 bool AutoCheck; 301 }; 302 303 struct FontPrefs 304 { 305 SCFonts AvailFonts; //! Fonts that Scribus has available to it, or the current document has available to use 306 bool askBeforeSubstitute; //! Request that the user confirms a font substituion or not 307 QMap<QString,QString> GFontSub; 308 }; 309 310 struct PrinterPrefs 311 { 312 QString PrinterName; //! Default Printer name (source from CUPS) 313 QString PrinterFile; //! File to print to 314 QString PrinterCommand; //! Special printer command to use 315 bool ClipMargin; //! When printing, clip the print job to the margins 316 bool GCRMode; 317 }; 318 319 struct ColorPrefs 320 { 321 ColorList DColors; 322 QString DColorSet; 323 CMSData DCMSset; 324 }; 325 326 struct ItemAttrPrefs 327 { 328 ObjAttrVector defaultItemAttributes; //! The default item attributes 329 }; 330 331 struct TOCPrefs 332 { 333 ToCSetupVector defaultToCSetups; //! Default Tables of Contents 334 }; 335 336 struct KeyboardShortcutsPrefs 337 { 338 QMap<QString,Keys> KeyActions; //! Keyboard Shortcuts lists for the ScrActions 339 }; 340 341 struct ScrapbookPrefs 342 { 343 QStringList RecentScrapbooks; //! List of recently used scrapbooks 344 int numScrapbookCopies; 345 bool doCopyToScrapbook; //! When copying (copy/paste), also copy to a scrapbook 346 bool persistentScrapbook; //! Keep the scrapbook contents between sessions 347 bool writePreviews; //! Write previews to the scrapbook dir; 348 }; 349 350 struct DisplayPrefs 351 { 352 bool marginColored; //! Indicates if the margin to edge of page area will be colored in some other color or not 353 bool showPageShadow; //! Show a shadow around the pages 354 QColor paperColor; //! Color of paper (onscreen only) 355 QColor scratchColor; //! Color of scratch space (onscreen only) 356 QColor frameColor; //! Color of frame border (onscreen only) 357 QColor frameNormColor; //! Color of normal frame border (onscreen only) 358 QColor frameGroupColor; //! Color of border of grouped frames (onscreen only) 359 QColor frameLinkColor; //! Color of frame link indicators (onscreen only) 360 QColor frameLockColor; //! Color of locked frame border (onscreen only) 361 QColor frameAnnotationColor; //! Color of annotation frames border (onscreen only) 362 QColor pageBorderColor; //! Color of page border (onscreen only) 363 QColor controlCharColor; //! Color of control characters in text frames if they are shown (onscreen only) 364 bool showToolTips; //! Show tool tips in the GUI or not. 365 bool showMouseCoordinates; //! Show mouse coordinates when interaction with frames 366 MarginStruct scratch; //! Scratch space distances 367 double pageGapHorizontal; //! Horizontal gap between pages 368 double pageGapVertical; //! Vertical gap between pages 369 double displayScale; //! Display scale, typically used to set the scale of the display to 100% of real values. 370 bool showVerifierWarningsOnCanvas; //! Show preflight verifier warnings on canvas 371 bool showAutosaveClockOnCanvas; //! Show autosave countdown on canvas 372 }; 373 374 struct ExternalToolsPrefs 375 { 376 QString gs_exe; //! Location on the system of the Ghostscript interpreter (gs, gswin32c.exe, etc) incl path 377 bool gs_AntiAliasText; //! Tell Ghostscript to antialias text or not 378 bool gs_AntiAliasGraphics; //! Tell Ghostscript to antialias graphics or not 379 int gs_Resolution; //! Resolution of Ghostscript rendered graphics 380 QString imageEditorExecutable; //! Editor for graphics, defaults to Gimp 381 QString extBrowserExecutable; //! External browser for launching URLs in 382 QString uniconvExecutable; //! Uniconverter executable location 383 QStringList latexConfigs; 384 QMap<QString, QString> latexCommands; 385 QString latexEditorExecutable; //! LaTeX executable location 386 int latexResolution; //! LaTeX export resolution 387 bool latexForceDpi; 388 bool latexStartWithEmptyFrames; 389 QString pdfViewerExecutable; //! Viewer for PDF files 390 }; 391 392 struct MiscellaneousPrefs 393 { 394 bool haveStylePreview; //! Show previews in the Style setup areas like Style Manager 395 bool saveEmergencyFile; //! true = try to save emergency files when crashing 396 397 // lorem ipsum 398 bool useStandardLI; //! Use the standard Lorem Ipsum text 399 int paragraphsLI; //! Number of paragraphs to insert with Lorem Ipsum text 400 }; 401 402 struct StoryEditorPrefs 403 { 404 QColor guiFontColorBackground; //! Legacy, kept for now so as to not break prefs for users using older Scribus versions 405 QString guiFont; //! Font of the text used in the Story Editor window 406 bool smartTextSelection; //! Use smart text selection (relates to spacing mostly) 407 }; 408 409 struct PrintPreviewPrefs 410 { 411 bool PrPr_Mode { false }; 412 bool PrPr_AntiAliasing { true }; 413 bool PrPr_Transparency { false }; 414 bool PrPr_C { true }; 415 bool PrPr_M { true }; 416 bool PrPr_Y { true }; 417 bool PrPr_K { true }; 418 bool PrPr_InkCoverage { false }; 419 int PrPr_InkThreshold { 250 }; 420 }; 421 422 struct PDFOutputPreviewPrefs 423 { 424 bool enableAntiAliasing { true }; 425 bool showTransparency { false }; 426 bool cmykPreviewMode { false }; 427 bool isCyanVisible { true }; 428 bool isMagentaVisible { true }; 429 bool isYellowVisible { true }; 430 bool isBlackVisible { true }; 431 bool displayInkCoverage { false }; 432 int inkCoverageThreshold { 250 }; 433 }; 434 435 struct PSOutputPreviewPrefs 436 { 437 int psLevel { 3 }; 438 bool enableAntiAliasing { true }; 439 bool showTransparency { false }; 440 bool cmykPreviewMode { false }; 441 bool isCyanVisible { true }; 442 bool isMagentaVisible { true }; 443 bool isYellowVisible { true }; 444 bool isBlackVisible { true }; 445 bool displayInkCoverage { false }; 446 int inkCoverageThreshold { 250 }; 447 }; 448 449 struct PluginPrefs 450 { 451 }; 452 453 struct ShortWordPrefs 454 { 455 }; 456 457 struct ScripterPrefs 458 { 459 }; 460 461 // Image Cache 462 struct ImageCachePrefs 463 { 464 bool cacheEnabled; //!< Enable the image cache 465 int maxCacheSizeMiB; //!< Maximum total size of image cache in MiB 466 int maxCacheEntries; //!< Maximum number of cache entries 467 int compressionLevel; //!< Cache image compression level (see QImage) 468 }; 469 470 struct ApplicationPrefs 471 { 472 ColorPrefs colorPrefs; 473 DisplayPrefs displayPrefs; 474 DocumentSetupPrefs docSetupPrefs; 475 ExternalToolsPrefs extToolPrefs; 476 FontPrefs fontPrefs; 477 GuidesPrefs guidesPrefs; 478 HyphenatorPrefs hyphPrefs; 479 ImageCachePrefs imageCachePrefs; 480 ItemAttrPrefs itemAttrPrefs; 481 ItemToolPrefs itemToolPrefs; 482 KeyboardShortcutsPrefs keyShortcutPrefs; 483 MiscellaneousPrefs miscPrefs; 484 OperatorToolPrefs opToolPrefs; 485 PDFOptions pdfPrefs; 486 PathPrefs pathPrefs; 487 PluginPrefs pluginPrefs; 488 PrinterPrefs printerPrefs; 489 PrintPreviewPrefs printPreviewPrefs; 490 PDFOutputPreviewPrefs pdfOutputPreviewPrefs; 491 PSOutputPreviewPrefs psOutputPreviewPrefs; 492 ScrapbookPrefs scrapbookPrefs; 493 ScripterPrefs scripterPrefs; 494 ShortWordPrefs shortwordPrefs; 495 StoryEditorPrefs storyEditorPrefs; 496 TOCPrefs tocPrefs; 497 TypoPrefs typoPrefs; 498 UIPrefs uiPrefs; 499 VerifierPrefs verifierPrefs; 500 501 QList<ArrowDesc> arrowStyles; 502 QHash<QString, VGradient> defaultGradients; 503 QHash<QString, ScPattern> defaultPatterns; 504 QList<PageSet> pageSets; 505 QStringList activePageSizes; 506 507 //TODO : Remove these no longer used items 508 //! System default QStyle name for current instance, seemingly unused 509 QString ui_SystemTheme; 510 511 //Added for Doc Only 512 DocumentInformation docInfo; 513 DocumentSectionMap docSectionMap; 514 }; 515 516 struct ScIconSetData 517 { 518 QString path; 519 QString baseName; 520 QString license; 521 QString author; 522 QString activeversion; 523 QString variant; 524 QMap<QString, QString> nameTranslations; 525 }; 526 527 528 #endif 529