| 1 | /* |
| 2 | * File: Fonts.cpp |
| 3 | * |
| 4 | * Author: Jacob Dekel |
| 5 | * Created on: Nov 9, 2009 |
| 6 | * |
| 7 | * Copyright (c) 2009-2013 Jacob Dekel |
| 8 | * $Id$ |
| 9 | * |
| 10 | * This program is free software: you can redistribute it and/or modify |
| 11 | * it under the terms of the GNU General Public License as published by |
| 12 | * the Free Software Foundation, either version 3 of the License, or |
| 13 | * (at your option) any later version. |
| 14 | * |
| 15 | * This program is distributed in the hope that it will be useful, |
| 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 18 | * GNU General Public License for more details. |
| 19 | * |
| 20 | * You should have received a copy of the GNU General Public License |
| 21 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 22 | * |
| 23 | */ |
| 24 | |
| 25 | #include "FontPreferences.h"cxx . . $ `<file>/HercStudio/FontPreferences.h`/ |
| 26 | #include "Preferences.h"cxx . . $ `<file>/HercStudio/Preferences.h`/ |
| 27 | #include "StringTokenizer.h"cxx . . $ `<file>/HercStudio/StringTokenizer.h`/ |
| 28 | #include "ConfigurationEditor.h"cxx . . $ `<file>/HercConfiguration/ConfigurationEditor.h`/ |
| 29 | #include "HerculesStudio.h"cxx . . $ `<file>/HercStudio/HerculesStudio.h`/ |
| 30 | |
| 31 | #include <QFile> |
| 32 | #include <sstream> |
| 33 | |
| 34 | FontPreferencescxx . . $ FontPreferences#::FontPreferencescxx . . $ FontPreferences#FontPreferences(8d4ab0a187bf9331).(stdcxx . . $ std/::stringcxx . . $ std/string# line) : |
| 35 | mLinecxx . . $ FontPreferences#mLine.(line), mNamecxx . . $ FontPreferences#mName.("(System Default)"), mSizecxx . . $ FontPreferences#mSize.(9), mBoldcxx . . $ FontPreferences#mBold.(false), mItaliccxx . . $ FontPreferences#mItalic.(false) |
| 36 | { |
| 37 | setPrefLinecxx . . $ FontPreferences#setPrefLine(8d4ab0a187bf9331).(linecxx . . $ std/__cxx11/basic_string#basic_string(a47f53d4115f6ce5).); |
| 38 | } |
| 39 | |
| 40 | FontPreferencescxx . . $ FontPreferences#::~cxx . . $ FontPreferences#`~FontPreferences`(49f6e7a06ebc5aa8).FontPreferencescxx . . $ FontPreferences#() |
| 41 | { |
| 42 | |
| 43 | } |
| 44 | |
| 45 | void FontPreferencescxx . . $ FontPreferences#::setFontNamecxx . . $ FontPreferences#setFontName(9c546c94e5fcce4e).( const stdcxx . . $ std/::stringcxx . . $ std/string#& fontName) |
| 46 | { |
| 47 | mNamecxx . . $ FontPreferences#mName. =cxx . . $ std/__cxx11/basic_string#`operator=`(c0b47be1fddc0e75). fontName; |
| 48 | } |
| 49 | |
| 50 | stdcxx . . $ std/::stringcxx . . $ std/string#& FontPreferencescxx . . $ FontPreferences#::fontNamecxx . . $ FontPreferences#fontName(75da78375bc7a3dd).() |
| 51 | { |
| 52 | return mNamecxx . . $ FontPreferences#mName.; |
| 53 | } |
| 54 | |
| 55 | void FontPreferencescxx . . $ FontPreferences#::setFontSizecxx . . $ FontPreferences#setFontSize(d4f767463ce0a6b3).( int fontSize ) |
| 56 | { |
| 57 | mSizecxx . . $ FontPreferences#mSize. = fontSize; |
| 58 | hOutDebugcxx . . $ `HercStudio/HerculesStudio.h:49:9`!(2, "FontPreferences set size" << mSize); |
| 59 | } |
| 60 | |
| 61 | int FontPreferencescxx . . $ FontPreferences#::fontSizecxx . . $ FontPreferences#fontSize(b126dc7c1de90089).() |
| 62 | { |
| 63 | hOutDebugcxx . . $ `HercStudio/HerculesStudio.h:49:9`!(2, "FontPreferences return size " << mSize); |
| 64 | return mSizecxx . . $ FontPreferences#mSize.; |
| 65 | } |
| 66 | |
| 67 | void FontPreferencescxx . . $ FontPreferences#::setFontBoldnesscxx . . $ FontPreferences#setFontBoldness(b45ddcbc8423892c).( bool isBold ) |
| 68 | { |
| 69 | mBoldcxx . . $ FontPreferences#mBold. = isBold; |
| 70 | } |
| 71 | |
| 72 | void FontPreferencescxx . . $ FontPreferences#::setFontItaliccxx . . $ FontPreferences#setFontItalic(b45ddcbc8423892c).( bool isItalic ) |
| 73 | { |
| 74 | mItaliccxx . . $ FontPreferences#mItalic. = isItalic; |
| 75 | } |
| 76 | |
| 77 | bool FontPreferencescxx . . $ FontPreferences#::fontIsBoldcxx . . $ FontPreferences#fontIsBold(c9857a73d68e59ba).() |
| 78 | { |
| 79 | return mBoldcxx . . $ FontPreferences#mBold.; |
| 80 | } |
| 81 | |
| 82 | bool FontPreferencescxx . . $ FontPreferences#::fontIsItaliccxx . . $ FontPreferences#fontIsItalic(c9857a73d68e59ba).() |
| 83 | { |
| 84 | return mItaliccxx . . $ FontPreferences#mItalic.; |
| 85 | } |
| 86 | |
| 87 | int FontPreferencescxx . . $ FontPreferences#::fontVariationcxx . . $ FontPreferences#fontVariation(b126dc7c1de90089).() |
| 88 | { |
| 89 | return (mBoldcxx . . $ FontPreferences#mBold. ? Boldcxx . . $ FontPreferences#Bold. : 0) + (mItaliccxx . . $ FontPreferences#mItalic. ? Italiccxx . . $ FontPreferences#Italic. : 0); |
| 90 | } |
| 91 | |
| 92 | void FontPreferencescxx . . $ FontPreferences#::setPrefLinecxx . . $ FontPreferences#setPrefLine(8d4ab0a187bf9331).(stdcxx . . $ std/::stringcxx . . $ std/string# line) |
| 93 | { |
| 94 | hOutDebugcxx . . $ `HercStudio/HerculesStudio.h:49:9`!(2, "FontPreferences Line='" << line << "'"); |
| 95 | if (line.lengthcxx . . $ std/__cxx11/basic_string#length(48278e53df7b52a5).() == 0) return; |
| 96 | Tokenizercxx . . $ Tokenizer/::handlecxx . . $ Tokenizer/handle# pos=0, lastPos=0; |
| 97 | stdcxx . . $ std/::stringcxx . . $ std/string# word = StringTokenizercxx . . $ std/__cxx11/basic_string#basic_string(3bc0f77cdfbaa67f).::getFirstWordcxx . . $ StringTokenizer#getFirstWord(d6887f0d22b52f3).(line, pos, lastPos, ","cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).); |
| 98 | if (word ==cxx . . $ std/`operator==`(4b17aa87c9f300c6). "") return; |
| 99 | mNamecxx . . $ FontPreferences#mName. =cxx . . $ std/__cxx11/basic_string#`operator=`(c0b47be1fddc0e75). word; |
| 100 | word =cxx . . $ std/__cxx11/basic_string#`operator=`(706c69e8c742c906). StringTokenizercxx . . $ StringTokenizer#::getNextWordcxx . . $ StringTokenizer#getNextWord(d6887f0d22b52f3).(line, pos, lastPos, ","cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).); |
| 101 | mSizecxx . . $ FontPreferences#mSize. = ConfigurationEditorcxx . . $ ConfigurationEditor#::parseNumcxx . . $ ConfigurationEditor#parseNum(7b1020165ab78f0a).(word,10); |
| 102 | mBoldcxx . . $ FontPreferences#mBold. = ("true" ==cxx . . $ std/`operator==`(3a786e8ce7e53c2c). StringTokenizercxx . . $ StringTokenizer#::getNextWordcxx . . $ StringTokenizer#getNextWord(d6887f0d22b52f3).(line, pos, lastPos, ","cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).)); |
| 103 | mItaliccxx . . $ FontPreferences#mItalic. = ("true" ==cxx . . $ std/`operator==`(3a786e8ce7e53c2c). StringTokenizercxx . . $ StringTokenizer#::getNextWordcxx . . $ StringTokenizer#getNextWord(d6887f0d22b52f3).(line, pos, lastPos, ", \n\t"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).)); |
| 104 | return; |
| 105 | } |
| 106 | |
| 107 | stdcxx . . $ std/::stringcxx . . $ std/string# FontPreferencescxx . . $ FontPreferences#::prefLinecxx . . $ FontPreferences#prefLine(efd28698952f529a).() |
| 108 | { |
| 109 | stdcxx . . $ std/::stringstreamcxx . . $ std/stringstream# sscxx . . $ std/__cxx11/basic_stringstream#basic_stringstream(49f6e7a06ebc5aa8).; |
| 110 | ss <<cxx . . $ std/`operator<<`(88df5bef833f7f83). mNamecxx . . $ FontPreferences#mName. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "," <<cxx . . $ std/basic_ostream#`operator<<`(23b6575433a77e57). mSizecxx . . $ FontPreferences#mSize. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "," <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). (mBoldcxx . . $ FontPreferences#mBold. ? "true" : "false" ) <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "," <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). (mItaliccxx . . $ FontPreferences#mItalic. ? "true" : "false"); |
| 111 | return sscxx . . $ std/__cxx11/basic_string#basic_string(3bc0f77cdfbaa67f)..strcxx . . $ std/__cxx11/basic_stringstream#str(d33e1a6fd36255f7).(); |
| 112 | } |