• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • krita API Reference
  • KDE Home
  • Contact Us
 

KritaWidgets

  • sources
  • kfour-appscomplete
  • krita
  • libs
  • widgets
KoZoomMode.cpp
Go to the documentation of this file.
1 /* This file is part of the KDE project
2  SPDX-FileCopyrightText: 2005 Johannes Schaub <[email protected]>
3  SPDX-FileCopyrightText: 2011 Arjen Hiemstra <[email protected]>
4 
5  SPDX-License-Identifier: LGPL-2.0-or-later
6 */
7 
8 #include "KoZoomMode.h"
9 #include <klocalizedstring.h>
10 
11 const char* const KoZoomMode::modes[] =
12 {
13  I18N_NOOP("%1%"),
14  I18N_NOOP("Fit Page Width"),
15  I18N_NOOP("Fit Page"),
16  0,
17  I18N_NOOP("Actual Pixels"),
18  0,
19  0,
20  0,
21  I18N_NOOP("Fit Text Width"),
22  0,
23  0,
24  0,
25  0,
26  0,
27  0,
28  0,
29  I18N_NOOP("Fit Page Height")
30 };
31 
32 qreal KoZoomMode::minimumZoomValue = 0.2;
33 qreal KoZoomMode::maximumZoomValue = 5.0;
34 
35 QString KoZoomMode::toString(Mode mode)
36 {
37  return i18n(modes[mode]);
38 }
39 
40 KoZoomMode::Mode KoZoomMode::toMode(const QString& mode)
41 {
42  if (mode == i18n(modes[ZOOM_WIDTH]))
43  return ZOOM_WIDTH;
44  else
45  if (mode == i18n(modes[ZOOM_PAGE]))
46  return ZOOM_PAGE;
47  else
48  if (mode == i18n(modes[ZOOM_PIXELS]))
49  return ZOOM_PIXELS;
50  else
51  if (mode == i18n(modes[ZOOM_HEIGHT]))
52  return ZOOM_HEIGHT;
53  else
54  return ZOOM_CONSTANT;
55  // we return ZOOM_CONSTANT else because then we can pass '10%' or '15%'
56  // or whatever, it's automatically converted. ZOOM_CONSTANT is
57  // changeable, whereas all other zoom modes (non-constants) are normal
58  // text like "Fit to xxx". they let the view grow/shrink according
59  // to windowsize, hence the term 'non-constant'
60 }
61 
62 qreal KoZoomMode::minimumZoom()
63 {
64  return minimumZoomValue;
65 }
66 
67 qreal KoZoomMode::maximumZoom()
68 {
69  return maximumZoomValue;
70 }
71 
72 void KoZoomMode::setMinimumZoom(qreal zoom)
73 {
74  Q_ASSERT(zoom > 0.0f);
75  minimumZoomValue = zoom;
76 }
77 
78 void KoZoomMode::setMaximumZoom(qreal zoom)
79 {
80  Q_ASSERT(zoom > 0.0f);
81  maximumZoomValue = zoom;
82 }
KoZoomMode::setMinimumZoom
static void setMinimumZoom(qreal zoom)
Set the minimum zoom possible for documents.
Definition: KoZoomMode.cpp:72
KoZoomMode::toMode
static Mode toMode(const QString &mode)
Definition: KoZoomMode.cpp:40
KoZoomMode::maximumZoom
static qreal maximumZoom()
Return the maximum zoom possible for documents.
Definition: KoZoomMode.cpp:67
KoZoomMode::ZOOM_PIXELS
zoom to actual pixels
Definition: KoZoomMode.h:27
KoZoomMode.h
QString
KoZoomMode::ZOOM_HEIGHT
zoom pageheight
Definition: KoZoomMode.h:26
KoZoomMode::Mode
Mode
Definition: KoZoomMode.h:21
KoZoomMode::setMaximumZoom
static void setMaximumZoom(qreal zoom)
Set the maximum zoom possible for documents.
Definition: KoZoomMode.cpp:78
KoZoomMode::minimumZoom
static qreal minimumZoom()
Return the minimum zoom possible for documents.
Definition: KoZoomMode.cpp:62
KoZoomMode::ZOOM_PAGE
zoom to pagesize
Definition: KoZoomMode.h:25
KoZoomMode::ZOOM_CONSTANT
zoom x %
Definition: KoZoomMode.h:23
KoZoomMode::ZOOM_WIDTH
zoom pagewidth
Definition: KoZoomMode.h:24
KoZoomMode::toString
static QString toString(Mode mode)
Definition: KoZoomMode.cpp:35
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Tue Jan 19 2021 23:44:00 by doxygen 1.8.16 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KritaWidgets

Skip menu "KritaWidgets"
  • Main Page
  • Namespace List
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

krita API Reference

Skip menu "krita API Reference"
  • libs
  •   KritaBasicFlakes
  •   brush
  •   KritaUndo2
  •   KritaFlake
  •   image
  •   KritaPlugin
  •   Krita
  •   KritaPigment
  •   KritaResources
  •   KritaStore
  •   ui
  •   KritaWidgets
  •   KritaWidgetUtils
  • plugins
  •   Assitants
  •   Extensions
  •   Filters
  •   Generators
  •   Formats
  •           src
  •   PaintOps
  •     libpaintop

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal