mirror of
https://github.com/ZoiteChat/zoitechat.git
synced 2026-09-03 13:43:03 +00:00
Compare commits
12 Commits
keepalive_
...
implement-
| Author | SHA1 | Date | |
|---|---|---|---|
| 424cf9d706 | |||
| db32e3f38d | |||
|
|
7731bfa4e0 | ||
| e72546aaec | |||
| d6d648f0f4 | |||
|
|
56fddd56f5 | ||
|
|
3c9c350bc0 | ||
|
|
8340a04bd6 | ||
|
|
ccef70fd3d | ||
|
|
0650fa7bbe | ||
|
|
5cffa06385 | ||
|
|
4df17a151e |
2
.github/workflows/appimage-build.yml
vendored
2
.github/workflows/appimage-build.yml
vendored
@@ -35,7 +35,7 @@ jobs:
|
|||||||
libxkbcommon0 \
|
libxkbcommon0 \
|
||||||
libgtk-3-bin libglib2.0-bin shared-mime-info gsettings-desktop-schemas \
|
libgtk-3-bin libglib2.0-bin shared-mime-info gsettings-desktop-schemas \
|
||||||
liblua5.4-dev libpci-dev libperl-dev libssl-dev libayatana-appindicator3-dev \
|
liblua5.4-dev libpci-dev libperl-dev libssl-dev libayatana-appindicator3-dev \
|
||||||
perl python3 python3-minimal python3-dev python3-cffi mono-devel desktop-file-utils \
|
perl python3 python3-minimal python3-dev python3-cffi python3-sphinx mono-devel desktop-file-utils \
|
||||||
fonts-noto-color-emoji breeze-gtk-theme \
|
fonts-noto-color-emoji breeze-gtk-theme \
|
||||||
patchelf file curl
|
patchelf file curl
|
||||||
|
|
||||||
|
|||||||
3
.github/workflows/windows-build.yml
vendored
3
.github/workflows/windows-build.yml
vendored
@@ -40,6 +40,7 @@ jobs:
|
|||||||
python -m pip install --upgrade pip
|
python -m pip install --upgrade pip
|
||||||
python -m pip install cffi
|
python -m pip install cffi
|
||||||
python -m pip install zstandard
|
python -m pip install zstandard
|
||||||
|
python -m pip install sphinx
|
||||||
|
|
||||||
$ProgressPreference = 'SilentlyContinue'
|
$ProgressPreference = 'SilentlyContinue'
|
||||||
function Download-WithRetry {
|
function Download-WithRetry {
|
||||||
@@ -66,7 +67,7 @@ jobs:
|
|||||||
Download-WithRetry -Url https://github.com/jrsoftware/issrc/releases/download/is-6_7_1/innosetup-6.7.1.exe -OutFile deps\innosetup-unicode.exe
|
Download-WithRetry -Url https://github.com/jrsoftware/issrc/releases/download/is-6_7_1/innosetup-6.7.1.exe -OutFile deps\innosetup-unicode.exe
|
||||||
& deps\innosetup-unicode.exe /VERYSILENT | Out-Null
|
& deps\innosetup-unicode.exe /VERYSILENT | Out-Null
|
||||||
|
|
||||||
Download-WithRetry -Url https://github.com/ZoiteChat/gvsbuild/releases/download/zoitechat-2.18.1/GTK3_Gvsbuild_zoitechat-2.18.1_x64.zip -OutFile deps\gtk-${{ matrix.arch }}.zip
|
Download-WithRetry -Url https://github.com/ZoiteChat/gvsbuild/releases/download/zoitechat-2.20.0-alpha.1/GTK3_Gvsbuild_zoitechat-2.20.0-alpha.1_x64.zip -OutFile deps\gtk-${{ matrix.arch }}.zip
|
||||||
Expand-Archive -LiteralPath deps\gtk-${{ matrix.arch }}.zip -DestinationPath C:\gtk-build\gtk\x64\release -Force
|
Expand-Archive -LiteralPath deps\gtk-${{ matrix.arch }}.zip -DestinationPath C:\gtk-build\gtk\x64\release -Force
|
||||||
|
|
||||||
Download-WithRetry -Url https://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-hicolor-icon-theme-0.18-1-any.pkg.tar.zst -OutFile deps\hicolor-icon-theme.pkg.tar.zst
|
Download-WithRetry -Url https://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-hicolor-icon-theme-0.18-1-any.pkg.tar.zst -OutFile deps\hicolor-icon-theme.pkg.tar.zst
|
||||||
|
|||||||
42
docs/build-docs.py
Normal file
42
docs/build-docs.py
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
import os
|
||||||
|
import shutil
|
||||||
|
import subprocess
|
||||||
|
import sys
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
if len(sys.argv) != 4:
|
||||||
|
raise SystemExit("usage: build-docs.py SOURCE_DIR OUTPUT_DIR STAMP_FILE")
|
||||||
|
|
||||||
|
source_dir = os.path.abspath(sys.argv[1])
|
||||||
|
output_dir = os.path.abspath(sys.argv[2])
|
||||||
|
stamp_file = os.path.abspath(sys.argv[3])
|
||||||
|
doctree_dir = output_dir + ".doctrees"
|
||||||
|
|
||||||
|
shutil.rmtree(output_dir, ignore_errors=True)
|
||||||
|
shutil.rmtree(doctree_dir, ignore_errors=True)
|
||||||
|
os.makedirs(output_dir, exist_ok=True)
|
||||||
|
|
||||||
|
subprocess.run(
|
||||||
|
[
|
||||||
|
sys.executable,
|
||||||
|
"-m",
|
||||||
|
"sphinx",
|
||||||
|
"-b",
|
||||||
|
"html",
|
||||||
|
"-d",
|
||||||
|
doctree_dir,
|
||||||
|
source_dir,
|
||||||
|
output_dir,
|
||||||
|
],
|
||||||
|
check=True,
|
||||||
|
)
|
||||||
|
|
||||||
|
with open(stamp_file, "w", encoding="utf-8") as stamp:
|
||||||
|
stamp.write("built\n")
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
36
docs/install-docs.py
Normal file
36
docs/install-docs.py
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
import os
|
||||||
|
import shutil
|
||||||
|
import sys
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
if len(sys.argv) != 4:
|
||||||
|
raise SystemExit("usage: install-docs.py STAMP_FILE SOURCE_DIR DATADIR")
|
||||||
|
|
||||||
|
_, source_dir, datadir = sys.argv[1:]
|
||||||
|
source_dir = os.path.abspath(source_dir)
|
||||||
|
|
||||||
|
if not os.path.isfile(sys.argv[1]):
|
||||||
|
raise SystemExit("documentation build did not produce its stamp file")
|
||||||
|
if not os.path.isfile(os.path.join(source_dir, "index.html")):
|
||||||
|
raise SystemExit("documentation build did not produce index.html")
|
||||||
|
|
||||||
|
if os.path.isabs(datadir):
|
||||||
|
destdir = os.environ.get("DESTDIR", "")
|
||||||
|
if destdir:
|
||||||
|
data_root = os.path.join(destdir, datadir.lstrip("/\\"))
|
||||||
|
else:
|
||||||
|
data_root = datadir
|
||||||
|
else:
|
||||||
|
data_root = os.path.join(os.environ["MESON_INSTALL_DESTDIR_PREFIX"], datadir)
|
||||||
|
|
||||||
|
destination = os.path.join(data_root, "doc", "zoitechat", "html")
|
||||||
|
shutil.rmtree(destination, ignore_errors=True)
|
||||||
|
os.makedirs(os.path.dirname(destination), exist_ok=True)
|
||||||
|
shutil.copytree(source_dir, destination)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
@@ -54,6 +54,7 @@
|
|||||||
"buildsystem": "meson",
|
"buildsystem": "meson",
|
||||||
"config-opts": [
|
"config-opts": [
|
||||||
"-Ddbus-service-use-appid=true",
|
"-Ddbus-service-use-appid=true",
|
||||||
|
"-Dinstall-docs=false",
|
||||||
"-Dwith-perl=perl",
|
"-Dwith-perl=perl",
|
||||||
"-Dwith-python=python3",
|
"-Dwith-python=python3",
|
||||||
"-Dwith-lua=lua"
|
"-Dwith-lua=lua"
|
||||||
|
|||||||
38
meson.build
38
meson.build
@@ -35,6 +35,9 @@ config_h.set_quoted('PACKAGE_NAME', meson.project_name())
|
|||||||
config_h.set_quoted('GETTEXT_PACKAGE', 'zoitechat')
|
config_h.set_quoted('GETTEXT_PACKAGE', 'zoitechat')
|
||||||
config_h.set_quoted('LOCALEDIR', join_paths(get_option('prefix'),
|
config_h.set_quoted('LOCALEDIR', join_paths(get_option('prefix'),
|
||||||
get_option('datadir'), 'locale'))
|
get_option('datadir'), 'locale'))
|
||||||
|
config_h.set_quoted('ZOITECHAT_DOCDIR',
|
||||||
|
join_paths(get_option('prefix'), get_option('datadir'), 'doc', 'zoitechat', 'html')
|
||||||
|
)
|
||||||
config_h.set10('ENABLE_NLS', true)
|
config_h.set10('ENABLE_NLS', true)
|
||||||
|
|
||||||
# Optional features
|
# Optional features
|
||||||
@@ -160,6 +163,41 @@ foreach ldflag : test_ldflags
|
|||||||
endforeach
|
endforeach
|
||||||
add_project_link_arguments(global_ldflags, language: 'c')
|
add_project_link_arguments(global_ldflags, language: 'c')
|
||||||
|
|
||||||
|
if get_option('install-docs')
|
||||||
|
docs_python = find_program('python3', 'python')
|
||||||
|
docs_sphinx = run_command(docs_python, '-c', 'import sphinx', check: false)
|
||||||
|
if docs_sphinx.returncode() != 0
|
||||||
|
error('Sphinx is required to build the local HTML documentation. Install Sphinx or configure with -Dinstall-docs=false.')
|
||||||
|
endif
|
||||||
|
|
||||||
|
docs_source_dir = join_paths(meson.source_root(), 'docs')
|
||||||
|
docs_output_dir = join_paths(meson.build_root(), 'docs-html')
|
||||||
|
docs_build_script = join_paths(docs_source_dir, 'build-docs.py')
|
||||||
|
docs_install_script = join_paths(docs_source_dir, 'install-docs.py')
|
||||||
|
|
||||||
|
docs_target = custom_target(
|
||||||
|
'html-documentation',
|
||||||
|
output: 'html-documentation.stamp',
|
||||||
|
command: [
|
||||||
|
docs_python,
|
||||||
|
docs_build_script,
|
||||||
|
docs_source_dir,
|
||||||
|
docs_output_dir,
|
||||||
|
'@OUTPUT@',
|
||||||
|
],
|
||||||
|
build_by_default: true,
|
||||||
|
build_always_stale: true,
|
||||||
|
)
|
||||||
|
|
||||||
|
meson.add_install_script(
|
||||||
|
docs_python,
|
||||||
|
docs_install_script,
|
||||||
|
docs_target,
|
||||||
|
docs_output_dir,
|
||||||
|
get_option('datadir'),
|
||||||
|
)
|
||||||
|
endif
|
||||||
|
|
||||||
subdir('src')
|
subdir('src')
|
||||||
if get_option('plugin')
|
if get_option('plugin')
|
||||||
subdir('plugins')
|
subdir('plugins')
|
||||||
|
|||||||
@@ -33,6 +33,9 @@ option('install-appdata', type: 'boolean',
|
|||||||
option('install-plugin-metainfo', type: 'boolean', value: false,
|
option('install-plugin-metainfo', type: 'boolean', value: false,
|
||||||
description: 'Installs metainfo files for enabled plugins, useful when distros create split packages'
|
description: 'Installs metainfo files for enabled plugins, useful when distros create split packages'
|
||||||
)
|
)
|
||||||
|
option('install-docs', type: 'boolean', value: true,
|
||||||
|
description: 'Build and install the local HTML documentation'
|
||||||
|
)
|
||||||
|
|
||||||
# Plugins
|
# Plugins
|
||||||
option('with-checksum', type: 'boolean',
|
option('with-checksum', type: 'boolean',
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ BuildRequires: perl
|
|||||||
BuildRequires: perl-devel
|
BuildRequires: perl-devel
|
||||||
BuildRequires: python3
|
BuildRequires: python3
|
||||||
BuildRequires: python3-cffi
|
BuildRequires: python3-cffi
|
||||||
|
BuildRequires: python3-sphinx
|
||||||
BuildRequires: publicsuffix-list
|
BuildRequires: publicsuffix-list
|
||||||
BuildRequires: xwayland-run
|
BuildRequires: xwayland-run
|
||||||
BuildRequires: weston
|
BuildRequires: weston
|
||||||
@@ -87,6 +88,7 @@ xwfb-run -- /usr/bin/meson test -C %{_vpath_builddir} --num-processes %{_smp_bui
|
|||||||
%{_datadir}/icons/hicolor/scalable/apps/net.zoite.Zoitechat.svg
|
%{_datadir}/icons/hicolor/scalable/apps/net.zoite.Zoitechat.svg
|
||||||
%{_datadir}/metainfo/net.zoite.Zoitechat.appdata.xml
|
%{_datadir}/metainfo/net.zoite.Zoitechat.appdata.xml
|
||||||
%{_datadir}/metainfo/net.zoite.Zoitechat*.metainfo.xml
|
%{_datadir}/metainfo/net.zoite.Zoitechat*.metainfo.xml
|
||||||
|
%{_datadir}/doc/zoitechat/html/
|
||||||
%dir %{_libdir}/zoitechat
|
%dir %{_libdir}/zoitechat
|
||||||
%dir %{_libdir}/zoitechat/plugins
|
%dir %{_libdir}/zoitechat/plugins
|
||||||
%dir %{_libdir}/zoitechat/python
|
%dir %{_libdir}/zoitechat/python
|
||||||
|
|||||||
@@ -591,6 +591,7 @@ const struct prefs vars[] =
|
|||||||
{"text_replay", P_OFFINT (hex_text_replay), TYPE_BOOL},
|
{"text_replay", P_OFFINT (hex_text_replay), TYPE_BOOL},
|
||||||
{"text_search_case_match", P_OFFINT (hex_text_search_case_match), TYPE_BOOL},
|
{"text_search_case_match", P_OFFINT (hex_text_search_case_match), TYPE_BOOL},
|
||||||
{"text_search_highlight_all", P_OFFINT (hex_text_search_highlight_all), TYPE_BOOL},
|
{"text_search_highlight_all", P_OFFINT (hex_text_search_highlight_all), TYPE_BOOL},
|
||||||
|
{"text_search_keep_position", P_OFFINT (hex_text_search_keep_position), TYPE_BOOL},
|
||||||
{"text_search_follow", P_OFFINT (hex_text_search_follow), TYPE_BOOL},
|
{"text_search_follow", P_OFFINT (hex_text_search_follow), TYPE_BOOL},
|
||||||
{"text_search_regexp", P_OFFINT (hex_text_search_regexp), TYPE_BOOL},
|
{"text_search_regexp", P_OFFINT (hex_text_search_regexp), TYPE_BOOL},
|
||||||
{"text_show_marker", P_OFFINT (hex_text_show_marker), TYPE_BOOL},
|
{"text_show_marker", P_OFFINT (hex_text_show_marker), TYPE_BOOL},
|
||||||
|
|||||||
@@ -374,14 +374,6 @@ server_inline (server *serv, char *line, gssize len)
|
|||||||
else
|
else
|
||||||
line = text_convert_invalid (line, len, serv->read_converter, unicode_fallback_string, &len_utf8);
|
line = text_convert_invalid (line, len, serv->read_converter, unicode_fallback_string, &len_utf8);
|
||||||
|
|
||||||
/* Any complete IRC line proves that the connection is alive. */
|
|
||||||
serv->ping_recv = time (0);
|
|
||||||
if (serv->lag_sent)
|
|
||||||
{
|
|
||||||
serv->lag_sent = 0;
|
|
||||||
fe_set_lag (serv, serv->lag);
|
|
||||||
}
|
|
||||||
|
|
||||||
fe_add_rawlog (serv, line, len_utf8, FALSE);
|
fe_add_rawlog (serv, line, len_utf8, FALSE);
|
||||||
|
|
||||||
/* let proto-irc.c handle it */
|
/* let proto-irc.c handle it */
|
||||||
|
|||||||
@@ -217,6 +217,7 @@ struct zoitechatprefs
|
|||||||
unsigned int hex_text_replay;
|
unsigned int hex_text_replay;
|
||||||
unsigned int hex_text_search_case_match;
|
unsigned int hex_text_search_case_match;
|
||||||
unsigned int hex_text_search_highlight_all;
|
unsigned int hex_text_search_highlight_all;
|
||||||
|
unsigned int hex_text_search_keep_position;
|
||||||
unsigned int hex_text_search_follow;
|
unsigned int hex_text_search_follow;
|
||||||
unsigned int hex_text_search_regexp;
|
unsigned int hex_text_search_regexp;
|
||||||
unsigned int hex_text_show_marker;
|
unsigned int hex_text_show_marker;
|
||||||
|
|||||||
@@ -4688,7 +4688,11 @@ mg_search_toggle(session *sess)
|
|||||||
{
|
{
|
||||||
gtk_widget_hide(sess->gui->shbox);
|
gtk_widget_hide(sess->gui->shbox);
|
||||||
gtk_widget_grab_focus(sess->gui->input_box);
|
gtk_widget_grab_focus(sess->gui->input_box);
|
||||||
|
if (prefs.hex_text_search_keep_position)
|
||||||
|
g_signal_handler_block (sess->gui->shentry, sess->gui->search_changed_signal);
|
||||||
gtk_entry_set_text(GTK_ENTRY(sess->gui->shentry), "");
|
gtk_entry_set_text(GTK_ENTRY(sess->gui->shentry), "");
|
||||||
|
if (prefs.hex_text_search_keep_position)
|
||||||
|
g_signal_handler_unblock (sess->gui->shentry, sess->gui->search_changed_signal);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -4702,10 +4706,19 @@ mg_search_toggle(session *sess)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
search_handle_esc (GtkWidget *win, GdkEventKey *key, session *sess)
|
search_handle_keypress (GtkWidget *win, GdkEventKey *key, session *sess)
|
||||||
{
|
{
|
||||||
if (key->keyval == GDK_KEY_Escape)
|
if (key->keyval == GDK_KEY_Escape)
|
||||||
|
{
|
||||||
mg_search_toggle(sess);
|
mg_search_toggle(sess);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (((key->keyval == GDK_KEY_Page_Up || key->keyval == GDK_KEY_Page_Down) &&
|
||||||
|
!(key->state & gtk_accelerator_get_default_mod_mask ())) ||
|
||||||
|
((key->keyval == GDK_KEY_Up || key->keyval == GDK_KEY_Down) &&
|
||||||
|
(key->state & gtk_accelerator_get_default_mod_mask ()) == GDK_SHIFT_MASK))
|
||||||
|
return key_handle_key_press (sess->gui->input_box, key, sess);
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@@ -4735,7 +4748,7 @@ mg_create_search(session *sess, GtkWidget *box)
|
|||||||
mg_apply_emoji_fallback_widget (entry);
|
mg_apply_emoji_fallback_widget (entry);
|
||||||
mg_apply_entry_scroll_artifact_fix (entry);
|
mg_apply_entry_scroll_artifact_fix (entry);
|
||||||
gui->search_changed_signal = g_signal_connect(G_OBJECT(entry), "changed", G_CALLBACK(search_handle_change), sess);
|
gui->search_changed_signal = g_signal_connect(G_OBJECT(entry), "changed", G_CALLBACK(search_handle_change), sess);
|
||||||
g_signal_connect (G_OBJECT (entry), "key-press-event", G_CALLBACK (search_handle_esc), sess);
|
g_signal_connect (G_OBJECT (entry), "key-press-event", G_CALLBACK (search_handle_keypress), sess);
|
||||||
g_signal_connect(G_OBJECT(entry), "activate", G_CALLBACK(mg_search_handle_next), sess);
|
g_signal_connect(G_OBJECT(entry), "activate", G_CALLBACK(mg_search_handle_next), sess);
|
||||||
gtk_entry_set_icon_activatable (GTK_ENTRY (entry), GTK_ENTRY_ICON_SECONDARY, FALSE);
|
gtk_entry_set_icon_activatable (GTK_ENTRY (entry), GTK_ENTRY_ICON_SECONDARY, FALSE);
|
||||||
gtk_entry_set_icon_tooltip_text (GTK_ENTRY (sess->gui->shentry), GTK_ENTRY_ICON_SECONDARY, _("Search hit end or not found."));
|
gtk_entry_set_icon_tooltip_text (GTK_ENTRY (sess->gui->shentry), GTK_ENTRY_ICON_SECONDARY, _("Search hit end or not found."));
|
||||||
|
|||||||
@@ -1740,9 +1740,50 @@ menu_ctcpguiopen (void)
|
|||||||
editlist_gui_open (NULL, NULL, ctcp_list, buf, "ctcpreply", "ctcpreply.conf", ctcp_help);
|
editlist_gui_open (NULL, NULL, ctcp_list, buf, "ctcpreply", "ctcpreply.conf", ctcp_help);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static char *
|
||||||
|
menu_find_local_docs (void)
|
||||||
|
{
|
||||||
|
char *path;
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
char *base_path;
|
||||||
|
|
||||||
|
base_path = g_win32_get_package_installation_directory_of_module (NULL);
|
||||||
|
if (!base_path)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
path = g_build_filename (base_path, "share", "doc", "zoitechat", "html", "index.html", NULL);
|
||||||
|
g_free (base_path);
|
||||||
|
#else
|
||||||
|
const char *appdir;
|
||||||
|
|
||||||
|
appdir = g_getenv ("APPDIR");
|
||||||
|
if (appdir && *appdir)
|
||||||
|
path = g_build_filename (appdir, "usr", "share", "doc", "zoitechat", "html", "index.html", NULL);
|
||||||
|
else
|
||||||
|
path = g_build_filename (ZOITECHAT_DOCDIR, "index.html", NULL);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (g_file_test (path, G_FILE_TEST_IS_REGULAR))
|
||||||
|
return path;
|
||||||
|
|
||||||
|
g_free (path);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
menu_docs (GtkWidget *wid, gpointer none)
|
menu_docs (GtkWidget *wid, gpointer none)
|
||||||
{
|
{
|
||||||
|
char *path;
|
||||||
|
|
||||||
|
path = menu_find_local_docs ();
|
||||||
|
if (path)
|
||||||
|
{
|
||||||
|
fe_open_url (path);
|
||||||
|
g_free (path);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
fe_open_url ("https://docs.zoitechat.org/en/latest/");
|
fe_open_url ("https://docs.zoitechat.org/en/latest/");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -171,6 +171,7 @@ static const setting appearance_settings[] =
|
|||||||
{ST_TOGGLE, N_("Colored nick names"), P_OFFINTNL(hex_text_color_nicks), N_("Give each person on IRC a different color"),0,0},
|
{ST_TOGGLE, N_("Colored nick names"), P_OFFINTNL(hex_text_color_nicks), N_("Give each person on IRC a different color"),0,0},
|
||||||
{ST_TOGGLR, N_("Indent nick names"), P_OFFINTNL(hex_text_indent), N_("Make nick names right-justified"),0,0},
|
{ST_TOGGLR, N_("Indent nick names"), P_OFFINTNL(hex_text_indent), N_("Make nick names right-justified"),0,0},
|
||||||
{ST_TOGGLE, N_ ("Show marker line"), P_OFFINTNL (hex_text_show_marker), N_ ("Insert a red line after the last read text."), 0, 0},
|
{ST_TOGGLE, N_ ("Show marker line"), P_OFFINTNL (hex_text_show_marker), N_ ("Insert a red line after the last read text."), 0, 0},
|
||||||
|
{ST_TOGGLE, N_("Keep search position when closing"), P_OFFINTNL(hex_text_search_keep_position), 0, 0, 0},
|
||||||
|
|
||||||
{ST_HEADER, N_("Timestamps"),0,0,0},
|
{ST_HEADER, N_("Timestamps"),0,0,0},
|
||||||
{ST_TOGGLE, N_("Enable timestamps"), P_OFFINTNL(hex_stamp_text),0,0,1},
|
{ST_TOGGLE, N_("Enable timestamps"), P_OFFINTNL(hex_stamp_text),0,0,1},
|
||||||
@@ -219,7 +220,7 @@ static const setting inputbox_settings[] =
|
|||||||
{ST_TOGGLE, N_("Spell checking"), P_OFFINTNL(hex_gui_input_spell),0,0,1},
|
{ST_TOGGLE, N_("Spell checking"), P_OFFINTNL(hex_gui_input_spell),0,0,1},
|
||||||
{ST_ENTRY, N_("Dictionaries to use:"), P_OFFSETNL(hex_text_spell_langs),0,0,sizeof prefs.hex_text_spell_langs},
|
{ST_ENTRY, N_("Dictionaries to use:"), P_OFFSETNL(hex_text_spell_langs),0,0,sizeof prefs.hex_text_spell_langs},
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
{ST_LABEL, N_("Use language codes (as in \"%LOCALAPPDATA%\\enchant\\myspell\\dicts\").\nSeparate multiple entries with commas.")},
|
{ST_LABEL, N_("Use language codes (for example, \"en_US\").\nOn Windows 8 and newer, dictionaries are provided by Windows. Separate multiple entries with commas.")},
|
||||||
#else
|
#else
|
||||||
{ST_LABEL, N_("Use language codes. Separate multiple entries with commas.")},
|
{ST_LABEL, N_("Use language codes. Separate multiple entries with commas.")},
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -113,6 +113,9 @@ static void (*enchant_dict_describe) (struct EnchantDict * dict, EnchantDictDesc
|
|||||||
static void (*enchant_dict_free_suggestions) (struct EnchantDict * dict, char **suggestions);
|
static void (*enchant_dict_free_suggestions) (struct EnchantDict * dict, char **suggestions);
|
||||||
static void (*enchant_dict_store_replacement) (struct EnchantDict * dict, const char *const mis, ssize_t mis_len, const char *const cor, ssize_t cor_len);
|
static void (*enchant_dict_store_replacement) (struct EnchantDict * dict, const char *const mis, ssize_t mis_len, const char *const cor, ssize_t cor_len);
|
||||||
static char ** (*enchant_dict_suggest) (struct EnchantDict * dict, const char *const word, ssize_t len, size_t * out_n_suggs);
|
static char ** (*enchant_dict_suggest) (struct EnchantDict * dict, const char *const word, ssize_t len, size_t * out_n_suggs);
|
||||||
|
#ifdef G_OS_WIN32
|
||||||
|
static void (*enchant_set_prefix_dir) (const char *dir);
|
||||||
|
#endif
|
||||||
static gboolean have_enchant = FALSE;
|
static gboolean have_enchant = FALSE;
|
||||||
|
|
||||||
struct _SexySpellEntryPriv
|
struct _SexySpellEntryPriv
|
||||||
@@ -198,14 +201,16 @@ initialize_enchant (void)
|
|||||||
gsize i;
|
gsize i;
|
||||||
const char * const libnames[] = {
|
const char * const libnames[] = {
|
||||||
#ifdef G_OS_WIN32
|
#ifdef G_OS_WIN32
|
||||||
|
"libenchant-2.dll",
|
||||||
|
"libenchant-2-2.dll",
|
||||||
"libenchant.dll",
|
"libenchant.dll",
|
||||||
#endif
|
#endif
|
||||||
#ifdef G_OS_UNIX
|
#ifdef G_OS_UNIX
|
||||||
"libenchant.so.1",
|
|
||||||
"libenchant.so.2",
|
"libenchant.so.2",
|
||||||
"libenchant-2.so.2",
|
"libenchant-2.so.2",
|
||||||
#endif
|
#endif
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
|
"libenchant-2.dylib",
|
||||||
"libenchant.dylib",
|
"libenchant.dylib",
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
@@ -255,6 +260,23 @@ initialize_enchant (void)
|
|||||||
MODULE_SYMBOL("enchant_dict_store_replacement",
|
MODULE_SYMBOL("enchant_dict_store_replacement",
|
||||||
enchant_dict_store_replacement, NULL)
|
enchant_dict_store_replacement, NULL)
|
||||||
MODULE_SYMBOL("enchant_dict_suggest", enchant_dict_suggest, NULL)
|
MODULE_SYMBOL("enchant_dict_suggest", enchant_dict_suggest, NULL)
|
||||||
|
|
||||||
|
#ifdef G_OS_WIN32
|
||||||
|
if (g_module_symbol(enchant, "enchant_set_prefix_dir", &funcptr))
|
||||||
|
{
|
||||||
|
gchar *install_dir;
|
||||||
|
|
||||||
|
enchant_set_prefix_dir = funcptr;
|
||||||
|
install_dir = g_win32_get_package_installation_directory_of_module(NULL);
|
||||||
|
|
||||||
|
if (install_dir)
|
||||||
|
{
|
||||||
|
enchant_set_prefix_dir(install_dir);
|
||||||
|
g_info("Enchant prefix dir set to %s", install_dir);
|
||||||
|
g_free(install_dir);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
@@ -1,2 +0,0 @@
|
|||||||
EXPORTS
|
|
||||||
init_enchant_provider
|
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<ItemGroup Label="ProjectConfigurations">
|
|
||||||
<ProjectConfiguration Include="Release|x64">
|
|
||||||
<Configuration>Release</Configuration>
|
|
||||||
<Platform>x64</Platform>
|
|
||||||
</ProjectConfiguration>
|
|
||||||
</ItemGroup>
|
|
||||||
<PropertyGroup Label="Globals">
|
|
||||||
<ProjectGuid>{BF0EBC16-68AD-4CD1-864C-5B56836EBE2A}</ProjectGuid>
|
|
||||||
<Keyword>Win32Proj</Keyword>
|
|
||||||
<RootNamespace>libenchant_win8</RootNamespace>
|
|
||||||
</PropertyGroup>
|
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
|
||||||
<PropertyGroup Label="Configuration">
|
|
||||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
|
||||||
<PlatformToolset>v142</PlatformToolset>
|
|
||||||
</PropertyGroup>
|
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
|
||||||
<Import Project="..\..\win32\zoitechat.props" />
|
|
||||||
<ImportGroup Label="PropertySheets">
|
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
|
||||||
</ImportGroup>
|
|
||||||
<PropertyGroup>
|
|
||||||
<OutDir>$(ZoiteChatRel)lib\enchant\</OutDir>
|
|
||||||
<TargetName>libenchant_win8</TargetName>
|
|
||||||
</PropertyGroup>
|
|
||||||
<ItemDefinitionGroup>
|
|
||||||
<ClCompile>
|
|
||||||
<AdditionalIncludeDirectories>..\common;$(ZoiteChatLib);$(DepsRoot)\include\enchant;$(DepsRoot)\include;$(OpenSslInclude);$(Glib);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
|
||||||
</ClCompile>
|
|
||||||
<Link>
|
|
||||||
<AdditionalDependencies>$(DepLibs);%(AdditionalDependencies)</AdditionalDependencies>
|
|
||||||
<AdditionalLibraryDirectories>$(DepsRoot)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
|
||||||
<ModuleDefinitionFile>libenchant_win8.def</ModuleDefinitionFile>
|
|
||||||
</Link>
|
|
||||||
</ItemDefinitionGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ClCompile Include="win8_provider.cpp" />
|
|
||||||
</ItemGroup>
|
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
|
||||||
</Project>
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<ItemGroup>
|
|
||||||
<Filter Include="Source Files">
|
|
||||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
|
||||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
|
||||||
</Filter>
|
|
||||||
<Filter Include="Header Files">
|
|
||||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
|
||||||
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
|
||||||
</Filter>
|
|
||||||
<Filter Include="Resource Files">
|
|
||||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
|
||||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
|
||||||
</Filter>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ClCompile Include="win8_provider.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
</ItemGroup>
|
|
||||||
</Project>
|
|
||||||
@@ -1,340 +0,0 @@
|
|||||||
/* ZoiteChat
|
|
||||||
* Copyright (c) 2015 Patrick Griffis
|
|
||||||
*
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
|
||||||
* in the Software without restriction, including without limitation the rights
|
|
||||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
* copies of the Software, and to permit persons to whom the Software is
|
|
||||||
* furnished to do so, subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be included in
|
|
||||||
* all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
* THE SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
#include <Spellcheck.h>
|
|
||||||
#include <windows.h>
|
|
||||||
|
|
||||||
#include <cstdlib>
|
|
||||||
#include <climits>
|
|
||||||
|
|
||||||
#include "typedef.h" // for ssize_t
|
|
||||||
#include <enchant-provider.h>
|
|
||||||
|
|
||||||
ENCHANT_PLUGIN_DECLARE ("win8")
|
|
||||||
|
|
||||||
static int
|
|
||||||
size_to_int (size_t value)
|
|
||||||
{
|
|
||||||
return value > static_cast<size_t>(INT_MAX) ? INT_MAX : static_cast<int>(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
static char *
|
|
||||||
utf16_to_utf8 (const wchar_t * const str, bool from_bcp47)
|
|
||||||
{
|
|
||||||
if (!str)
|
|
||||||
return nullptr;
|
|
||||||
|
|
||||||
int needed = WideCharToMultiByte (CP_UTF8, 0, str, -1, nullptr, 0, nullptr, nullptr);
|
|
||||||
if (needed <= 0)
|
|
||||||
return nullptr;
|
|
||||||
|
|
||||||
char *utf8 = static_cast<char*>(std::malloc (static_cast<size_t>(needed)));
|
|
||||||
if (!utf8)
|
|
||||||
return nullptr;
|
|
||||||
|
|
||||||
if (WideCharToMultiByte (CP_UTF8, 0, str, -1, utf8, needed, nullptr, nullptr) != needed)
|
|
||||||
{
|
|
||||||
std::free (utf8);
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
if (utf8 && from_bcp47)
|
|
||||||
{
|
|
||||||
char *p = utf8;
|
|
||||||
/* bcp47 tags use syntax "en-US" while the myspell versions are "en_US" */
|
|
||||||
while (*p)
|
|
||||||
{
|
|
||||||
if (*p == '-')
|
|
||||||
*p = '_';
|
|
||||||
p++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return utf8;
|
|
||||||
}
|
|
||||||
|
|
||||||
static wchar_t *
|
|
||||||
utf8_to_utf16 (const char * const str, int len, bool to_bcp47)
|
|
||||||
{
|
|
||||||
if (!str)
|
|
||||||
return nullptr;
|
|
||||||
|
|
||||||
int needed = MultiByteToWideChar (CP_UTF8, 0, str, len, nullptr, 0);
|
|
||||||
if (needed <= 0)
|
|
||||||
return nullptr;
|
|
||||||
|
|
||||||
int alloc_len = (len == -1) ? needed : needed + 1;
|
|
||||||
wchar_t *utf16 = static_cast<wchar_t*>(std::malloc (sizeof (wchar_t) * static_cast<size_t>(alloc_len)));
|
|
||||||
if (!utf16)
|
|
||||||
return nullptr;
|
|
||||||
|
|
||||||
if (MultiByteToWideChar (CP_UTF8, 0, str, len, utf16, needed) != needed)
|
|
||||||
{
|
|
||||||
std::free (utf16);
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
if (len != -1)
|
|
||||||
utf16[needed] = L'\0';
|
|
||||||
if (utf16 && to_bcp47)
|
|
||||||
{
|
|
||||||
wchar_t *p = utf16;
|
|
||||||
/* bcp47 tags use syntax "en-US" while the myspell versions are "en_US" */
|
|
||||||
while (*p)
|
|
||||||
{
|
|
||||||
if (*p == L'_')
|
|
||||||
*p = L'-';
|
|
||||||
p++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return utf16;
|
|
||||||
}
|
|
||||||
|
|
||||||
static char **
|
|
||||||
enumstring_to_chararray (IEnumString *strings, size_t *out_len, bool from_bcp47)
|
|
||||||
{
|
|
||||||
char **chars = static_cast<char**>(std::calloc (256, sizeof (char*)));
|
|
||||||
LPOLESTR wstr = nullptr;
|
|
||||||
size_t i = 0;
|
|
||||||
|
|
||||||
if (!chars)
|
|
||||||
{
|
|
||||||
*out_len = 0;
|
|
||||||
strings->Release ();
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
while (SUCCEEDED (strings->Next (1, &wstr, nullptr)) && i < 256 && wstr)
|
|
||||||
{
|
|
||||||
char *str = utf16_to_utf8 (wstr, from_bcp47);
|
|
||||||
if (str)
|
|
||||||
{
|
|
||||||
chars[i] = str;
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
CoTaskMemFree (wstr);
|
|
||||||
}
|
|
||||||
chars[i] = nullptr;
|
|
||||||
strings->Release ();
|
|
||||||
|
|
||||||
*out_len = i;
|
|
||||||
return chars;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
win8_dict_add_to_personal (EnchantDict *dict, const char *const word, size_t len)
|
|
||||||
{
|
|
||||||
auto checker = static_cast<ISpellChecker*>(dict->user_data);
|
|
||||||
wchar_t *wword = utf8_to_utf16 (word, size_to_int (len), false);
|
|
||||||
|
|
||||||
checker->Add (wword);
|
|
||||||
std::free (wword);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
win8_dict_add_to_session (EnchantDict *dict, const char *const word, size_t len)
|
|
||||||
{
|
|
||||||
auto checker = static_cast<ISpellChecker*>(dict->user_data);
|
|
||||||
wchar_t *wword = utf8_to_utf16 (word, size_to_int (len), false);
|
|
||||||
|
|
||||||
checker->Ignore (wword);
|
|
||||||
std::free (wword);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
win8_dict_check (EnchantDict *dict, const char *const word, size_t len)
|
|
||||||
{
|
|
||||||
auto checker = static_cast<ISpellChecker*>(dict->user_data);
|
|
||||||
wchar_t *wword = utf8_to_utf16 (word, size_to_int (len), false);
|
|
||||||
IEnumSpellingError *errors;
|
|
||||||
ISpellingError *error = nullptr;
|
|
||||||
HRESULT hr;
|
|
||||||
|
|
||||||
hr = checker->Check (wword, &errors);
|
|
||||||
std::free (wword);
|
|
||||||
|
|
||||||
if (FAILED (hr))
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
if (errors->Next (&error) == S_OK)
|
|
||||||
{
|
|
||||||
error->Release ();
|
|
||||||
errors->Release ();
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
errors->Release ();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static char **
|
|
||||||
win8_dict_suggest (EnchantDict *dict, const char *const word, size_t len, size_t *out_n_suggs)
|
|
||||||
{
|
|
||||||
auto checker = static_cast<ISpellChecker*>(dict->user_data);
|
|
||||||
wchar_t *wword = utf8_to_utf16 (word, size_to_int (len), false);
|
|
||||||
IEnumString *suggestions;
|
|
||||||
HRESULT hr;
|
|
||||||
|
|
||||||
hr = checker->Suggest (wword, &suggestions);
|
|
||||||
std::free (wword);
|
|
||||||
|
|
||||||
if (FAILED (hr))
|
|
||||||
{
|
|
||||||
*out_n_suggs = 0;
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
return enumstring_to_chararray (suggestions, out_n_suggs, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
static EnchantDict *
|
|
||||||
win8_provider_request_dict (EnchantProvider *provider, const char *const tag)
|
|
||||||
{
|
|
||||||
auto factory = static_cast<ISpellCheckerFactory*>(provider->user_data);
|
|
||||||
ISpellChecker *checker;
|
|
||||||
EnchantDict *dict;
|
|
||||||
wchar_t *wtag = utf8_to_utf16 (tag, -1, true);
|
|
||||||
HRESULT hr;
|
|
||||||
|
|
||||||
hr = factory->CreateSpellChecker (wtag, &checker);
|
|
||||||
std::free (wtag);
|
|
||||||
|
|
||||||
if (FAILED (hr))
|
|
||||||
return nullptr;
|
|
||||||
|
|
||||||
dict = static_cast<EnchantDict*>(std::calloc (1, sizeof (EnchantDict)));
|
|
||||||
dict->suggest = win8_dict_suggest;
|
|
||||||
dict->check = win8_dict_check;
|
|
||||||
dict->add_to_personal = win8_dict_add_to_personal;
|
|
||||||
dict->add_to_exclude = win8_dict_add_to_personal;
|
|
||||||
dict->add_to_session = win8_dict_add_to_session;
|
|
||||||
|
|
||||||
dict->user_data = checker;
|
|
||||||
|
|
||||||
return dict;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
win8_provider_dispose_dict (EnchantProvider *provider, EnchantDict *dict)
|
|
||||||
{
|
|
||||||
if (dict)
|
|
||||||
{
|
|
||||||
auto checker = static_cast<ISpellChecker*>(dict->user_data);
|
|
||||||
|
|
||||||
checker->Release ();
|
|
||||||
std::free (dict);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
win8_provider_dictionary_exists (EnchantProvider *provider, const char *const tag)
|
|
||||||
{
|
|
||||||
auto factory = static_cast<ISpellCheckerFactory*>(provider->user_data);
|
|
||||||
wchar_t *wtag = utf8_to_utf16 (tag, -1, true);
|
|
||||||
|
|
||||||
BOOL is_supported = FALSE;
|
|
||||||
factory->IsSupported (wtag, &is_supported);
|
|
||||||
|
|
||||||
std::free (wtag);
|
|
||||||
return is_supported;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static char **
|
|
||||||
win8_provider_list_dicts (EnchantProvider *provider, size_t *out_n_dicts)
|
|
||||||
{
|
|
||||||
auto factory = static_cast<ISpellCheckerFactory*>(provider->user_data);
|
|
||||||
IEnumString *dicts;
|
|
||||||
|
|
||||||
if (FAILED(factory->get_SupportedLanguages (&dicts)))
|
|
||||||
{
|
|
||||||
*out_n_dicts = 0;
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
return enumstring_to_chararray (dicts, out_n_dicts, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
win8_provider_free_string_list (EnchantProvider *provider, char **str_list)
|
|
||||||
{
|
|
||||||
if (!str_list)
|
|
||||||
return;
|
|
||||||
for (size_t i = 0; str_list[i]; ++i)
|
|
||||||
std::free (str_list[i]);
|
|
||||||
std::free (str_list);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
win8_provider_dispose (EnchantProvider *provider)
|
|
||||||
{
|
|
||||||
if (provider)
|
|
||||||
{
|
|
||||||
auto factory = static_cast<ISpellCheckerFactory*>(provider->user_data);
|
|
||||||
|
|
||||||
factory->Release();
|
|
||||||
std::free (provider);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static const char *
|
|
||||||
win8_provider_identify (EnchantProvider *provider)
|
|
||||||
{
|
|
||||||
return "win8";
|
|
||||||
}
|
|
||||||
|
|
||||||
static const char *
|
|
||||||
win8_provider_describe (EnchantProvider *provider)
|
|
||||||
{
|
|
||||||
return "Windows 8 SpellCheck Provider";
|
|
||||||
}
|
|
||||||
|
|
||||||
extern "C"
|
|
||||||
{
|
|
||||||
|
|
||||||
EnchantProvider *
|
|
||||||
init_enchant_provider (void)
|
|
||||||
{
|
|
||||||
EnchantProvider *provider;
|
|
||||||
ISpellCheckerFactory *factory;
|
|
||||||
|
|
||||||
if (FAILED (CoCreateInstance (__uuidof(SpellCheckerFactory), nullptr,
|
|
||||||
CLSCTX_INPROC_SERVER, IID_PPV_ARGS (&factory))))
|
|
||||||
return nullptr;
|
|
||||||
|
|
||||||
provider = static_cast<EnchantProvider*>(std::calloc (1, sizeof (EnchantProvider)));
|
|
||||||
provider->dispose = win8_provider_dispose;
|
|
||||||
provider->request_dict = win8_provider_request_dict;
|
|
||||||
provider->dispose_dict = win8_provider_dispose_dict;
|
|
||||||
provider->dictionary_exists = win8_provider_dictionary_exists;
|
|
||||||
provider->identify = win8_provider_identify;
|
|
||||||
provider->describe = win8_provider_describe;
|
|
||||||
provider->list_dicts = win8_provider_list_dicts;
|
|
||||||
provider->free_string_list = win8_provider_free_string_list;
|
|
||||||
|
|
||||||
provider->user_data = factory;
|
|
||||||
|
|
||||||
return provider;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -30,6 +30,8 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
<Target Name="Build">
|
<Target Name="Build">
|
||||||
|
<Exec Command=""$(Python3Path)\python.exe" "$(SolutionDir)..\docs\build-docs.py" "$(SolutionDir)..\docs" "$(ZoiteChatBuild)\$(ZoiteChatPlatform)\docs-html" "$(ZoiteChatBuild)\$(ZoiteChatPlatform)\html-documentation.stamp"" />
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="$(DepsRoot)\bin\*atk-1.0-0.dll" />
|
<None Include="$(DepsRoot)\bin\*atk-1.0-0.dll" />
|
||||||
<None Include="$(DepsRoot)\bin\*cairo*.dll" />
|
<None Include="$(DepsRoot)\bin\*cairo*.dll" />
|
||||||
@@ -73,7 +75,7 @@
|
|||||||
<LuaShare Include="$(LuaShareDir)\**\*.lua" Condition="'$(LuaEnabled)'=='true' and '$(LuaShareDir)'!=''" />
|
<LuaShare Include="$(LuaShareDir)\**\*.lua" Condition="'$(LuaEnabled)'=='true' and '$(LuaShareDir)'!=''" />
|
||||||
<Typelib Include="$(DepsRoot)\lib\girepository-1.0\*.typelib" Condition="'$(LuaEnabled)'=='true' and '$(LuaLibDir)'!=''" />
|
<Typelib Include="$(DepsRoot)\lib\girepository-1.0\*.typelib" Condition="'$(LuaEnabled)'=='true' and '$(LuaLibDir)'!=''" />
|
||||||
|
|
||||||
<EnchantProviders Include="$(DepsRoot)\lib\enchant\*.dll" />
|
<EnchantProviders Include="$(DepsRoot)\lib\enchant-2\*.dll" />
|
||||||
|
|
||||||
<Gtk3Immodules Include="$(DepsRoot)\lib\gtk-3.0\3.0.0\immodules\**\*" />
|
<Gtk3Immodules Include="$(DepsRoot)\lib\gtk-3.0\3.0.0\immodules\**\*" />
|
||||||
<Gtk3PrintBackends Include="$(DepsRoot)\lib\gtk-3.0\3.0.0\printbackends\**\*" />
|
<Gtk3PrintBackends Include="$(DepsRoot)\lib\gtk-3.0\3.0.0\printbackends\**\*" />
|
||||||
@@ -82,6 +84,7 @@
|
|||||||
<GdkPixbufLoaderCache Include="$(DepsRoot)\lib\gdk-pixbuf-2.0\**\loaders.cache" />
|
<GdkPixbufLoaderCache Include="$(DepsRoot)\lib\gdk-pixbuf-2.0\**\loaders.cache" />
|
||||||
|
|
||||||
<FontConfig Include="$(DepsRoot)\etc\fonts\*" />
|
<FontConfig Include="$(DepsRoot)\etc\fonts\*" />
|
||||||
|
<Docs Include="$(ZoiteChatBuild)\$(ZoiteChatPlatform)\docs-html\**\*" />
|
||||||
<Share Include="share\**\*" />
|
<Share Include="share\**\*" />
|
||||||
<Locale Include="$(ZoiteChatBin)locale\**\*;$(DepsRoot)\share\locale\**\*" />
|
<Locale Include="$(ZoiteChatBin)locale\**\*;$(DepsRoot)\share\locale\**\*" />
|
||||||
<MSWindowsTheme Include="$(DepsRoot)\share\themes\MS-Windows\**\*" />
|
<MSWindowsTheme Include="$(DepsRoot)\share\themes\MS-Windows\**\*" />
|
||||||
@@ -97,9 +100,10 @@
|
|||||||
<Copy SourceFiles="@(GdkPixbufLoaderCache)" DestinationFiles="@(GdkPixbufLoaderCache->'$(ZoiteChatRel)\lib\gdk-pixbuf-2.0\%(RecursiveDir)%(Filename)%(Extension)')" />
|
<Copy SourceFiles="@(GdkPixbufLoaderCache)" DestinationFiles="@(GdkPixbufLoaderCache->'$(ZoiteChatRel)\lib\gdk-pixbuf-2.0\%(RecursiveDir)%(Filename)%(Extension)')" />
|
||||||
<Copy SourceFiles="@(GSettingsSchemas)" DestinationFiles="@(GSettingsSchemas->'$(ZoiteChatRel)\share\glib-2.0\schemas\%(Filename)%(Extension)')" />
|
<Copy SourceFiles="@(GSettingsSchemas)" DestinationFiles="@(GSettingsSchemas->'$(ZoiteChatRel)\share\glib-2.0\schemas\%(Filename)%(Extension)')" />
|
||||||
<Copy SourceFiles="@(Share)" DestinationFiles="@(Share->'$(ZoiteChatRel)\share\%(RecursiveDir)%(Filename)%(Extension)')" />
|
<Copy SourceFiles="@(Share)" DestinationFiles="@(Share->'$(ZoiteChatRel)\share\%(RecursiveDir)%(Filename)%(Extension)')" />
|
||||||
|
<Copy SourceFiles="@(Docs)" DestinationFiles="@(Docs->'$(ZoiteChatRel)\share\doc\zoitechat\html\%(RecursiveDir)%(Filename)%(Extension)')" />
|
||||||
<Copy SourceFiles="..\..\COPYING" DestinationFolder="$(ZoiteChatRel)\share\doc\zoitechat" />
|
<Copy SourceFiles="..\..\COPYING" DestinationFolder="$(ZoiteChatRel)\share\doc\zoitechat" />
|
||||||
<Copy SourceFiles="$(WinSparklePath)\COPYING" DestinationFolder="$(ZoiteChatRel)\share\doc\WinSparkle" />
|
<Copy SourceFiles="$(WinSparklePath)\COPYING" DestinationFolder="$(ZoiteChatRel)\share\doc\WinSparkle" />
|
||||||
<Copy SourceFiles="@(EnchantProviders)" DestinationFolder="$(ZoiteChatRel)\lib\enchant" />
|
<Copy SourceFiles="@(EnchantProviders)" DestinationFolder="$(ZoiteChatRel)\lib\enchant-2" />
|
||||||
<Copy SourceFiles="@(Locale)" DestinationFiles="@(Locale->'$(ZoiteChatRel)\share\locale\%(RecursiveDir)%(Filename)%(Extension)')" />
|
<Copy SourceFiles="@(Locale)" DestinationFiles="@(Locale->'$(ZoiteChatRel)\share\locale\%(RecursiveDir)%(Filename)%(Extension)')" />
|
||||||
<Copy SourceFiles="@(MSWindowsTheme)" DestinationFiles="@(MSWindowsTheme->'$(ZoiteChatRel)\share\themes\MS-Windows\%(RecursiveDir)%(Filename)%(Extension)')" />
|
<Copy SourceFiles="@(MSWindowsTheme)" DestinationFiles="@(MSWindowsTheme->'$(ZoiteChatRel)\share\themes\MS-Windows\%(RecursiveDir)%(Filename)%(Extension)')" />
|
||||||
<Copy SourceFiles="@(HicolorIcons)" DestinationFiles="@(HicolorIcons->'$(ZoiteChatRel)\share\icons\hicolor\%(RecursiveDir)%(Filename)%(Extension)')" />
|
<Copy SourceFiles="@(HicolorIcons)" DestinationFiles="@(HicolorIcons->'$(ZoiteChatRel)\share\icons\hicolor\%(RecursiveDir)%(Filename)%(Extension)')" />
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ Name: "icons"; Description: "Create Shortcuts"; Types: custom; Flags: disablenou
|
|||||||
Name: "icons\desktopicon"; Description: "Create Desktop Shortcut"; Types: custom; Flags: disablenouninstallwarning
|
Name: "icons\desktopicon"; Description: "Create Desktop Shortcut"; Types: custom; Flags: disablenouninstallwarning
|
||||||
Name: "icons\quicklaunchicon"; Description: "Create Quick Launch Shortcut"; Types: custom; Flags: disablenouninstallwarning
|
Name: "icons\quicklaunchicon"; Description: "Create Quick Launch Shortcut"; Types: custom; Flags: disablenouninstallwarning
|
||||||
Name: "translations"; Description: "Translations"; Types: normal custom; Flags: disablenouninstallwarning
|
Name: "translations"; Description: "Translations"; Types: normal custom; Flags: disablenouninstallwarning
|
||||||
Name: "spell"; Description: "Spelling Dictionaries"; Types: custom; Flags: disablenouninstallwarning
|
Name: "spell"; Description: "Spelling Dictionaries (Windows 7 fallback)"; Types: custom; Flags: disablenouninstallwarning
|
||||||
Name: "plugins"; Description: "Plugins"; Types: custom; Flags: disablenouninstallwarning
|
Name: "plugins"; Description: "Plugins"; Types: custom; Flags: disablenouninstallwarning
|
||||||
Name: "plugins\checksum"; Description: "Checksum"; Types: custom; Flags: disablenouninstallwarning
|
Name: "plugins\checksum"; Description: "Checksum"; Types: custom; Flags: disablenouninstallwarning
|
||||||
Name: "plugins\exec"; Description: "Exec"; Types: custom; Flags: disablenouninstallwarning
|
Name: "plugins\exec"; Description: "Exec"; Types: custom; Flags: disablenouninstallwarning
|
||||||
@@ -150,7 +150,7 @@ Source: "tiff.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: libs
|
|||||||
|
|
||||||
Source: "plugins\hcnotifications-winrt.dll"; DestDir: "{app}\plugins"; Flags: ignoreversion; Components: libs
|
Source: "plugins\hcnotifications-winrt.dll"; DestDir: "{app}\plugins"; Flags: ignoreversion; Components: libs
|
||||||
|
|
||||||
Source: "lib\enchant\*"; DestDir: "{app}\lib\enchant"; Flags: ignoreversion; Components: libs
|
Source: "lib\enchant-2\*"; DestDir: "{app}\lib\enchant-2"; Flags: ignoreversion; Components: libs
|
||||||
|
|
||||||
Source: "girepository-2.0-0.dll"; DestDir: "{app}"; Flags: ignoreversion skipifsourcedoesntexist; Components: langs\lua
|
Source: "girepository-2.0-0.dll"; DestDir: "{app}"; Flags: ignoreversion skipifsourcedoesntexist; Components: langs\lua
|
||||||
Source: "lua51.dll"; DestDir: "{app}"; Flags: ignoreversion skipifsourcedoesntexist; Components: langs\lua
|
Source: "lua51.dll"; DestDir: "{app}"; Flags: ignoreversion skipifsourcedoesntexist; Components: langs\lua
|
||||||
@@ -322,11 +322,12 @@ var
|
|||||||
begin
|
begin
|
||||||
GetWindowsVersionEx(Version);
|
GetWindowsVersionEx(Version);
|
||||||
|
|
||||||
// Windows 8 or greater has built in spell check.
|
// Enchant's WinSpell provider uses the built-in spell checker on Windows 8+.
|
||||||
if Version.NTPlatform and (Version.Major > 6) or ((Version.Major = 6) and (Version.Minor > 1)) then
|
// Downloaded dictionaries for other providers are retained only as a Windows 7 fallback.
|
||||||
|
if Version.NTPlatform and ((Version.Major > 6) or ((Version.Major = 6) and (Version.Minor > 1))) then
|
||||||
Result := True
|
Result := True
|
||||||
else
|
else
|
||||||
Result := DirExists(ExpandConstant('{localappdata}') + '\enchant\myspell');
|
Result := DirExists(ExpandConstant('{localappdata}') + '\enchant-2\myspell');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// Python >= 3.9 dropped support for Windows versions before 10;
|
// Python >= 3.9 dropped support for Windows versions before 10;
|
||||||
|
|||||||
@@ -61,7 +61,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "installer", "installer\inst
|
|||||||
ProjectSection(ProjectDependencies) = postProject
|
ProjectSection(ProjectDependencies) = postProject
|
||||||
{C2321A03-0BA7-45B3-8740-ABD82B36B0BF} = {C2321A03-0BA7-45B3-8740-ABD82B36B0BF}
|
{C2321A03-0BA7-45B3-8740-ABD82B36B0BF} = {C2321A03-0BA7-45B3-8740-ABD82B36B0BF}
|
||||||
{D58924D2-1492-4AC3-B058-7A214424EEDC} = {D58924D2-1492-4AC3-B058-7A214424EEDC}
|
{D58924D2-1492-4AC3-B058-7A214424EEDC} = {D58924D2-1492-4AC3-B058-7A214424EEDC}
|
||||||
{BF0EBC16-68AD-4CD1-864C-5B56836EBE2A} = {BF0EBC16-68AD-4CD1-864C-5B56836EBE2A}
|
|
||||||
{17E4BE39-76F7-4A06-AD21-EFD0C5091F76} = {17E4BE39-76F7-4A06-AD21-EFD0C5091F76}
|
{17E4BE39-76F7-4A06-AD21-EFD0C5091F76} = {17E4BE39-76F7-4A06-AD21-EFD0C5091F76}
|
||||||
{4C0F3940-2EEE-4646-82F7-6CE75B9A72F4} = {4C0F3940-2EEE-4646-82F7-6CE75B9A72F4}
|
{4C0F3940-2EEE-4646-82F7-6CE75B9A72F4} = {4C0F3940-2EEE-4646-82F7-6CE75B9A72F4}
|
||||||
{B10A2C41-344C-43E0-A32D-B9587C198D8B} = {B10A2C41-344C-43E0-A32D-B9587C198D8B}
|
{B10A2C41-344C-43E0-A32D-B9587C198D8B} = {B10A2C41-344C-43E0-A32D-B9587C198D8B}
|
||||||
@@ -95,11 +94,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "notifications-winrt", "..\s
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "external", "external", "{021EC1D0-FF67-4700-9AB2-EAABF1159C09}"
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "external", "external", "{021EC1D0-FF67-4700-9AB2-EAABF1159C09}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libenchant_win8", "..\src\libenchant_win8\libenchant_win8.vcxproj", "{BF0EBC16-68AD-4CD1-864C-5B56836EBE2A}"
|
|
||||||
ProjectSection(ProjectDependencies) = postProject
|
|
||||||
{87554B59-006C-4D94-9714-897B27067BA3} = {87554B59-006C-4D94-9714-897B27067BA3}
|
|
||||||
EndProjectSection
|
|
||||||
EndProject
|
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lua", "..\plugins\lua\lua.vcxproj", "{4C0F3940-2EEE-4646-82F7-6CE75B9A72F4}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lua", "..\plugins\lua\lua.vcxproj", "{4C0F3940-2EEE-4646-82F7-6CE75B9A72F4}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
@@ -137,8 +131,6 @@ Global
|
|||||||
{D58924D2-1492-4AC3-B058-7A214424EEDC}.Release|x64.Build.0 = Release|x64
|
{D58924D2-1492-4AC3-B058-7A214424EEDC}.Release|x64.Build.0 = Release|x64
|
||||||
{C53145CC-D021-40C9-B97C-0249AB9A43C9}.Release|x64.ActiveCfg = Release|x64
|
{C53145CC-D021-40C9-B97C-0249AB9A43C9}.Release|x64.ActiveCfg = Release|x64
|
||||||
{C53145CC-D021-40C9-B97C-0249AB9A43C9}.Release|x64.Build.0 = Release|x64
|
{C53145CC-D021-40C9-B97C-0249AB9A43C9}.Release|x64.Build.0 = Release|x64
|
||||||
{BF0EBC16-68AD-4CD1-864C-5B56836EBE2A}.Release|x64.ActiveCfg = Release|x64
|
|
||||||
{BF0EBC16-68AD-4CD1-864C-5B56836EBE2A}.Release|x64.Build.0 = Release|x64
|
|
||||||
{4C0F3940-2EEE-4646-82F7-6CE75B9A72F4}.Release|x64.ActiveCfg = Release|x64
|
{4C0F3940-2EEE-4646-82F7-6CE75B9A72F4}.Release|x64.ActiveCfg = Release|x64
|
||||||
{4C0F3940-2EEE-4646-82F7-6CE75B9A72F4}.Release|x64.Build.0 = Release|x64
|
{4C0F3940-2EEE-4646-82F7-6CE75B9A72F4}.Release|x64.Build.0 = Release|x64
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
@@ -161,7 +153,6 @@ Global
|
|||||||
{C2321A03-0BA7-45B3-8740-ABD82B36B0BF} = {D237DA6B-BD5F-46C0-8BEA-50E9A1340240}
|
{C2321A03-0BA7-45B3-8740-ABD82B36B0BF} = {D237DA6B-BD5F-46C0-8BEA-50E9A1340240}
|
||||||
{D58924D2-1492-4AC3-B058-7A214424EEDC} = {D237DA6B-BD5F-46C0-8BEA-50E9A1340240}
|
{D58924D2-1492-4AC3-B058-7A214424EEDC} = {D237DA6B-BD5F-46C0-8BEA-50E9A1340240}
|
||||||
{C53145CC-D021-40C9-B97C-0249AB9A43C9} = {561126F4-FA18-45FC-A2BF-8F858F161D6D}
|
{C53145CC-D021-40C9-B97C-0249AB9A43C9} = {561126F4-FA18-45FC-A2BF-8F858F161D6D}
|
||||||
{BF0EBC16-68AD-4CD1-864C-5B56836EBE2A} = {021EC1D0-FF67-4700-9AB2-EAABF1159C09}
|
|
||||||
{4C0F3940-2EEE-4646-82F7-6CE75B9A72F4} = {D237DA6B-BD5F-46C0-8BEA-50E9A1340240}
|
{4C0F3940-2EEE-4646-82F7-6CE75B9A72F4} = {D237DA6B-BD5F-46C0-8BEA-50E9A1340240}
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
EndGlobal
|
EndGlobal
|
||||||
|
|||||||
Reference in New Issue
Block a user