FreeCAD

Форк
0
/
Preferences.cpp 
76 строк · 2.9 Кб
1
/***************************************************************************
2
 *   Copyright (c) 2023 WandererFan <wandererfan@gmail.com>                *
3
 *                                                                         *
4
 *   This file is part of FreeCAD.                                         *
5
 *                                                                         *
6
 *   FreeCAD is free software: you can redistribute it and/or modify it    *
7
 *   under the terms of the GNU Lesser General Public License as           *
8
 *   published by the Free Software Foundation, either version 2.1 of the  *
9
 *   License, or (at your option) any later version.                       *
10
 *                                                                         *
11
 *   FreeCAD is distributed in the hope that it will be useful, but        *
12
 *   WITHOUT ANY WARRANTY; without even the implied warranty of            *
13
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      *
14
 *   Lesser General Public License for more details.                       *
15
 *                                                                         *
16
 *   You should have received a copy of the GNU Lesser General Public      *
17
 *   License along with FreeCAD. If not, see                               *
18
 *   <https://www.gnu.org/licenses/>.                                      *
19
 *                                                                         *
20
 **************************************************************************/
21

22
#include "PreCompiled.h"
23
#ifndef _PreComp_
24
#include <string>
25
#endif
26

27
#include <App/Application.h>
28
#include <App/Material.h>
29
#include <Base/Console.h>
30
#include <Base/Parameter.h>
31

32
#include "Preferences.h"
33

34

35
// getters for parameters used in multiple places.
36
// ensure this is in sync with parameter names and default values on preference pages
37

38
using namespace Measure;
39

40
//! Returns the Measure preference group
41
Base::Reference<ParameterGrp> Preferences::getPreferenceGroup(const char* Name)
42
{
43
    return App::GetApplication()
44
        .GetUserParameter()
45
        .GetGroup("BaseApp/Preferences/Mod/Measure")
46
        ->GetGroup(Name);
47
}
48

49
App::Color Preferences::defaultLineColor()
50
{
51
    App::Color fcColor;
52
    fcColor.setPackedValue(
53
        getPreferenceGroup("Appearance")->GetUnsigned("DefaultLineColor", 0x3CF00000));
54
    return fcColor;
55
}
56

57
App::Color Preferences::defaultTextColor()
58
{
59
    App::Color fcColor;
60
    fcColor.setPackedValue(
61
        getPreferenceGroup("Appearance")->GetUnsigned("DefaultTextColor", 0x00000000));
62
    return fcColor;
63
}
64

65
App::Color Preferences::defaultTextBackgroundColor()
66
{
67
    App::Color fcColor;
68
    fcColor.setPackedValue(
69
        getPreferenceGroup("Appearance")->GetUnsigned("DefaultTextBackgroundColor", 0x3CF00000));
70
    return fcColor;
71
}
72

73
int Preferences::defaultFontSize()
74
{
75
    return getPreferenceGroup("Appearance")->GetInt("DefaultFontSize", 18);
76
}
77

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.