Skip to content

Commit

Permalink
Release 4.0.9 version
Browse files Browse the repository at this point in the history
  • Loading branch information
adonais committed Dec 7, 2023
1 parent e368c67 commit 323e505
Show file tree
Hide file tree
Showing 27 changed files with 408 additions and 304 deletions.
2 changes: 1 addition & 1 deletion conf/conf.d/snippets/cpp.snippets
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ ${1:#pragma mark -
$0
endsnippet

snippet main "main() (main)"
snippet main "main() (main)" b
int main(int argc, char *argv[]) {
$0
return 0;
Expand Down
4 changes: 4 additions & 0 deletions share/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
4.0.9 2023-12-07 adonais
* 变更: 文件管理器与标签栏平齐
* 修复: Win11下, 暗色主题渲染问题

4.0.8 2023-12-01 adonais
* 新增: 关于书签行的编辑菜单
* 新增: sumatrapdf解码文件到16进制的转换
Expand Down
166 changes: 106 additions & 60 deletions src/eu_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@
#define ascii_special_symbol(ch) \
((ch > 0x20 && ch < 0x30)||(ch > 0x39 && ch < 0x41)||(ch > 0x5a && ch < 0x7f))

typedef struct _skyver_data
{
int ver;
int status;
} skyver_data;

static void
on_config_setup_postion(const wchar_t **args, int arg_c, file_backup *pbak)
{
Expand Down Expand Up @@ -65,19 +71,16 @@ on_config_cvector_at(const file_backup *pbak, const TCHAR *pfile)
return -1;
}

static void
static bool
on_config_open_args(file_backup **pbak)
{
int arg_c = 0;
int arg_c = 0;
bool ret = false;
LPWSTR *args = CommandLineToArgvW(GetCommandLineW(), &arg_c);
if (args == NULL || pbak == NULL)
{
return;
}
if (arg_c >= 2)
if (pbak && args && arg_c >= 2)
{
cvector_vector_type(file_backup) vpath = NULL;
if (eu_config_parser_path(args, arg_c, &vpath))
if ((ret = eu_config_parser_path(args, arg_c, &vpath)))
{
for (size_t i = 0; i < cvector_size(vpath); ++i)
{
Expand All @@ -94,7 +97,11 @@ on_config_open_args(file_backup **pbak)
}
cvector_free(vpath);
}
LocalFree(args);
if (args)
{
LocalFree(args);
}
return ret;
}

static int
Expand Down Expand Up @@ -194,7 +201,10 @@ on_config_load_file(void *lp)
{
err = on_sql_do_session("SELECT * FROM skylar_ver;", NULL, NULL);
}
on_config_open_args(&vbak);
if (on_config_open_args(&vbak))
{
eu_logmsg("run with arguments\n");
}
if ((vec_size = cvector_size(vbak)) < 1)
{
file_backup bak = {0};
Expand Down Expand Up @@ -339,18 +349,89 @@ on_config_lua_execute(const wchar_t *file)
return path;
}

static int
on_config_edition(const char *str)
{
int v = 0;
if (str)
{
int i = 0;
const char *p = str;
for (i = 100, v = atoi(p) * 10000; i && (p = strchr(p, '.')) != NULL; i /= 100)
{
v += (atoi(++p) * i);
}
}
return v;
}

static int
on_config_skyver_callbak(void *data, int count, char **column, char **names)
{
UNREFERENCED_PARAMETER(data);
UNREFERENCED_PARAMETER(count);
UNREFERENCED_PARAMETER(names);
int status = atoi(column[0]);
if (data)
skyver_data *pd = (skyver_data *)data;
for (int i = 0; i < count; ++i)
{
if (STRCMP(names[i], ==, "szVersion"))
{
pd->ver = on_config_edition(column[i]);
}
else if (STRCMP(names[i], ==, "szExtra"))
{
pd->status = atoi(column[i]);
}
}
return 0;
}

static bool
on_config_create_cache(void)
{
bool ret = false;
TCHAR cache_path[MAX_BUFFER] = {0};
if (_sntprintf(cache_path, MAX_BUFFER, _T("%s\\cache"), eu_config_path) > 0)
{
if (!eu_exist_dir(cache_path))
{
ret = eu_mk_dir(cache_path);
}
else
{
ret = true;
}
}
return ret;
}

static bool
on_config_update_db(void)
{
if (eu_hwnd_self() == share_envent_get_hwnd())
{
*(int *)data = status;
skyver_data v = {0};
int err = on_sql_post("SELECT szVersion, szExtra FROM skylar_ver;", on_config_skyver_callbak, &v);
if (err != SKYLARK_SQL_END)
{
if (v.ver < 40009)
{
on_sql_post("UPDATE skylar_ver SET szVersion='4.0.9' WHERE szName='skylark.exe';", NULL, NULL);
on_sql_post("ALTER TABLE skylark_session ADD szView SMALLINT DEFAULT 0;", NULL, NULL);
}
if (v.status == VERSION_UPDATE_COMPLETED)
{
if (on_update_do())
{
on_update_sql();
eu_session_backup(SESSION_CONFIG);
return false;
}
else if (eu_get_config()->upgrade.flags != VERSION_LATEST)
{
on_update_sql();
}
}
}
}
return (int)(status == VERSION_UPDATE_COMPLETED);
return true;
}

void
Expand Down Expand Up @@ -433,7 +514,7 @@ eu_config_parser_path(const wchar_t **args, int arg_c, file_backup **pbak)
{
for (int i = 1; i < arg_c; ++i)
{
file_backup data = {-1, -1};
file_backup data = {-1, -1, 0 , -1};
if (wcsncmp(ptr_arg[i], L"-restart", 8) == 0)
{
i += 2;
Expand Down Expand Up @@ -490,10 +571,7 @@ eu_config_parser_path(const wchar_t **args, int arg_c, file_backup **pbak)
{
on_config_setup_postion(ptr_arg, arg_c, &data);
cvector_push_back(*pbak, data);
}
if (!ret)
{
ret = true;
ret |= 0x1;
}
}
}
Expand Down Expand Up @@ -550,25 +628,6 @@ eu_config_load_docs(void)
return ret;
}

static bool
on_config_create_cache(void)
{
bool ret = false;
TCHAR cache_path[MAX_BUFFER] = {0};
if (_sntprintf(cache_path, MAX_BUFFER, _T("%s\\cache"), eu_config_path) > 0)
{
if (!eu_exist_dir(cache_path))
{
ret = eu_mk_dir(cache_path);
}
else
{
ret = true;
}
}
return ret;
}

/**************************************************************************************
* 调用euapi导出函数之前, 应该先初始化euapi路径变量, 可以写入dllmain
* eu_module_path是主进程路径, eu_config_path是配置文件夹路径
Expand Down Expand Up @@ -645,25 +704,12 @@ eu_config_init_path(void)
bool
eu_config_load_files(void)
{
if (eu_hwnd_self() == share_envent_get_hwnd())
if (on_config_update_db())
{
int err = on_sql_post("SELECT szExtra FROM skylar_ver;", on_config_skyver_callbak, NULL);
if (err == SQLITE_ABORT)
{
if (on_update_do())
{
on_update_sql();
eu_session_backup(SESSION_CONFIG);
return false;
}
else if (eu_get_config()->upgrade.flags != VERSION_LATEST)
{
on_update_sql();
}
}
CloseHandle((HANDLE) _beginthreadex(NULL, 0, on_favorite_up_config, NULL, 0, NULL));
CloseHandle((HANDLE) _beginthreadex(NULL, 0, on_remote_load_config, NULL, 0, NULL));
CloseHandle((HANDLE) _beginthreadex(NULL, 0, on_config_load_file, NULL, 0, NULL));
return on_config_create_accel();
}
CloseHandle((HANDLE) _beginthreadex(NULL, 0, on_favorite_up_config, NULL, 0, NULL));
CloseHandle((HANDLE) _beginthreadex(NULL, 0, on_remote_load_config, NULL, 0, NULL));
CloseHandle((HANDLE) _beginthreadex(NULL, 0, on_config_load_file, NULL, 0, NULL));
return on_config_create_accel();
return false;
}
2 changes: 1 addition & 1 deletion src/eu_hex.c
Original file line number Diff line number Diff line change
Expand Up @@ -1482,7 +1482,7 @@ hexview_proc(HWND hwnd, uint32_t message, WPARAM wParam, LPARAM lParam)
}
if (GetFocus() != hwnd)
{ // 可能被plugin窗口强占了键盘焦点
eu_window_resize(NULL);
eu_window_resize();
}
break;
}
Expand Down
4 changes: 2 additions & 2 deletions src/eu_locale.c
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ eu_refresh_interface(HMODULE new_lang, const TCHAR *lang_path)
}
else
{
on_statusbar_size(NULL);
on_statusbar_size(NULL, NULL);
if (on_dark_enable())
{
SendMessage(g_statusbar, WM_THEMECHANGED, 0, 0);
Expand Down Expand Up @@ -459,7 +459,7 @@ i18n_switch_locale(HWND hwnd, int id)
on_tabpage_newdoc_reload();
i18n_update_multi_lang(menu_env);
i18n_update_menu(menu_env);
SendMessage(hwnd, WM_SIZE, 0, 0);
on_proc_redraw(NULL);
}
return 0;
}
6 changes: 1 addition & 5 deletions src/eu_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ _tmain(int argc, TCHAR *argv[])
eu_logmsg("eu_sci_register failed\n");
SKY_SAFE_EXIT(SKYLARK_SCI_FAILED);
}
if (!eu_win11_or_later() && strcmp(eu_get_config()->window_theme, "black") == 0)
if (eu_win10_or_later() && strcmp(eu_get_config()->window_theme, "black") == 0)
{
if (eu_dark_theme_init(true, true))
{
Expand Down Expand Up @@ -316,10 +316,6 @@ _tmain(int argc, TCHAR *argv[])
{
SendMessage(eu_module_hwnd(), WM_THEMECHANGED, DARK_THEME_APPLY, 0);
}
else if (eu_win11_or_later() && strcmp(eu_get_config()->window_theme, "black") == 0 && eu_dark_theme_init(true, true))
{
SendMessage(eu_module_hwnd(), WM_THEMECHANGED, DARK_THEME_APPLY, 0);
}
while (GetMessage(&msg, NULL, 0, 0) > 0)
{
if ((!eu_get_search_hwnd() || !IsDialogMessage(eu_get_search_hwnd(), &msg)) &&
Expand Down
Loading

0 comments on commit 323e505

Please sign in to comment.