mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 03:07:43 +00:00
LibGfx: Move FontDatabase from LibGUI to LibGfx
Not sure why I put this into LibGUI in the first place.
This commit is contained in:
parent
e569f7fd1c
commit
982e066100
13 changed files with 12 additions and 17 deletions
|
@ -28,7 +28,6 @@
|
||||||
#include <AK/StringBuilder.h>
|
#include <AK/StringBuilder.h>
|
||||||
#include <LibGUI/Action.h>
|
#include <LibGUI/Action.h>
|
||||||
#include <LibGUI/Clipboard.h>
|
#include <LibGUI/Clipboard.h>
|
||||||
#include <LibGUI/FontDatabase.h>
|
|
||||||
#include <LibGUI/Menu.h>
|
#include <LibGUI/Menu.h>
|
||||||
#include <LibGUI/Painter.h>
|
#include <LibGUI/Painter.h>
|
||||||
#include <LibGUI/ScrollBar.h>
|
#include <LibGUI/ScrollBar.h>
|
||||||
|
|
|
@ -33,7 +33,6 @@
|
||||||
#include <LibGUI/BoxLayout.h>
|
#include <LibGUI/BoxLayout.h>
|
||||||
#include <LibGUI/Button.h>
|
#include <LibGUI/Button.h>
|
||||||
#include <LibGUI/FilePicker.h>
|
#include <LibGUI/FilePicker.h>
|
||||||
#include <LibGUI/FontDatabase.h>
|
|
||||||
#include <LibGUI/InputBox.h>
|
#include <LibGUI/InputBox.h>
|
||||||
#include <LibGUI/Menu.h>
|
#include <LibGUI/Menu.h>
|
||||||
#include <LibGUI/MenuBar.h>
|
#include <LibGUI/MenuBar.h>
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
#include <LibGUI/ActionGroup.h>
|
#include <LibGUI/ActionGroup.h>
|
||||||
#include <LibGUI/Application.h>
|
#include <LibGUI/Application.h>
|
||||||
#include <LibGUI/BoxLayout.h>
|
#include <LibGUI/BoxLayout.h>
|
||||||
#include <LibGUI/FontDatabase.h>
|
#include <LibGfx/FontDatabase.h>
|
||||||
#include <LibGUI/GroupBox.h>
|
#include <LibGUI/GroupBox.h>
|
||||||
#include <LibGUI/Menu.h>
|
#include <LibGUI/Menu.h>
|
||||||
#include <LibGUI/MenuBar.h>
|
#include <LibGUI/MenuBar.h>
|
||||||
|
@ -330,7 +330,7 @@ int main(int argc, char** argv)
|
||||||
GUI::ActionGroup font_action_group;
|
GUI::ActionGroup font_action_group;
|
||||||
font_action_group.set_exclusive(true);
|
font_action_group.set_exclusive(true);
|
||||||
auto& font_menu = menubar->add_menu("Font");
|
auto& font_menu = menubar->add_menu("Font");
|
||||||
GUI::FontDatabase::the().for_each_fixed_width_font([&](const Gfx::Font& font) {
|
Gfx::FontDatabase::the().for_each_fixed_width_font([&](const Gfx::Font& font) {
|
||||||
auto action = GUI::Action::create_checkable(font.qualified_name(), [&](auto&) {
|
auto action = GUI::Action::create_checkable(font.qualified_name(), [&](auto&) {
|
||||||
terminal.set_font(font);
|
terminal.set_font(font);
|
||||||
config->write_entry("Text", "Font", font.qualified_name());
|
config->write_entry("Text", "Font", font.qualified_name());
|
||||||
|
|
|
@ -41,7 +41,6 @@
|
||||||
#include <LibGUI/Button.h>
|
#include <LibGUI/Button.h>
|
||||||
#include <LibGUI/CppSyntaxHighlighter.h>
|
#include <LibGUI/CppSyntaxHighlighter.h>
|
||||||
#include <LibGUI/FilePicker.h>
|
#include <LibGUI/FilePicker.h>
|
||||||
#include <LibGUI/FontDatabase.h>
|
|
||||||
#include <LibGUI/INISyntaxHighlighter.h>
|
#include <LibGUI/INISyntaxHighlighter.h>
|
||||||
#include <LibGUI/JSSyntaxHighlighter.h>
|
#include <LibGUI/JSSyntaxHighlighter.h>
|
||||||
#include <LibGUI/Menu.h>
|
#include <LibGUI/Menu.h>
|
||||||
|
@ -55,6 +54,7 @@
|
||||||
#include <LibGUI/ToolBar.h>
|
#include <LibGUI/ToolBar.h>
|
||||||
#include <LibGUI/ToolBarContainer.h>
|
#include <LibGUI/ToolBarContainer.h>
|
||||||
#include <LibGfx/Font.h>
|
#include <LibGfx/Font.h>
|
||||||
|
#include <LibGfx/FontDatabase.h>
|
||||||
#include <LibMarkdown/Document.h>
|
#include <LibMarkdown/Document.h>
|
||||||
#include <LibWeb/OutOfProcessWebView.h>
|
#include <LibWeb/OutOfProcessWebView.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@ -396,7 +396,7 @@ TextEditorWidget::TextEditorWidget()
|
||||||
font_actions.set_exclusive(true);
|
font_actions.set_exclusive(true);
|
||||||
|
|
||||||
auto& font_menu = view_menu.add_submenu("Font");
|
auto& font_menu = view_menu.add_submenu("Font");
|
||||||
GUI::FontDatabase::the().for_each_fixed_width_font([&](const Gfx::Font& font) {
|
Gfx::FontDatabase::the().for_each_fixed_width_font([&](const Gfx::Font& font) {
|
||||||
auto action = GUI::Action::create_checkable(font.qualified_name(), [&](auto&) {
|
auto action = GUI::Action::create_checkable(font.qualified_name(), [&](auto&) {
|
||||||
m_editor->set_font(font);
|
m_editor->set_font(font);
|
||||||
m_editor->update();
|
m_editor->update();
|
||||||
|
|
|
@ -35,7 +35,6 @@
|
||||||
#include <LibGUI/CheckBox.h>
|
#include <LibGUI/CheckBox.h>
|
||||||
#include <LibGUI/ColorInput.h>
|
#include <LibGUI/ColorInput.h>
|
||||||
#include <LibGUI/ComboBox.h>
|
#include <LibGUI/ComboBox.h>
|
||||||
#include <LibGUI/FontDatabase.h>
|
|
||||||
#include <LibGUI/GroupBox.h>
|
#include <LibGUI/GroupBox.h>
|
||||||
#include <LibGUI/Icon.h>
|
#include <LibGUI/Icon.h>
|
||||||
#include <LibGUI/ImageWidget.h>
|
#include <LibGUI/ImageWidget.h>
|
||||||
|
|
|
@ -25,9 +25,9 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "BoardView.h"
|
#include "BoardView.h"
|
||||||
#include <LibGUI/FontDatabase.h>
|
|
||||||
#include <LibGUI/Painter.h>
|
#include <LibGUI/Painter.h>
|
||||||
#include <LibGfx/Font.h>
|
#include <LibGfx/Font.h>
|
||||||
|
#include <LibGfx/FontDatabase.h>
|
||||||
#include <LibGfx/Palette.h>
|
#include <LibGfx/Palette.h>
|
||||||
|
|
||||||
BoardView::BoardView(const Game::Board* board)
|
BoardView::BoardView(const Game::Board* board)
|
||||||
|
@ -63,7 +63,7 @@ void BoardView::pick_font()
|
||||||
{
|
{
|
||||||
String best_font_name;
|
String best_font_name;
|
||||||
int best_font_size = -1;
|
int best_font_size = -1;
|
||||||
auto& font_database = GUI::FontDatabase::the();
|
auto& font_database = Gfx::FontDatabase::the();
|
||||||
font_database.for_each_font([&](const Gfx::Font& font) {
|
font_database.for_each_font([&](const Gfx::Font& font) {
|
||||||
if (font.family() != "Liza" || font.weight() != 700)
|
if (font.family() != "Liza" || font.weight() != 700)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -26,7 +26,6 @@
|
||||||
|
|
||||||
#include "SnakeGame.h"
|
#include "SnakeGame.h"
|
||||||
#include <LibCore/ConfigFile.h>
|
#include <LibCore/ConfigFile.h>
|
||||||
#include <LibGUI/FontDatabase.h>
|
|
||||||
#include <LibGUI/Painter.h>
|
#include <LibGUI/Painter.h>
|
||||||
#include <LibGfx/Bitmap.h>
|
#include <LibGfx/Bitmap.h>
|
||||||
#include <LibGfx/Font.h>
|
#include <LibGfx/Font.h>
|
||||||
|
|
|
@ -28,7 +28,6 @@ set(SOURCES
|
||||||
FilePicker.cpp
|
FilePicker.cpp
|
||||||
FileSystemModel.cpp
|
FileSystemModel.cpp
|
||||||
FilteringProxyModel.cpp
|
FilteringProxyModel.cpp
|
||||||
FontDatabase.cpp
|
|
||||||
Frame.cpp
|
Frame.cpp
|
||||||
GroupBox.cpp
|
GroupBox.cpp
|
||||||
HeaderView.cpp
|
HeaderView.cpp
|
||||||
|
|
|
@ -30,7 +30,6 @@
|
||||||
#include <LibCore/Timer.h>
|
#include <LibCore/Timer.h>
|
||||||
#include <LibGUI/Action.h>
|
#include <LibGUI/Action.h>
|
||||||
#include <LibGUI/Clipboard.h>
|
#include <LibGUI/Clipboard.h>
|
||||||
#include <LibGUI/FontDatabase.h>
|
|
||||||
#include <LibGUI/InputBox.h>
|
#include <LibGUI/InputBox.h>
|
||||||
#include <LibGUI/Menu.h>
|
#include <LibGUI/Menu.h>
|
||||||
#include <LibGUI/Painter.h>
|
#include <LibGUI/Painter.h>
|
||||||
|
|
|
@ -9,6 +9,7 @@ set(SOURCES
|
||||||
DisjointRectSet.cpp
|
DisjointRectSet.cpp
|
||||||
Emoji.cpp
|
Emoji.cpp
|
||||||
Font.cpp
|
Font.cpp
|
||||||
|
FontDatabase.cpp
|
||||||
GIFLoader.cpp
|
GIFLoader.cpp
|
||||||
ICOLoader.cpp
|
ICOLoader.cpp
|
||||||
ImageDecoder.cpp
|
ImageDecoder.cpp
|
||||||
|
|
|
@ -27,13 +27,13 @@
|
||||||
#include <AK/NonnullRefPtrVector.h>
|
#include <AK/NonnullRefPtrVector.h>
|
||||||
#include <AK/QuickSort.h>
|
#include <AK/QuickSort.h>
|
||||||
#include <LibCore/DirIterator.h>
|
#include <LibCore/DirIterator.h>
|
||||||
#include <LibGUI/FontDatabase.h>
|
|
||||||
#include <LibGfx/Font.h>
|
#include <LibGfx/Font.h>
|
||||||
|
#include <LibGfx/FontDatabase.h>
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
namespace GUI {
|
namespace Gfx {
|
||||||
|
|
||||||
static FontDatabase* s_the;
|
static FontDatabase* s_the;
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
#include <AK/String.h>
|
#include <AK/String.h>
|
||||||
#include <LibGfx/Forward.h>
|
#include <LibGfx/Forward.h>
|
||||||
|
|
||||||
namespace GUI {
|
namespace Gfx {
|
||||||
|
|
||||||
class FontDatabase {
|
class FontDatabase {
|
||||||
public:
|
public:
|
|
@ -39,12 +39,12 @@
|
||||||
#include <LibGUI/Application.h>
|
#include <LibGUI/Application.h>
|
||||||
#include <LibGUI/Clipboard.h>
|
#include <LibGUI/Clipboard.h>
|
||||||
#include <LibGUI/DragOperation.h>
|
#include <LibGUI/DragOperation.h>
|
||||||
#include <LibGUI/FontDatabase.h>
|
|
||||||
#include <LibGUI/Menu.h>
|
#include <LibGUI/Menu.h>
|
||||||
#include <LibGUI/Painter.h>
|
#include <LibGUI/Painter.h>
|
||||||
#include <LibGUI/ScrollBar.h>
|
#include <LibGUI/ScrollBar.h>
|
||||||
#include <LibGUI/Window.h>
|
#include <LibGUI/Window.h>
|
||||||
#include <LibGfx/Font.h>
|
#include <LibGfx/Font.h>
|
||||||
|
#include <LibGfx/FontDatabase.h>
|
||||||
#include <LibGfx/Palette.h>
|
#include <LibGfx/Palette.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
@ -122,7 +122,7 @@ TerminalWidget::TerminalWidget(int ptm_fd, bool automatic_size_policy, RefPtr<Co
|
||||||
if (font_entry == "default")
|
if (font_entry == "default")
|
||||||
set_font(Gfx::Font::default_fixed_width_font());
|
set_font(Gfx::Font::default_fixed_width_font());
|
||||||
else
|
else
|
||||||
set_font(GUI::FontDatabase::the().get_by_name(font_entry));
|
set_font(Gfx::FontDatabase::the().get_by_name(font_entry));
|
||||||
|
|
||||||
m_line_height = font().glyph_height() + m_line_spacing;
|
m_line_height = font().glyph_height() + m_line_spacing;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue