Skip to content

Commit f5529b8

Browse files
committed
Update fenster & fix integration
1 parent 5a834e0 commit f5529b8

File tree

6 files changed

+16
-22
lines changed

6 files changed

+16
-22
lines changed

applications/calculator/src/calculator.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
#include <calculator.hpp>
2222
#include <libfenster/components/button.hpp>
2323
#include <libfenster/components/label.hpp>
24-
#include <libfenster/components/text_field.hpp>
24+
#include <libfenster/components/text_box.hpp>
2525
#include <libfenster/application.hpp>
2626
#include <libfenster/components/window.hpp>
2727
#include <libfenster/metrics/rectangle.hpp>
@@ -32,7 +32,7 @@
3232
using namespace fenster;
3333

3434
Window* window;
35-
TextField* display;
35+
TextBox* display;
3636
Button* but1;
3737
Button* but2;
3838
Button* but3;
@@ -68,7 +68,7 @@ int main()
6868
g_exit(0);
6969
});
7070

71-
display = TextField::create();
71+
display = TextBox::create();
7272
display->setTitle("0");
7373
display->setBounds(Rectangle(10, 10, 150, 30));
7474
window->addChild(display);

applications/desktop/src/taskbar.cpp

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222

2323
#include <cairo/cairo.h>
2424
#include <cstdlib>
25-
#include <map>
2625
#include <libfenster/font/text_layouter.hpp>
2726
#include <libfenster/font/font_loader.hpp>
2827
#include <helper.hpp>
@@ -34,7 +33,7 @@ Font* font = nullptr;
3433
taskbar_t::taskbar_t(ComponentId id):
3534
Component(id), Canvas(id), FocusableComponent(id)
3635
{
37-
textLayoutBuffer = TextLayouter::getInstance()->initializeBuffer();
36+
textLayoutBuffer = TextLayouter::initializeLayout();
3837
}
3938

4039
taskbar_t* taskbar_t::create()
@@ -213,19 +212,13 @@ void taskbar_t::paint()
213212
entry->onView = Rectangle(entryLeft + 2, 4, taskWidth - 4, bounds.height - 8);
214213

215214
Rectangle textArea(10, 0, taskWidth - 20, bounds.height - 10);
216-
TextLayouter::getInstance()->layout(cr, entry->title.c_str(), font, 14, textArea, TextAlignment::LEFT,
217-
textLayoutBuffer);
215+
TextLayouter::layout(cr, entry->title.c_str(), font, 14, textArea, TextAlignment::LEFT, textLayoutBuffer);
218216
for(PositionedGlyph& g: textLayoutBuffer->positions)
219217
{
220218

221-
Rectangle onView(g.position.x, g.position.y, g.size.width, g.size.height);
222-
223219
cairo_save(cr);
224220
cairo_set_source_rgb(cr, 0.96, 0.98, 0.98);
225-
// TODO text layouter is buggy (need to subtract glyph positions):
226-
cairo_translate(cr, entryLeft + onView.x - g.glyph->x, onView.y - g.glyph->y + 10);
227-
cairo_glyph_path(cr, g.glyph, g.glyph_count);
228-
cairo_fill(cr);
221+
TextLayouter::paintChar(cr, g);
229222
cairo_restore(cr);
230223
}
231224
}

applications/editor/src/editor.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
#include <libfenster/application.hpp>
2323
#include <libfenster/components/window.hpp>
2424
#include <libfenster/layout/grid_layout.hpp>
25-
#include <libfenster/components/text_area.hpp>
25+
#include <libfenster/components/text_box.hpp>
2626
#include <fstream>
2727
#include <string>
2828
#include <iterator>
@@ -44,7 +44,8 @@ int main(int argc, char* argv[])
4444

4545
auto windowLayout = GridLayout::create(window);
4646

47-
auto textArea = TextArea::create();
47+
auto textArea = TextBox::create();
48+
textArea->setMultiLine(true);
4849
window->addChild(textArea);
4950

5051
if(argc > 1)
@@ -53,7 +54,7 @@ int main(int argc, char* argv[])
5354
if(file)
5455
{
5556
textArea->setTitle(std::string(std::istreambuf_iterator<char>(file),
56-
std::istreambuf_iterator<char>()).c_str());
57+
std::istreambuf_iterator<char>()).c_str());
5758
}
5859
}
5960

applications/fenster

Submodule fenster updated 50 files

applications/navigator/src/navigator.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
#include <libfenster/application.hpp>
2323
#include <libfenster/components/window.hpp>
2424
#include <libfenster/interface.hpp>
25-
#include <libfenster/components/text_field.hpp>
25+
#include <libfenster/components/text_box.hpp>
2626
#include <libfenster/components/panel.hpp>
2727
#include <libfenster/components/scrollpane.hpp>
2828
#include <libfenster/components/label.hpp>
@@ -44,7 +44,7 @@ std::string currentBase = "/";
4444

4545
ScrollPane* scroller;
4646
Panel* content;
47-
TextField* navText;
47+
TextBox* navText;
4848
Button* navPrev;
4949
Button* navNext;
5050
Button* navUp;
@@ -61,7 +61,7 @@ void navigatorLoad(bool keepHistory = false);
6161

6262
int main()
6363
{
64-
if(Application::open() != fenster::ApplicationOpenStatus::Success)
64+
if(Application::open() != ApplicationOpenStatus::Success)
6565
{
6666
klog("failed to create UI");
6767
return -1;
@@ -111,7 +111,7 @@ int main()
111111
}
112112
});
113113

114-
navText = TextField::create();
114+
navText = TextBox::create();
115115
navBar->addChild(navText);
116116
navBarLayout->setComponentInfo(navText, 1, 1, 0);
117117
navText->addKeyListener([](KeyEvent& e)

kernel/src/kernel/build_config.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,6 @@
5151
// version
5252
#define G_VERSION_MAJOR 1
5353
#define G_VERSION_MINOR 2
54-
#define G_VERSION_PATCH 0
54+
#define G_VERSION_PATCH 1
5555

5656
#endif

0 commit comments

Comments
 (0)