lib

KoZoomMode.cpp
1/* This file is part of the KDE project
2 Copyright (C) 2005 Johannes Schaub <litb_devel@web.de>
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18*/
19
20#include "KoZoomMode.h"
21#include <tdelocale.h>
22
23const char* KoZoomMode::modes[] =
24{
25 I18N_NOOP("Fit to Width"),
26 I18N_NOOP("Fit to Page"),
27 I18N_NOOP("%1%")
28};
29
31{
32 return i18n(modes[mode]);
33}
34
36{
37 if(mode == i18n(modes[ZOOM_WIDTH]))
38 return ZOOM_WIDTH;
39 else
40 if(mode == i18n(modes[ZOOM_PAGE]))
41 return ZOOM_PAGE;
42 else
43 return ZOOM_CONSTANT;
44 // we return ZOOM_CONSTANT else because then we can pass '10%' or '15%'
45 // or whatever, it's automatically converted. ZOOM_CONSTANT is
46 // changable, whereas all other zoom modes (non-constants) are normal
47 // text like "Fit to xxx". they let the view grow/shrink according
48 // to windowsize, hence the term 'non-constant'
49}
@ ZOOM_CONSTANT
zoom x %
Definition KoZoomMode.h:36
@ ZOOM_PAGE
zoom to pagesize
Definition KoZoomMode.h:35
@ ZOOM_WIDTH
zoom pagewidth
Definition KoZoomMode.h:34
static TQString toString(Mode mode)
static Mode toMode(const TQString &mode)