Mercurial > fife-parpg
annotate engine/core/gui/guimanager.cpp @ 697:ecaa4d98f05f tip
Abstracted the GUI code and refactored the GUIChan-specific code into its own module.
* Most of the GUIChan code has been refactored into its own gui/guichan module. However, references to the GuiFont class still persist in the Engine and GuiManager code and these will need further refactoring.
* GuiManager is now an abstract base class which specific implementations (e.g. GUIChan) should subclass.
* The GUIChan GUI code is now a concrete implementation of GuiManager, most of which is in the new GuiChanGuiManager class.
* The GUI code in the Console class has been refactored out of the Console and into the GUIChan module as its own GuiChanConsoleWidget class. The rest of the Console class related to executing commands was left largely unchanged.
* Existing client code may need to downcast the GuiManager pointer received from FIFE::Engine::getGuiManager() to GuiChanGuiManager, since not all functionality is represented in the GuiManager abstract base class. Python client code can use the new GuiChanGuiManager.castTo static method for this purpose.
author | M. George Hansen <technopolitica@gmail.com> |
---|---|
date | Sat, 18 Jun 2011 00:28:40 -1000 |
parents | 5d6b1820b953 |
children |
rev | line source |
---|---|
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
1 /*************************************************************************** |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
2 * Copyright (C) 2005-2008 by the FIFE team * |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
3 * http://www.fifengine.de * |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
4 * This file is part of FIFE. * |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
5 * * |
46
90005975cdbb
* Final LGPL switch step by adjusting the file headers
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
3
diff
changeset
|
6 * FIFE is free software; you can redistribute it and/or * |
90005975cdbb
* Final LGPL switch step by adjusting the file headers
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
3
diff
changeset
|
7 * modify it under the terms of the GNU Lesser General Public * |
90005975cdbb
* Final LGPL switch step by adjusting the file headers
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
3
diff
changeset
|
8 * License as published by the Free Software Foundation; either * |
90005975cdbb
* Final LGPL switch step by adjusting the file headers
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
3
diff
changeset
|
9 * version 2.1 of the License, or (at your option) any later version. * |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
10 * * |
46
90005975cdbb
* Final LGPL switch step by adjusting the file headers
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
3
diff
changeset
|
11 * This library is distributed in the hope that it will be useful, * |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
46
90005975cdbb
* Final LGPL switch step by adjusting the file headers
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
3
diff
changeset
|
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * |
90005975cdbb
* Final LGPL switch step by adjusting the file headers
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
3
diff
changeset
|
14 * Lesser General Public License for more details. * |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
15 * * |
46
90005975cdbb
* Final LGPL switch step by adjusting the file headers
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
3
diff
changeset
|
16 * You should have received a copy of the GNU Lesser General Public * |
90005975cdbb
* Final LGPL switch step by adjusting the file headers
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
3
diff
changeset
|
17 * License along with this library; if not, write to the * |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
18 * Free Software Foundation, Inc., * |
46
90005975cdbb
* Final LGPL switch step by adjusting the file headers
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
3
diff
changeset
|
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
20 ***************************************************************************/ |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
21 |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
22 // Standard C++ library includes |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
23 #include <iostream> |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
24 |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
25 // 3rd party library includes |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
26 #include <boost/filesystem/convenience.hpp> |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
27 |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
28 // FIFE includes |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
29 // These includes are split up in two parts, separated by one empty line |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
30 // First block: files included from the FIFE root src directory |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
31 // Second block: files included from the same folder |
157
bb9902910067
input_rework merged!
phoku@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
46
diff
changeset
|
32 #include "util/base/exception.h" |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
33 #include "util/log/logger.h" |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
34 #include "video/renderbackend.h" |
697
ecaa4d98f05f
Abstracted the GUI code and refactored the GUIChan-specific code into its own module.
M. George Hansen <technopolitica@gmail.com>
parents:
654
diff
changeset
|
35 #include "video/fonts/subimagefont.h" |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
36 #include "video/fonts/truetypefont.h" |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
37 |
697
ecaa4d98f05f
Abstracted the GUI code and refactored the GUIChan-specific code into its own module.
M. George Hansen <technopolitica@gmail.com>
parents:
654
diff
changeset
|
38 #include "console.h" |
ecaa4d98f05f
Abstracted the GUI code and refactored the GUIChan-specific code into its own module.
M. George Hansen <technopolitica@gmail.com>
parents:
654
diff
changeset
|
39 // FIXME M. George Hansen 2011-06-17: There should be NO references to GuiChan |
ecaa4d98f05f
Abstracted the GUI code and refactored the GUIChan-specific code into its own module.
M. George Hansen <technopolitica@gmail.com>
parents:
654
diff
changeset
|
40 // here! |
ecaa4d98f05f
Abstracted the GUI code and refactored the GUIChan-specific code into its own module.
M. George Hansen <technopolitica@gmail.com>
parents:
654
diff
changeset
|
41 #include "guichan/gui_font.h" |
ecaa4d98f05f
Abstracted the GUI code and refactored the GUIChan-specific code into its own module.
M. George Hansen <technopolitica@gmail.com>
parents:
654
diff
changeset
|
42 #include "guichan/gui_imageloader.h" |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
43 #include "guimanager.h" |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
44 |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
45 namespace FIFE { |
697
ecaa4d98f05f
Abstracted the GUI code and refactored the GUIChan-specific code into its own module.
M. George Hansen <technopolitica@gmail.com>
parents:
654
diff
changeset
|
46 GuiManager::GuiManager(ImagePool& pool) : |
ecaa4d98f05f
Abstracted the GUI code and refactored the GUIChan-specific code into its own module.
M. George Hansen <technopolitica@gmail.com>
parents:
654
diff
changeset
|
47 m_console_visible(false), |
ecaa4d98f05f
Abstracted the GUI code and refactored the GUIChan-specific code into its own module.
M. George Hansen <technopolitica@gmail.com>
parents:
654
diff
changeset
|
48 m_image_pool(pool), |
157
bb9902910067
input_rework merged!
phoku@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
46
diff
changeset
|
49 m_console(0), |
bb9902910067
input_rework merged!
phoku@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
46
diff
changeset
|
50 m_fonts(), |
697
ecaa4d98f05f
Abstracted the GUI code and refactored the GUIChan-specific code into its own module.
M. George Hansen <technopolitica@gmail.com>
parents:
654
diff
changeset
|
51 m_fontpath(), |
ecaa4d98f05f
Abstracted the GUI code and refactored the GUIChan-specific code into its own module.
M. George Hansen <technopolitica@gmail.com>
parents:
654
diff
changeset
|
52 m_fontglyphs(), |
ecaa4d98f05f
Abstracted the GUI code and refactored the GUIChan-specific code into its own module.
M. George Hansen <technopolitica@gmail.com>
parents:
654
diff
changeset
|
53 m_fontsize() { |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
54 } |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
55 |
697
ecaa4d98f05f
Abstracted the GUI code and refactored the GUIChan-specific code into its own module.
M. George Hansen <technopolitica@gmail.com>
parents:
654
diff
changeset
|
56 GuiManager::~GuiManager() { |
ecaa4d98f05f
Abstracted the GUI code and refactored the GUIChan-specific code into its own module.
M. George Hansen <technopolitica@gmail.com>
parents:
654
diff
changeset
|
57 delete m_console; |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
58 } |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
59 |
697
ecaa4d98f05f
Abstracted the GUI code and refactored the GUIChan-specific code into its own module.
M. George Hansen <technopolitica@gmail.com>
parents:
654
diff
changeset
|
60 void GuiManager::init(RenderBackend* render_backend, int screenWidth, |
ecaa4d98f05f
Abstracted the GUI code and refactored the GUIChan-specific code into its own module.
M. George Hansen <technopolitica@gmail.com>
parents:
654
diff
changeset
|
61 int screenHeight) { |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
62 m_console = new Console(); |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
63 } |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
64 |
697
ecaa4d98f05f
Abstracted the GUI code and refactored the GUIChan-specific code into its own module.
M. George Hansen <technopolitica@gmail.com>
parents:
654
diff
changeset
|
65 void GuiManager::toggleConsole() { |
ecaa4d98f05f
Abstracted the GUI code and refactored the GUIChan-specific code into its own module.
M. George Hansen <technopolitica@gmail.com>
parents:
654
diff
changeset
|
66 if (m_console_visible) { |
ecaa4d98f05f
Abstracted the GUI code and refactored the GUIChan-specific code into its own module.
M. George Hansen <technopolitica@gmail.com>
parents:
654
diff
changeset
|
67 hideConsole(); |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
68 } else { |
697
ecaa4d98f05f
Abstracted the GUI code and refactored the GUIChan-specific code into its own module.
M. George Hansen <technopolitica@gmail.com>
parents:
654
diff
changeset
|
69 showConsole(); |
654
5d6b1820b953
* Added the ability to change screen modes on the fly. This works both in OpenGL and SDL modes.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
644
diff
changeset
|
70 } |
5d6b1820b953
* Added the ability to change screen modes on the fly. This works both in OpenGL and SDL modes.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
644
diff
changeset
|
71 } |
5d6b1820b953
* Added the ability to change screen modes on the fly. This works both in OpenGL and SDL modes.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
644
diff
changeset
|
72 |
697
ecaa4d98f05f
Abstracted the GUI code and refactored the GUIChan-specific code into its own module.
M. George Hansen <technopolitica@gmail.com>
parents:
654
diff
changeset
|
73 GuiFont* GuiManager::createFont(const std::string& path, unsigned int size, |
ecaa4d98f05f
Abstracted the GUI code and refactored the GUIChan-specific code into its own module.
M. George Hansen <technopolitica@gmail.com>
parents:
654
diff
changeset
|
74 const std::string& glyphs) { |
ecaa4d98f05f
Abstracted the GUI code and refactored the GUIChan-specific code into its own module.
M. George Hansen <technopolitica@gmail.com>
parents:
654
diff
changeset
|
75 std::string fontpath = path; |
ecaa4d98f05f
Abstracted the GUI code and refactored the GUIChan-specific code into its own module.
M. George Hansen <technopolitica@gmail.com>
parents:
654
diff
changeset
|
76 std::string fontglyphs = glyphs; |
ecaa4d98f05f
Abstracted the GUI code and refactored the GUIChan-specific code into its own module.
M. George Hansen <technopolitica@gmail.com>
parents:
654
diff
changeset
|
77 int fontsize = size; |
255
51cc05d862f2
Merged editor_rewrite branch to trunk.
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
240
diff
changeset
|
78 |
697
ecaa4d98f05f
Abstracted the GUI code and refactored the GUIChan-specific code into its own module.
M. George Hansen <technopolitica@gmail.com>
parents:
654
diff
changeset
|
79 // Set default settings if necessary |
ecaa4d98f05f
Abstracted the GUI code and refactored the GUIChan-specific code into its own module.
M. George Hansen <technopolitica@gmail.com>
parents:
654
diff
changeset
|
80 if (fontpath == "") { |
ecaa4d98f05f
Abstracted the GUI code and refactored the GUIChan-specific code into its own module.
M. George Hansen <technopolitica@gmail.com>
parents:
654
diff
changeset
|
81 fontpath = m_fontpath; |
ecaa4d98f05f
Abstracted the GUI code and refactored the GUIChan-specific code into its own module.
M. George Hansen <technopolitica@gmail.com>
parents:
654
diff
changeset
|
82 } |
ecaa4d98f05f
Abstracted the GUI code and refactored the GUIChan-specific code into its own module.
M. George Hansen <technopolitica@gmail.com>
parents:
654
diff
changeset
|
83 if (fontsize == 0) { |
ecaa4d98f05f
Abstracted the GUI code and refactored the GUIChan-specific code into its own module.
M. George Hansen <technopolitica@gmail.com>
parents:
654
diff
changeset
|
84 fontsize = m_fontsize; |
ecaa4d98f05f
Abstracted the GUI code and refactored the GUIChan-specific code into its own module.
M. George Hansen <technopolitica@gmail.com>
parents:
654
diff
changeset
|
85 } |
ecaa4d98f05f
Abstracted the GUI code and refactored the GUIChan-specific code into its own module.
M. George Hansen <technopolitica@gmail.com>
parents:
654
diff
changeset
|
86 if (fontglyphs == "") { |
ecaa4d98f05f
Abstracted the GUI code and refactored the GUIChan-specific code into its own module.
M. George Hansen <technopolitica@gmail.com>
parents:
654
diff
changeset
|
87 fontglyphs = m_fontglyphs; |
ecaa4d98f05f
Abstracted the GUI code and refactored the GUIChan-specific code into its own module.
M. George Hansen <technopolitica@gmail.com>
parents:
654
diff
changeset
|
88 } |
157
bb9902910067
input_rework merged!
phoku@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
46
diff
changeset
|
89 |
697
ecaa4d98f05f
Abstracted the GUI code and refactored the GUIChan-specific code into its own module.
M. George Hansen <technopolitica@gmail.com>
parents:
654
diff
changeset
|
90 AbstractFont* font = NULL; |
ecaa4d98f05f
Abstracted the GUI code and refactored the GUIChan-specific code into its own module.
M. George Hansen <technopolitica@gmail.com>
parents:
654
diff
changeset
|
91 GuiFont* guifont = NULL; |
ecaa4d98f05f
Abstracted the GUI code and refactored the GUIChan-specific code into its own module.
M. George Hansen <technopolitica@gmail.com>
parents:
654
diff
changeset
|
92 if (boost::filesystem::extension(fontpath) == ".ttf") { |
ecaa4d98f05f
Abstracted the GUI code and refactored the GUIChan-specific code into its own module.
M. George Hansen <technopolitica@gmail.com>
parents:
654
diff
changeset
|
93 font = new TrueTypeFont(fontpath, fontsize); |
ecaa4d98f05f
Abstracted the GUI code and refactored the GUIChan-specific code into its own module.
M. George Hansen <technopolitica@gmail.com>
parents:
654
diff
changeset
|
94 } else { |
ecaa4d98f05f
Abstracted the GUI code and refactored the GUIChan-specific code into its own module.
M. George Hansen <technopolitica@gmail.com>
parents:
654
diff
changeset
|
95 font = new SubImageFont(fontpath, fontglyphs, m_image_pool); |
ecaa4d98f05f
Abstracted the GUI code and refactored the GUIChan-specific code into its own module.
M. George Hansen <technopolitica@gmail.com>
parents:
654
diff
changeset
|
96 } |
ecaa4d98f05f
Abstracted the GUI code and refactored the GUIChan-specific code into its own module.
M. George Hansen <technopolitica@gmail.com>
parents:
654
diff
changeset
|
97 guifont = new GuiFont(font); |
ecaa4d98f05f
Abstracted the GUI code and refactored the GUIChan-specific code into its own module.
M. George Hansen <technopolitica@gmail.com>
parents:
654
diff
changeset
|
98 |
ecaa4d98f05f
Abstracted the GUI code and refactored the GUIChan-specific code into its own module.
M. George Hansen <technopolitica@gmail.com>
parents:
654
diff
changeset
|
99 m_fonts.push_back(guifont); |
ecaa4d98f05f
Abstracted the GUI code and refactored the GUIChan-specific code into its own module.
M. George Hansen <technopolitica@gmail.com>
parents:
654
diff
changeset
|
100 return guifont; |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
101 } |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
102 |
697
ecaa4d98f05f
Abstracted the GUI code and refactored the GUIChan-specific code into its own module.
M. George Hansen <technopolitica@gmail.com>
parents:
654
diff
changeset
|
103 void GuiManager::releaseFont(GuiFont* font) { |
ecaa4d98f05f
Abstracted the GUI code and refactored the GUIChan-specific code into its own module.
M. George Hansen <technopolitica@gmail.com>
parents:
654
diff
changeset
|
104 std::vector<GuiFont*>::iterator i = m_fonts.begin(); |
ecaa4d98f05f
Abstracted the GUI code and refactored the GUIChan-specific code into its own module.
M. George Hansen <technopolitica@gmail.com>
parents:
654
diff
changeset
|
105 while (i != m_fonts.end()) { |
ecaa4d98f05f
Abstracted the GUI code and refactored the GUIChan-specific code into its own module.
M. George Hansen <technopolitica@gmail.com>
parents:
654
diff
changeset
|
106 if ((*i) == font) { |
ecaa4d98f05f
Abstracted the GUI code and refactored the GUIChan-specific code into its own module.
M. George Hansen <technopolitica@gmail.com>
parents:
654
diff
changeset
|
107 m_fonts.erase(i); |
ecaa4d98f05f
Abstracted the GUI code and refactored the GUIChan-specific code into its own module.
M. George Hansen <technopolitica@gmail.com>
parents:
654
diff
changeset
|
108 delete font; |
ecaa4d98f05f
Abstracted the GUI code and refactored the GUIChan-specific code into its own module.
M. George Hansen <technopolitica@gmail.com>
parents:
654
diff
changeset
|
109 return; |
255
51cc05d862f2
Merged editor_rewrite branch to trunk.
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
240
diff
changeset
|
110 } |
697
ecaa4d98f05f
Abstracted the GUI code and refactored the GUIChan-specific code into its own module.
M. George Hansen <technopolitica@gmail.com>
parents:
654
diff
changeset
|
111 ++i; |
ecaa4d98f05f
Abstracted the GUI code and refactored the GUIChan-specific code into its own module.
M. George Hansen <technopolitica@gmail.com>
parents:
654
diff
changeset
|
112 } |
255
51cc05d862f2
Merged editor_rewrite branch to trunk.
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
240
diff
changeset
|
113 } |
51cc05d862f2
Merged editor_rewrite branch to trunk.
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
240
diff
changeset
|
114 |
697
ecaa4d98f05f
Abstracted the GUI code and refactored the GUIChan-specific code into its own module.
M. George Hansen <technopolitica@gmail.com>
parents:
654
diff
changeset
|
115 void GuiManager::invalidateFonts() { |
ecaa4d98f05f
Abstracted the GUI code and refactored the GUIChan-specific code into its own module.
M. George Hansen <technopolitica@gmail.com>
parents:
654
diff
changeset
|
116 std::vector<GuiFont*>::iterator it = m_fonts.begin(); |
ecaa4d98f05f
Abstracted the GUI code and refactored the GUIChan-specific code into its own module.
M. George Hansen <technopolitica@gmail.com>
parents:
654
diff
changeset
|
117 while (it != m_fonts.end()) { |
ecaa4d98f05f
Abstracted the GUI code and refactored the GUIChan-specific code into its own module.
M. George Hansen <technopolitica@gmail.com>
parents:
654
diff
changeset
|
118 (*it)->invalidate(); |
ecaa4d98f05f
Abstracted the GUI code and refactored the GUIChan-specific code into its own module.
M. George Hansen <technopolitica@gmail.com>
parents:
654
diff
changeset
|
119 ++it; |
ecaa4d98f05f
Abstracted the GUI code and refactored the GUIChan-specific code into its own module.
M. George Hansen <technopolitica@gmail.com>
parents:
654
diff
changeset
|
120 } |
ecaa4d98f05f
Abstracted the GUI code and refactored the GUIChan-specific code into its own module.
M. George Hansen <technopolitica@gmail.com>
parents:
654
diff
changeset
|
121 } |
ecaa4d98f05f
Abstracted the GUI code and refactored the GUIChan-specific code into its own module.
M. George Hansen <technopolitica@gmail.com>
parents:
654
diff
changeset
|
122 |
ecaa4d98f05f
Abstracted the GUI code and refactored the GUIChan-specific code into its own module.
M. George Hansen <technopolitica@gmail.com>
parents:
654
diff
changeset
|
123 GuiFont* GuiManager::setDefaultFont(const std::string& path, |
ecaa4d98f05f
Abstracted the GUI code and refactored the GUIChan-specific code into its own module.
M. George Hansen <technopolitica@gmail.com>
parents:
654
diff
changeset
|
124 unsigned int size, const std::string& glyphs) { |
ecaa4d98f05f
Abstracted the GUI code and refactored the GUIChan-specific code into its own module.
M. George Hansen <technopolitica@gmail.com>
parents:
654
diff
changeset
|
125 m_fontpath = path; |
ecaa4d98f05f
Abstracted the GUI code and refactored the GUIChan-specific code into its own module.
M. George Hansen <technopolitica@gmail.com>
parents:
654
diff
changeset
|
126 m_fontsize = size; |
ecaa4d98f05f
Abstracted the GUI code and refactored the GUIChan-specific code into its own module.
M. George Hansen <technopolitica@gmail.com>
parents:
654
diff
changeset
|
127 m_fontglyphs = glyphs; |
ecaa4d98f05f
Abstracted the GUI code and refactored the GUIChan-specific code into its own module.
M. George Hansen <technopolitica@gmail.com>
parents:
654
diff
changeset
|
128 |
ecaa4d98f05f
Abstracted the GUI code and refactored the GUIChan-specific code into its own module.
M. George Hansen <technopolitica@gmail.com>
parents:
654
diff
changeset
|
129 GuiFont* defaultfont = createFont(); |
ecaa4d98f05f
Abstracted the GUI code and refactored the GUIChan-specific code into its own module.
M. George Hansen <technopolitica@gmail.com>
parents:
654
diff
changeset
|
130 return defaultfont; |
ecaa4d98f05f
Abstracted the GUI code and refactored the GUIChan-specific code into its own module.
M. George Hansen <technopolitica@gmail.com>
parents:
654
diff
changeset
|
131 } |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
132 } |