talons

Fork of Claws Mail https://www.claws-mail
Log | Files | Refs | README | LICENSE

commit 532414c6704c91083f56ca6630bbdc12cc86507b
parent bf5fb4346014191c1c267ad8bda87b421997c884
Author: Jonathan Boeing <jonathan@claws-mail.org>
Date:   Mon,  9 Oct 2023 00:51:08 -0700

String api updates

Upstream replaced tstring with string and tchar_t* with char*

Diffstat:
Msrc/plugins/litehtml_viewer/container_linux_images.cpp | 4++--
Msrc/plugins/litehtml_viewer/lh_widget.cpp | 30+++++++++++++++---------------
Msrc/plugins/litehtml_viewer/lh_widget.h | 36++++++++++++++++++------------------
Msrc/plugins/litehtml_viewer/lh_widget_text.cpp | 6+++---
4 files changed, 38 insertions(+), 38 deletions(-)

diff --git a/src/plugins/litehtml_viewer/container_linux_images.cpp b/src/plugins/litehtml_viewer/container_linux_images.cpp @@ -26,9 +26,9 @@ #include "container_linux.h" #include "http.h" -typedef std::pair<litehtml::tstring, struct timeval> lru_entry; +typedef std::pair<litehtml::string, struct timeval> lru_entry; -static GdkPixbuf *lh_get_image(const litehtml::tchar_t* url) +static GdkPixbuf *lh_get_image(const char *url) { GError *error = NULL; GdkPixbuf *pixbuf = NULL; diff --git a/src/plugins/litehtml_viewer/lh_widget.cpp b/src/plugins/litehtml_viewer/lh_widget.cpp @@ -134,13 +134,13 @@ GtkWidget *lh_widget::get_widget() const return m_scrolled_window; } -void lh_widget::set_caption(const litehtml::tchar_t* caption) +void lh_widget::set_caption(const char *caption) { debug_print("lh_widget set_caption\n"); return; } -void lh_widget::set_base_url(const litehtml::tchar_t* base_url) +void lh_widget::set_base_url(const char *base_url) { debug_print("lh_widget set_base_url '%s'\n", (base_url ? base_url : "(null)")); @@ -152,7 +152,7 @@ void lh_widget::set_base_url(const litehtml::tchar_t* base_url) return; } -void lh_widget::on_anchor_click(const litehtml::tchar_t* url, const litehtml::element::ptr& el) +void lh_widget::on_anchor_click(const char *url, const litehtml::element::ptr& el) { debug_print("lh_widget on_anchor_click. url -> %s\n", url); @@ -160,7 +160,7 @@ void lh_widget::on_anchor_click(const litehtml::tchar_t* url, const litehtml::el return; } -void lh_widget::import_css(litehtml::tstring& text, const litehtml::tstring& url, litehtml::tstring& baseurl) +void lh_widget::import_css(litehtml::string& text, const litehtml::string& url, litehtml::string& baseurl) { debug_print("lh_widget import_css\n"); baseurl = master_css; @@ -310,7 +310,7 @@ void lh_widget::clear() m_clicked_url.clear(); } -void lh_widget::set_cursor(const litehtml::tchar_t* cursor) +void lh_widget::set_cursor(const char *cursor) { litehtml::element::ptr over_el = m_html->over_element(); @@ -326,10 +326,10 @@ void lh_widget::set_cursor(const litehtml::tchar_t* cursor) } } -void lh_widget::update_cursor(const litehtml::tchar_t* cursor) +void lh_widget::update_cursor(const char *cursor) { GdkCursorType cursType = GDK_ARROW; - const litehtml::tchar_t *href = get_href_at(m_over_element); + const char *href = get_href_at(m_over_element); /* If there is a href, and litehtml is okay with showing a pointer * cursor ("pointer" or "auto"), set it, otherwise keep the @@ -354,7 +354,7 @@ void lh_widget::update_cursor(const litehtml::tchar_t* cursor) } } -const litehtml::tchar_t *lh_widget::get_href_at(litehtml::element::ptr element) const +const char *lh_widget::get_href_at(litehtml::element::ptr element) const { litehtml::element::ptr el; @@ -378,10 +378,10 @@ const litehtml::tchar_t *lh_widget::get_href_at(litehtml::element::ptr element) /* At this point, over_el is pointing at an anchor tag, so let's * grab its href attribute. */ - return el->get_attr(_t("href")); + return el->get_attr("href"); } -const litehtml::tchar_t *lh_widget::get_href_at(const gint x, const gint y) const +const char *lh_widget::get_href_at(const gint x, const gint y) const { litehtml::element::ptr over_el, el; @@ -401,7 +401,7 @@ void lh_widget::print() gtk_widget_realize(GTK_WIDGET(m_drawing_area)); } -void lh_widget::popup_context_menu(const litehtml::tchar_t *url, +void lh_widget::popup_context_menu(const char *url, GdkEventButton *event) { cm_return_if_fail(url != NULL); @@ -432,12 +432,12 @@ void lh_widget::update_font() debug_print("Font set to '%s', size %d\n", m_font_name, m_font_size); } -const litehtml::tstring lh_widget::fullurl(const litehtml::tchar_t *url) const +const litehtml::string lh_widget::fullurl(const char *url) const { if (*url == '#' && !m_base_url.empty()) return m_base_url + url; - return _t(url); + return url; } void lh_widget::set_partinfo(MimeInfo *partinfo) @@ -445,7 +445,7 @@ void lh_widget::set_partinfo(MimeInfo *partinfo) m_partinfo = partinfo; } -GdkPixbuf *lh_widget::get_local_image(const litehtml::tstring url) const +GdkPixbuf *lh_widget::get_local_image(const litehtml::string url) const { GdkPixbuf *pixbuf; const gchar *name; @@ -518,7 +518,7 @@ static gboolean button_press_event(GtkWidget *widget, GdkEventButton *event, /* Right-click */ if (event->button == 3) { - const litehtml::tchar_t *url = w->get_href_at((gint)event->x, (gint)event->y); + const char *url = w->get_href_at((gint)event->x, (gint)event->y); if (url != NULL) w->popup_context_menu(url, event); diff --git a/src/plugins/litehtml_viewer/lh_widget.h b/src/plugins/litehtml_viewer/lh_widget.h @@ -40,42 +40,42 @@ class lh_widget : public container_linux GtkWidget *get_widget() const; /* Methods that litehtml calls */ - void set_caption(const litehtml::tchar_t* caption); - void set_base_url(const litehtml::tchar_t* base_url); - void on_anchor_click(const litehtml::tchar_t* url, const litehtml::element::ptr& el); - void set_cursor(const litehtml::tchar_t* cursor); - void import_css(litehtml::tstring& text, const litehtml::tstring& url, litehtml::tstring& baseurl); + void set_caption(const char *caption); + void set_base_url(const char *base_url); + void on_anchor_click(const char *url, const litehtml::element::ptr& el); + void set_cursor(const char *cursor); + void import_css(litehtml::string& text, const litehtml::string& url, litehtml::string& baseurl); void get_client_rect(litehtml::position& client) const; - inline const litehtml::tchar_t *get_default_font_name() const { return m_font_name; }; + inline const char *get_default_font_name() const { return m_font_name; }; inline int get_default_font_size() const { return m_font_size; }; - litehtml::uint_ptr create_font(const litehtml::tchar_t* faceName, int size, int weight, litehtml::font_style italic, unsigned int decoration, litehtml::font_metrics* fm); + litehtml::uint_ptr create_font(const char *faceName, int size, int weight, litehtml::font_style italic, unsigned int decoration, litehtml::font_metrics* fm); void delete_font(litehtml::uint_ptr hFont); - int text_width(const litehtml::tchar_t* text, litehtml::uint_ptr hFont); - void draw_text(litehtml::uint_ptr hdc, const litehtml::tchar_t* text, litehtml::uint_ptr hFont, litehtml::web_color color, const litehtml::position& pos); + int text_width(const char *text, litehtml::uint_ptr hFont); + void draw_text(litehtml::uint_ptr hdc, const char *text, litehtml::uint_ptr hFont, litehtml::web_color color, const litehtml::position& pos); void draw(cairo_t *cr); void rerender(); void redraw(); void open_html(const gchar *contents); void clear(); - void update_cursor(const litehtml::tchar_t* cursor); + void update_cursor(const char *cursor); void update_font(); void print(); - const litehtml::tchar_t *get_href_at(litehtml::element::ptr element) const; - const litehtml::tchar_t *get_href_at(const gint x, const gint y) const; - void popup_context_menu(const litehtml::tchar_t *url, GdkEventButton *event); - const litehtml::tstring fullurl(const litehtml::tchar_t *url) const; + const char *get_href_at(litehtml::element::ptr element) const; + const char *get_href_at(const gint x, const gint y) const; + void popup_context_menu(const char *url, GdkEventButton *event); + const litehtml::string fullurl(const char *url) const; void set_partinfo(MimeInfo *partinfo); - GdkPixbuf *get_local_image(const litehtml::tstring url) const; + GdkPixbuf *get_local_image(const litehtml::string url) const; void set_cairo_context(cairo_t *cr); litehtml::document::ptr m_html; - litehtml::tstring m_clicked_url; - litehtml::tstring m_base_url; + litehtml::string m_clicked_url; + litehtml::string m_base_url; private: gint m_rendered_width; @@ -90,7 +90,7 @@ class lh_widget : public container_linux MimeInfo *m_partinfo; cairo_t *m_cairo_context; - litehtml::tchar_t *m_font_name; + char *m_font_name; int m_font_size; std::atomic<bool> m_force_render; std::atomic<bool> m_blank; diff --git a/src/plugins/litehtml_viewer/lh_widget_text.cpp b/src/plugins/litehtml_viewer/lh_widget_text.cpp @@ -25,7 +25,7 @@ #include "lh_widget.h" -litehtml::uint_ptr lh_widget::create_font( const litehtml::tchar_t* faceName, int size, int weight, litehtml::font_style italic, unsigned int decoration, litehtml::font_metrics* fm ) +litehtml::uint_ptr lh_widget::create_font( const char *faceName, int size, int weight, litehtml::font_style italic, unsigned int decoration, litehtml::font_metrics* fm ) { PangoFontDescription *desc = pango_font_description_from_string(faceName); @@ -78,7 +78,7 @@ void lh_widget::delete_font( litehtml::uint_ptr hFont ) } } -int lh_widget::text_width( const litehtml::tchar_t* text, litehtml::uint_ptr hFont ) +int lh_widget::text_width( const char *text, litehtml::uint_ptr hFont ) { pango_font *fnt = (pango_font *) hFont; PangoContext *context = gtk_widget_get_pango_context(m_drawing_area); @@ -96,7 +96,7 @@ int lh_widget::text_width( const litehtml::tchar_t* text, litehtml::uint_ptr hFo return rect.width; } -void lh_widget::draw_text( litehtml::uint_ptr hdc, const litehtml::tchar_t* text, litehtml::uint_ptr hFont, litehtml::web_color color, const litehtml::position& pos ) +void lh_widget::draw_text( litehtml::uint_ptr hdc, const char *text, litehtml::uint_ptr hFont, litehtml::web_color color, const litehtml::position& pos ) { pango_font *fnt = (pango_font *)hFont; cairo_t *cr = (cairo_t *)hdc;