mirror of
https://github.com/x-tools-author/x-tools.git
synced 2025-09-15 15:28:40 +08:00
chore: update the file
This commit is contained in:
parent
c57ad60275
commit
687ca5a271
114
CMakeLists.txt
114
CMakeLists.txt
@ -9,14 +9,73 @@ cmake_minimum_required(VERSION 3.22)
|
||||
project(xTools VERSION 8.0 LANGUAGES C CXX)
|
||||
# cmake-format: on
|
||||
|
||||
set(CMAKE_AUTOUIC ON)
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_AUTORCC ON)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
|
||||
# --------------------------------------------------------------------------------------------------
|
||||
# Some options for 3rd party libraries
|
||||
# cmake-format: off
|
||||
set(WITH_GFLAGS OFF)
|
||||
set(BUILD_TESTING OFF)
|
||||
set(BUILD_SHARED_LIBS OFF CACHE BOOL "Reset option" FORCE)
|
||||
set(WITH_TOOLS OFF CACHE BOOL "Reset option" FORCE)
|
||||
# cmake-format: on
|
||||
|
||||
# --------------------------------------------------------------------------------------------------
|
||||
# CMake module
|
||||
include(${CMAKE_SOURCE_DIR}/cmake/git.cmake)
|
||||
include(${CMAKE_SOURCE_DIR}/cmake/xtools.cmake)
|
||||
x_git_get_latest_tag(${CMAKE_CURRENT_SOURCE_DIR} "X")
|
||||
x_git_get_latest_commit(${CMAKE_CURRENT_SOURCE_DIR} "X")
|
||||
x_git_get_latest_commit_time(${CMAKE_CURRENT_SOURCE_DIR} "X")
|
||||
|
||||
# --------------------------------------------------------------------------------------------------
|
||||
# Target platform
|
||||
message(STATUS "------------------------------------------------------------")
|
||||
message(STATUS "[xTools]CMAKE_VERSION: ${CMAKE_VERSION}")
|
||||
message(STATUS "[xTools]CMAKE_GENERATOR: ${CMAKE_GENERATOR}")
|
||||
message(STATUS "[xTools]CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
|
||||
message(STATUS "[xTools]CMAKE_SYSTEM: ${CMAKE_SYSTEM}")
|
||||
message(STATUS "[xTools]CMAKE_SYSTEM_NAME: ${CMAKE_SYSTEM_NAME}")
|
||||
message(STATUS "[xTools]CMAKE_SYSTEM_PROCESSOR: ${CMAKE_SYSTEM_PROCESSOR}")
|
||||
message(STATUS "[xTools]CMAKE_HOST_SYSTEM: ${CMAKE_HOST_SYSTEM}")
|
||||
message(STATUS "[xTools]CMAKE_HOST_SYSTEM_NAME: ${CMAKE_HOST_SYSTEM_NAME}")
|
||||
message(STATUS "[xTools]CMAKE_HOST_SYSTEM_PROCESSOR: ${CMAKE_HOST_SYSTEM_PROCESSOR}")
|
||||
message(STATUS "[xTools]CMAKE_CXX_COMPILER_ID: ${CMAKE_CXX_COMPILER_ID}")
|
||||
message(STATUS "[xTools]CMAKE_CXX_COMPILER_VERSION: ${CMAKE_CXX_COMPILER_VERSION}")
|
||||
|
||||
set(X_ASSET_NAME "xTools-${CMAKE_SYSTEM_NAME}-${X_LATEST_GIT_TAG}-${CMAKE_SYSTEM_PROCESSOR}")
|
||||
if(QT_VERSION VERSION_LESS 6.0.0 AND WIN32)
|
||||
set(X_ASSET_NAME "${X_ASSET_NAME}-win7")
|
||||
endif()
|
||||
|
||||
string(TOLOWER ${X_ASSET_NAME} X_ASSET_NAME)
|
||||
message(STATUS "[xTools]Asset name: ${X_ASSET_NAME}")
|
||||
|
||||
set(libs_dir1 ${CMAKE_CURRENT_SOURCE_DIR}/libs)
|
||||
set(libs_dir2 ${CMAKE_SYSTEM_NAME}/${CMAKE_BUILD_TYPE}/${QT_VERSION}/${CMAKE_CXX_COMPILER_ID})
|
||||
set(X_DEPLOY_LIBS_DIR ${libs_dir1}/${libs_dir2})
|
||||
message(STATUS "[xTools]Deploy libraries directory: ${X_DEPLOY_LIBS_DIR}")
|
||||
message(STATUS "------------------------------------------------------------")
|
||||
set(X_BIN ${CMAKE_CURRENT_SOURCE_DIR}/bin/${CMAKE_SYSTEM_NAME}/${CMAKE_BUILD_TYPE})
|
||||
|
||||
# --------------------------------------------------------------------------------------------------
|
||||
# Qt or wxWidgets
|
||||
set(X_APP_FRAMEWORKS "Qt" "wxWidgets")
|
||||
set(X_APP_FRAMEWORK
|
||||
"Qt"
|
||||
CACHE STRING "Select a framework to build")
|
||||
set_property(CACHE X_APP_FRAMEWORK PROPERTY STRINGS ${X_APP_FRAMEWORKS})
|
||||
if(X_APP_FRAMEWORK STREQUAL "wxWidgets")
|
||||
include(${CMAKE_SOURCE_DIR}/wxapps/wxApps.cmake)
|
||||
return()
|
||||
endif()
|
||||
|
||||
set(CMAKE_AUTOUIC ON)
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_AUTORCC ON)
|
||||
|
||||
# --------------------------------------------------------------------------------------------------
|
||||
if(IOS)
|
||||
message(FATAL_ERROR "xTools does not support iOS platform yet...")
|
||||
@ -28,15 +87,6 @@ if(APPLE AND NOT IOS)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# --------------------------------------------------------------------------------------------------
|
||||
# Some options for 3rd party libraries
|
||||
# cmake-format: off
|
||||
set(WITH_GFLAGS OFF)
|
||||
set(BUILD_TESTING OFF)
|
||||
set(BUILD_SHARED_LIBS OFF CACHE BOOL "Reset option" FORCE)
|
||||
set(WITH_TOOLS OFF CACHE BOOL "Reset option" FORCE)
|
||||
# cmake-format: on
|
||||
|
||||
# --------------------------------------------------------------------------------------------------
|
||||
# Qt module
|
||||
list(APPEND X_QT_COMPONENTS Gui)
|
||||
@ -81,44 +131,6 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src)
|
||||
file(GLOB_RECURSE X_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/*.*")
|
||||
list(APPEND X_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/xTools.qrc)
|
||||
|
||||
# --------------------------------------------------------------------------------------------------
|
||||
# CMake module
|
||||
include(${CMAKE_SOURCE_DIR}/cmake/git.cmake)
|
||||
include(${CMAKE_SOURCE_DIR}/cmake/xtools.cmake)
|
||||
x_git_get_latest_tag(${CMAKE_CURRENT_SOURCE_DIR} "X")
|
||||
x_git_get_latest_commit(${CMAKE_CURRENT_SOURCE_DIR} "X")
|
||||
x_git_get_latest_commit_time(${CMAKE_CURRENT_SOURCE_DIR} "X")
|
||||
|
||||
# --------------------------------------------------------------------------------------------------
|
||||
# Target platform
|
||||
message(STATUS "------------------------------------------------------------")
|
||||
message(STATUS "[xTools]CMAKE_VERSION: ${CMAKE_VERSION}")
|
||||
message(STATUS "[xTools]CMAKE_GENERATOR: ${CMAKE_GENERATOR}")
|
||||
message(STATUS "[xTools]CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
|
||||
message(STATUS "[xTools]CMAKE_SYSTEM: ${CMAKE_SYSTEM}")
|
||||
message(STATUS "[xTools]CMAKE_SYSTEM_NAME: ${CMAKE_SYSTEM_NAME}")
|
||||
message(STATUS "[xTools]CMAKE_SYSTEM_PROCESSOR: ${CMAKE_SYSTEM_PROCESSOR}")
|
||||
message(STATUS "[xTools]CMAKE_HOST_SYSTEM: ${CMAKE_HOST_SYSTEM}")
|
||||
message(STATUS "[xTools]CMAKE_HOST_SYSTEM_NAME: ${CMAKE_HOST_SYSTEM_NAME}")
|
||||
message(STATUS "[xTools]CMAKE_HOST_SYSTEM_PROCESSOR: ${CMAKE_HOST_SYSTEM_PROCESSOR}")
|
||||
message(STATUS "[xTools]CMAKE_CXX_COMPILER_ID: ${CMAKE_CXX_COMPILER_ID}")
|
||||
message(STATUS "[xTools]CMAKE_CXX_COMPILER_VERSION: ${CMAKE_CXX_COMPILER_VERSION}")
|
||||
|
||||
set(X_ASSET_NAME "xTools-${CMAKE_SYSTEM_NAME}-${X_LATEST_GIT_TAG}-${CMAKE_SYSTEM_PROCESSOR}")
|
||||
if(QT_VERSION VERSION_LESS 6.0.0 AND WIN32)
|
||||
set(X_ASSET_NAME "${X_ASSET_NAME}-win7")
|
||||
endif()
|
||||
|
||||
string(TOLOWER ${X_ASSET_NAME} X_ASSET_NAME)
|
||||
message(STATUS "[xTools]Asset name: ${X_ASSET_NAME}")
|
||||
|
||||
set(libs_dir1 ${CMAKE_CURRENT_SOURCE_DIR}/libs)
|
||||
set(libs_dir2 ${CMAKE_SYSTEM_NAME}/${CMAKE_BUILD_TYPE}/${QT_VERSION}/${CMAKE_CXX_COMPILER_ID})
|
||||
set(X_DEPLOY_LIBS_DIR ${libs_dir1}/${libs_dir2})
|
||||
message(STATUS "[xTools]Deploy libraries directory: ${X_DEPLOY_LIBS_DIR}")
|
||||
message(STATUS "------------------------------------------------------------")
|
||||
set(X_BIN ${CMAKE_CURRENT_SOURCE_DIR}/bin/${CMAKE_SYSTEM_NAME}/${CMAKE_BUILD_TYPE})
|
||||
|
||||
# --------------------------------------------------------------------------------------------------
|
||||
# 3rd module
|
||||
include(${CMAKE_SOURCE_DIR}/cmake/glog.cmake)
|
||||
|
||||
@ -18,15 +18,5 @@ else()
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/3rd/${glog_package_name})
|
||||
set_property(TARGET glog PROPERTY FOLDER "3rd")
|
||||
set_property(TARGET glog_internal PROPERTY FOLDER "3rd")
|
||||
x_install_3rd_library(glog ${glog_package_name})
|
||||
endif()
|
||||
|
||||
# --------------------------------------------------------------------------------------------------
|
||||
# Install glog library to libs
|
||||
function(x_install_glog target)
|
||||
add_custom_target(
|
||||
glog_install
|
||||
COMMAND ${CMAKE_COMMAND} --install . --prefix ${glog_dst_dir}
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/3rd/${glog_package_name}
|
||||
SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/cmake/glog.cmake)
|
||||
set_property(TARGET glog_install PROPERTY FOLDER "3rd")
|
||||
endfunction()
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
# https://github.com/wxWidgets/wxWidgets/releases/download/v3.3.0/wxWidgets-3.3.0.7z
|
||||
# https://github.com/wxWidgets/wxWidgets/releases/download/v3.3.0/wxWidgets-3.3.0.zip
|
||||
set(package_version "3.3.0")
|
||||
set(package_base_url "https://github.com/wxWidgets/wxWidgets/releases/download")
|
||||
set(package_url "${package_base_url}/v${package_version}/wxWidgets-v${package_version}.7z")
|
||||
set(package_url "${package_base_url}/v${package_version}/wxWidgets-${package_version}.7z")
|
||||
set(package_name "wxWidgets-${package_version}")
|
||||
|
||||
# Download and extract wxWidgets
|
||||
|
||||
@ -231,3 +231,13 @@ function(x_setup_3rd_library zip_url package_name)
|
||||
endif()
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
# --------------------------------------------------------------------------------------------------
|
||||
# Install 3rd party libraries
|
||||
function(x_install_3rd_library target_name dir_name)
|
||||
add_custom_target(
|
||||
${target_name}-deploy
|
||||
COMMAND ${CMAKE_COMMAND} --install . --prefix ${X_DEPLOY_LIBS_DIR}/${dir_name}
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/3rd/${dir_name}
|
||||
COMMENT "Deploy 3rd libraries")
|
||||
endfunction()
|
||||
|
||||
128
wxapps/wx/wxa.cpp
Normal file
128
wxapps/wx/wxa.cpp
Normal file
@ -0,0 +1,128 @@
|
||||
/***************************************************************************************************
|
||||
* Copyright 2025-2025 x-tools-author(x-tools@outlook.com). All rights reserved.
|
||||
*
|
||||
* The file is encoded using "utf8 with bom", it is a part of xTools project.
|
||||
*
|
||||
* xTools is licensed according to the terms in the file LICENCE(GPL V3) in the root of the source
|
||||
* code directory.
|
||||
**************************************************************************************************/
|
||||
#include "wxa.h"
|
||||
|
||||
#include <chrono>
|
||||
|
||||
#include <wx/filename.h>
|
||||
#include <wx/stdpaths.h>
|
||||
#include <wx/utils.h>
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#include <dwmapi.h>
|
||||
#include <winuser.h>
|
||||
#include <wx/msw/private.h>
|
||||
#endif
|
||||
|
||||
wxString GetSettingsPath()
|
||||
{
|
||||
#if defined(X_PORTABLE_EDITION) && defined(WIN32)
|
||||
wxString path = wxGetCwd() + wxFileName::GetPathSeparator() + wxString("conf");
|
||||
#else
|
||||
wxString path = wxStandardPaths::Get().GetUserDataDir();
|
||||
#endif
|
||||
// Make full dir...
|
||||
if (!wxDirExists(path)) {
|
||||
#if defined(WIN32)
|
||||
wxMkDir(path);
|
||||
#else
|
||||
wxMkDir(path, 777);
|
||||
#endif
|
||||
}
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
wxString GetSettingsFileName()
|
||||
{
|
||||
return GetSettingsPath() + wxFileName::GetPathSeparator() + _("wxTools.json");
|
||||
}
|
||||
|
||||
void FailureWriter(const char *data, size_t size)
|
||||
{
|
||||
// Remove the settings file
|
||||
wxString settingsFile = GetSettingsFileName();
|
||||
if (wxFileExists(settingsFile)) {
|
||||
wxRemoveFile(settingsFile);
|
||||
}
|
||||
}
|
||||
|
||||
std::string LogPath()
|
||||
{
|
||||
wxString path = GetSettingsPath();
|
||||
path += wxFileName::GetPathSeparator();
|
||||
path += wxString("log");
|
||||
|
||||
#if defined(WIN32)
|
||||
wxMkDir(path);
|
||||
#else
|
||||
wxMkDir(path, 777);
|
||||
#endif
|
||||
|
||||
return path.ToStdString();
|
||||
}
|
||||
|
||||
void DoInitLogging(const char *argv0)
|
||||
{
|
||||
const std::chrono::minutes keep{7 * 24 * 60};
|
||||
|
||||
google::SetLogFilenameExtension(".log");
|
||||
google::EnableLogCleaner(keep);
|
||||
google::InstallFailureSignalHandler();
|
||||
google::InstallFailureWriter(FailureWriter);
|
||||
|
||||
fLB::FLAGS_logtostdout = false;
|
||||
fLB::FLAGS_logtostderr = false;
|
||||
fLS::FLAGS_log_dir = LogPath();
|
||||
fLI::FLAGS_logbufsecs = 0;
|
||||
fLU::FLAGS_max_log_size = 10;
|
||||
fLB::FLAGS_stop_logging_if_full_disk = true;
|
||||
fLB::FLAGS_colorlogtostderr = true;
|
||||
#if 0
|
||||
fLB::FLAGS_alsologtostderr = true;
|
||||
#endif
|
||||
google::InitGoogleLogging(argv0);
|
||||
}
|
||||
|
||||
void DoShutdownLogging()
|
||||
{
|
||||
google::ShutdownGoogleLogging();
|
||||
}
|
||||
|
||||
const int xNewWxId()
|
||||
{
|
||||
static int wxtId = wxID_HIGHEST + 10000;
|
||||
return wxtId++;
|
||||
}
|
||||
|
||||
bool wxA::OnInit()
|
||||
{
|
||||
#if wxCHECK_VERSION(3, 3, 0)
|
||||
SetAppearance(Appearance::Dark);
|
||||
#endif
|
||||
|
||||
wxString i18nDir = wxGetCwd();
|
||||
i18nDir += wxFileName::GetPathSeparator();
|
||||
i18nDir += wxString("i18n");
|
||||
|
||||
m_locale.AddCatalogLookupPathPrefix(i18nDir);
|
||||
m_locale.Init(wxLANGUAGE_DEFAULT, wxLOCALE_LOAD_DEFAULT);
|
||||
m_locale.AddCatalog(wxString("wxTools"));
|
||||
m_locale.AddCatalog(wxString("wxWidgets"));
|
||||
xInfo() << "Application booting...";
|
||||
xInfo() << "--------------------------------------------------------------------------------";
|
||||
xInfo() << "Settings file is:" << GetSettingsFileName();
|
||||
return true;
|
||||
}
|
||||
|
||||
wxA::~wxA() {}
|
||||
|
||||
void wxA::installLog() {}
|
||||
|
||||
void wxA::uninstallLog() {}
|
||||
36
wxapps/wx/wxa.h
Normal file
36
wxapps/wx/wxa.h
Normal file
@ -0,0 +1,36 @@
|
||||
/***************************************************************************************************
|
||||
* Copyright 2025-2025 x-tools-author(x-tools@outlook.com). All rights reserved.
|
||||
*
|
||||
* The file is encoded using "utf8 with bom", it is a part of xTools project.
|
||||
*
|
||||
* xTools is licensed according to the terms in the file LICENCE(GPL V3) in the root of the source
|
||||
* code directory.
|
||||
**************************************************************************************************/
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <glog/logging.h>
|
||||
#include <wx/wx.h>
|
||||
|
||||
#define xLog(severity) LOG(severity)
|
||||
#define xInfo() LOG(INFO)
|
||||
#define xWarning() LOG(WARNING)
|
||||
#define xError() LOG(ERROR)
|
||||
std::string LogPath();
|
||||
void DoInitLogging(const char *argv0);
|
||||
void DoShutdownLogging();
|
||||
const int xNewWxId();
|
||||
|
||||
class wxA : public wxApp
|
||||
{
|
||||
public:
|
||||
bool OnInit() override;
|
||||
~wxA() override;
|
||||
|
||||
void installLog();
|
||||
void uninstallLog();
|
||||
|
||||
private:
|
||||
wxLocale m_locale;
|
||||
};
|
||||
198
wxapps/wx/wxf.cpp
Normal file
198
wxapps/wx/wxf.cpp
Normal file
@ -0,0 +1,198 @@
|
||||
/***************************************************************************************************
|
||||
* Copyright 2025-2025 x-tools-author(x-tools@outlook.com). All rights reserved.
|
||||
*
|
||||
* The file is encoded using "utf8 with bom", it is a part of xTools project.
|
||||
*
|
||||
* xTools is licensed according to the terms in the file LICENCE(GPL V3) in the root of the source
|
||||
* code directory.
|
||||
**************************************************************************************************/
|
||||
#include "wxf.h"
|
||||
#include "wxa.h"
|
||||
|
||||
#include <fstream>
|
||||
#include <wx/artprov.h>
|
||||
#include <wx/fileconf.h>
|
||||
#include <wx/filename.h>
|
||||
#include <wx/stdpaths.h>
|
||||
|
||||
wxF::wxF()
|
||||
: wxFrame(nullptr, wxID_ANY, "wxTools")
|
||||
, xID_AboutApp(xNewWxId())
|
||||
, xID_OnLine(xNewWxId())
|
||||
, xID_Gitee(xNewWxId())
|
||||
, xID_Github(xNewWxId())
|
||||
, xID_Author(xNewWxId())
|
||||
, xID_AppStore(xNewWxId())
|
||||
{
|
||||
#if !defined(W_RELEASE)
|
||||
#if 0
|
||||
[Ubuntu]
|
||||
I20250219 13:13:10.775637 139801817956736 MainWindow.cpp:29] GetExecutablePath():/home/user/Project/wx-tools/build/Desktop_Qt_6_8_2-Debug/assets/wxTools/wxTools
|
||||
I20250219 13:13:10.775692 139801817956736 MainWindow.cpp:30] GetConfigDir():/etc
|
||||
I20250219 13:13:10.775699 139801817956736 MainWindow.cpp:31] GetUserConfigDir():/home/user
|
||||
I20250219 13:13:10.775705 139801817956736 MainWindow.cpp:32] GetDataDir():/usr/local/share/wxTools
|
||||
I20250219 13:13:10.775712 139801817956736 MainWindow.cpp:33] GetUserDataDir():/home/user/.wxTools
|
||||
I20250219 13:13:10.775716 139801817956736 MainWindow.cpp:34] GetUserLocalDataDir():/home/user/.wxTools
|
||||
I20250219 13:13:10.775719 139801817956736 MainWindow.cpp:35] GetPluginsDir():/usr/local/lib/wxTools
|
||||
I20250219 13:13:10.775722 139801817956736 MainWindow.cpp:36] MakeConfigFileName():wxTools.conf
|
||||
I20250219 13:13:10.775734 139801817956736 MainWindow.cpp:37] GetGlobalFileName()/etc/wxTools.conf
|
||||
I20250219 13:13:10.775746 139801817956736 MainWindow.cpp:38] GetLocalFileName()/home/user/.wxTools
|
||||
I20250219 13:13:10.775746 139801817956736 MainWindow.cpp:38] wxGetCwd():/home/user/Project/wx-tools/build/Desktop_Qt_6_8_2-Debug/assets/wxTools
|
||||
#endif
|
||||
xInfo() << "GetExecutablePath():" << wxStandardPaths::Get().GetExecutablePath();
|
||||
xInfo() << "GetConfigDir():" << wxStandardPaths::Get().GetConfigDir();
|
||||
xInfo() << "GetUserConfigDir():" << wxStandardPaths::Get().GetUserConfigDir();
|
||||
xInfo() << "GetDataDir():" << wxStandardPaths::Get().GetDataDir();
|
||||
xInfo() << "GetUserDataDir():" << wxStandardPaths::Get().GetUserDataDir();
|
||||
xInfo() << "GetUserLocalDataDir():" << wxStandardPaths::Get().GetUserLocalDataDir();
|
||||
xInfo() << "GetPluginsDir():" << wxStandardPaths::Get().GetPluginsDir();
|
||||
xInfo() << "MakeConfigFileName():" << wxStandardPaths::Get().MakeConfigFileName("wxTools");
|
||||
xInfo() << "GetGlobalFileName():" << wxFileConfig::GetGlobalFileName("wxTools");
|
||||
xInfo() << "GetLocalFileName():" << wxFileConfig::GetLocalFileName("wxTools");
|
||||
xInfo() << "wxGetCwd():" << wxGetCwd();
|
||||
#endif
|
||||
|
||||
DoInit();
|
||||
}
|
||||
|
||||
wxF::~wxF() {}
|
||||
|
||||
void wxF::moveTolCenter()
|
||||
{
|
||||
wxSize size = GetSize();
|
||||
wxSize screenSize = wxGetDisplaySize();
|
||||
|
||||
int x = (screenSize.x - size.x) / 2;
|
||||
int y = (screenSize.y - size.y) / 2;
|
||||
|
||||
SetPosition(wxPoint(x, y));
|
||||
}
|
||||
|
||||
void wxF::DoInit()
|
||||
{
|
||||
DoInitMenuBar();
|
||||
}
|
||||
|
||||
void wxF::DoInitMenuBar()
|
||||
{
|
||||
m_menuBar = new wxMenuBar();
|
||||
SetMenuBar(m_menuBar);
|
||||
|
||||
DoInitMenuBarFile();
|
||||
DoInitMenuBarOption();
|
||||
DoInitMenuBarView();
|
||||
DoInitMenuBarHelp();
|
||||
}
|
||||
|
||||
void wxF::DoInitMenuBarFile()
|
||||
{
|
||||
m_fileMenu = new wxMenu();
|
||||
m_menuBar->Append(m_fileMenu, _("&File"));
|
||||
wxMenuItem* item = m_fileMenu->Append(wxID_EXIT, _("E&xit"));
|
||||
|
||||
Bind(wxEVT_MENU, [=](wxCommandEvent& event) {
|
||||
if (event.GetId() == wxID_EXIT) {
|
||||
Close(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void wxF::DoInitMenuBarOption()
|
||||
{
|
||||
m_optionMenu = new wxMenu();
|
||||
m_menuBar->Append(m_optionMenu, _("&Options"));
|
||||
|
||||
m_optionMenu->Append(xID_SettingsDir, _("&Settings Directory"));
|
||||
m_optionMenu->Append(xID_ClearSettings, _("&Clear Settings"));
|
||||
m_optionMenu->AppendSeparator();
|
||||
m_optionMenu->Append(xID_OnTop, _("&Always on Top"));
|
||||
|
||||
Bind(wxEVT_MENU, [=](wxCommandEvent& event) { OnOptionItemEvent(event); });
|
||||
}
|
||||
|
||||
void wxF::DoInitMenuBarView()
|
||||
{
|
||||
m_viewMenu = new wxMenu();
|
||||
m_menuBar->Append(m_viewMenu, _("&View"));
|
||||
|
||||
m_viewMenu->Append(xID_Language, _("&Languages"));
|
||||
m_viewMenu->AppendSeparator();
|
||||
m_viewMenu->Append(xID_Hdpi, _("&HDPI Settings"));
|
||||
m_viewMenu->Append(xID_Theme, _("&Theme Settings"));
|
||||
|
||||
Bind(wxEVT_MENU, [=](wxCommandEvent& event) { OnViewItemEvent(event); });
|
||||
}
|
||||
|
||||
void wxF::DoInitMenuBarHelp()
|
||||
{
|
||||
m_helpMenu = new wxMenu();
|
||||
m_menuBar->Append(m_helpMenu, _("&Help"));
|
||||
|
||||
m_helpMenu->Append(wxID_ABOUT, _("&About wxWidgets"));
|
||||
m_helpMenu->Append(xID_AboutApp, _("&About xCrc"));
|
||||
m_helpMenu->AppendSeparator();
|
||||
m_helpMenu->Append(xID_Gitee, _("Get Source from Gitee"));
|
||||
m_helpMenu->Append(xID_Github, _("Get Source from Github"));
|
||||
m_helpMenu->Append(xID_OnLine, _("&Online Documents"));
|
||||
m_helpMenu->AppendSeparator();
|
||||
m_helpMenu->Append(xID_AppStore, _("&App Store"));
|
||||
m_helpMenu->Append(xID_Author, _("&Visit Author Home Page"));
|
||||
|
||||
Bind(wxEVT_MENU, [=](wxCommandEvent& event) { OnHelpItemEvent(event); });
|
||||
}
|
||||
|
||||
void wxF::OnViewItemEvent(wxCommandEvent& event)
|
||||
{
|
||||
if (event.GetId() == xID_Hdpi) {
|
||||
// Handle HDPI option
|
||||
} else if (event.GetId() == xID_Theme) {
|
||||
// Handle Theme option
|
||||
} else if (event.GetId() == xID_OnTop) {
|
||||
// Handle On Top option
|
||||
}
|
||||
}
|
||||
|
||||
void wxF::OnOptionItemEvent(wxCommandEvent& event)
|
||||
{
|
||||
if (event.GetId() == xID_Language) {
|
||||
// Handle Language Settings
|
||||
} else if (event.GetId() == xID_SettingsDir) {
|
||||
wxString settingsDir = wxStandardPaths::Get().GetUserConfigDir();
|
||||
wxMessageBox(_("Settings Directory: ") + settingsDir,
|
||||
_("Settings Directory"),
|
||||
wxOK | wxICON_INFORMATION,
|
||||
this);
|
||||
} else if (event.GetId() == xID_ClearSettings) {
|
||||
// Handle Clear Settings
|
||||
wxMessageBox(_("Clear Settings functionality is not implemented yet."),
|
||||
_("Clear Settings"),
|
||||
wxOK | wxICON_INFORMATION,
|
||||
this);
|
||||
}
|
||||
}
|
||||
|
||||
void wxF::OnHelpItemEvent(wxCommandEvent& event)
|
||||
{
|
||||
if (event.GetId() == wxID_ABOUT) {
|
||||
wxMessageBox(_("This is a wxWidgets application."),
|
||||
_("About wxTools"),
|
||||
wxOK | wxICON_INFORMATION,
|
||||
this);
|
||||
}
|
||||
if (event.GetId() == xID_AboutApp) {
|
||||
wxMessageBox(_("This is a wxWidgets application."),
|
||||
_("About wxTools"),
|
||||
wxOK | wxICON_INFORMATION,
|
||||
this);
|
||||
} else if (event.GetId() == xID_Gitee) {
|
||||
wxLaunchDefaultBrowser("https://gitee.com/x-tools/x-tools");
|
||||
} else if (event.GetId() == xID_Github) {
|
||||
wxLaunchDefaultBrowser("https://github.com/x-tools/x-tools");
|
||||
} else if (event.GetId() == xID_OnLine) {
|
||||
wxLaunchDefaultBrowser("https://x-tools.github.io/x-tools/");
|
||||
} else if (event.GetId() == xID_Author) {
|
||||
wxLaunchDefaultBrowser("https://x-tools.github.io/");
|
||||
} else if (event.GetId() == xID_AppStore) {
|
||||
wxLaunchDefaultBrowser("https://apps.apple.com/app/id6443700000");
|
||||
}
|
||||
}
|
||||
57
wxapps/wx/wxf.h
Normal file
57
wxapps/wx/wxf.h
Normal file
@ -0,0 +1,57 @@
|
||||
/***************************************************************************************************
|
||||
* Copyright 2025-2025 x-tools-author(x-tools@outlook.com). All rights reserved.
|
||||
*
|
||||
* The file is encoded using "utf8 with bom", it is a part of xTools project.
|
||||
*
|
||||
* xTools is licensed according to the terms in the file LICENCE(GPL V3) in the root of the source
|
||||
* code directory.
|
||||
**************************************************************************************************/
|
||||
#pragma once
|
||||
|
||||
#include <wx/menu.h>
|
||||
#include <wx/wx.h>
|
||||
|
||||
class wxF : public wxFrame
|
||||
{
|
||||
public:
|
||||
wxF();
|
||||
~wxF() override;
|
||||
|
||||
void moveTolCenter();
|
||||
|
||||
protected:
|
||||
wxMenuBar* m_menuBar{nullptr};
|
||||
wxMenu* m_fileMenu{nullptr};
|
||||
wxMenu* m_optionMenu{nullptr};
|
||||
wxMenu* m_viewMenu{nullptr};
|
||||
wxMenu* m_helpMenu{nullptr};
|
||||
|
||||
private:
|
||||
// Option menu items
|
||||
int xID_SettingsDir{wxID_ANY};
|
||||
int xID_ClearSettings{wxID_ANY};
|
||||
int xID_OnTop{wxID_ANY};
|
||||
// View menu items
|
||||
int xID_Language{wxID_ANY};
|
||||
int xID_Hdpi{wxID_ANY};
|
||||
int xID_Theme{wxID_ANY};
|
||||
// Help menu items
|
||||
int xID_AboutApp{wxID_ANY};
|
||||
int xID_Gitee{wxID_ANY};
|
||||
int xID_Github{wxID_ANY};
|
||||
int xID_OnLine{wxID_ANY};
|
||||
int xID_Author{wxID_ANY};
|
||||
int xID_AppStore{wxID_ANY};
|
||||
|
||||
private:
|
||||
void DoInit();
|
||||
void DoInitMenuBar();
|
||||
void DoInitMenuBarFile();
|
||||
void DoInitMenuBarOption();
|
||||
void DoInitMenuBarView();
|
||||
void DoInitMenuBarHelp();
|
||||
|
||||
void OnOptionItemEvent(wxCommandEvent& event);
|
||||
void OnViewItemEvent(wxCommandEvent& event);
|
||||
void OnHelpItemEvent(wxCommandEvent& event);
|
||||
};
|
||||
109
wxapps/wxApps.cmake
Normal file
109
wxapps/wxApps.cmake
Normal file
@ -0,0 +1,109 @@
|
||||
# * https://github.com/wxWidgets/wxWidgets/releases/download/v3.3.0/wxWidgets-3.3.0.zip
|
||||
# * set(package_version "3.2.8.1")
|
||||
set(package_version "3.3.0")
|
||||
set(package_base_url "https://github.com/wxWidgets/wxWidgets/releases/download")
|
||||
set(package_url "${package_base_url}/v${package_version}/wxWidgets-${package_version}.zip")
|
||||
set(package_name "wxWidgets-${package_version}")
|
||||
|
||||
# --------------------------------------------------------------------------------------------------
|
||||
# cmake-format: off
|
||||
if(WIN32 AND MSVC)
|
||||
set(wxBUILD_SHARED OFF CACHE BOOL "Build wxWidgets as shared libraries" FORCE)
|
||||
set(wxBUILD_USE_STATIC_RUNTIME ON CACHE BOOL "Build static runtime" FORCE)
|
||||
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
|
||||
elseif(LINUX)
|
||||
set(wxBUILD_SHARED OFF CACHE BOOL "Build wxWidgets as shared libraries" FORCE)
|
||||
set(wxBUILD_USE_STATIC_RUNTIME ON CACHE BOOL "Build static runtime" FORCE)
|
||||
endif()
|
||||
# cmake-format: on
|
||||
|
||||
if(${CMAKE_BUILD_TYPE} STREQUAL "Debug")
|
||||
add_compile_definitions(X_DEBUG)
|
||||
else()
|
||||
add_compile_definitions(X_RELEASE)
|
||||
endif()
|
||||
|
||||
# --------------------------------------------------------------------------------------------------
|
||||
# 3rd modules
|
||||
include(${CMAKE_SOURCE_DIR}/cmake/glog.cmake)
|
||||
|
||||
# --------------------------------------------------------------------------------------------------
|
||||
# Download the package if it does not exist
|
||||
if(NOT EXISTS ${CMAKE_SOURCE_DIR}/3rd/${package_name}.zip)
|
||||
message(STATUS "Downloading ${package_name} from ${package_url}")
|
||||
file(
|
||||
DOWNLOAD ${package_url} ${CMAKE_SOURCE_DIR}/3rd/${package_name}.zip
|
||||
SHOW_PROGRESS
|
||||
STATUS status)
|
||||
if(NOT status EQUAL 0)
|
||||
message(FATAL_ERROR "Failed to download ${package_name} from ${package_url}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# --------------------------------------------------------------------------------------------------
|
||||
# Extract the package
|
||||
if(NOT EXISTS ${CMAKE_SOURCE_DIR}/3rd/${package_name})
|
||||
message(STATUS "Extracting ${package_name}")
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${package_name}
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/3rd)
|
||||
execute_process(
|
||||
COMMAND ${CMAKE_COMMAND} -E tar "xzf" ${CMAKE_SOURCE_DIR}/3rd/${package_name}.zip
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/3rd/${package_name}
|
||||
RESULT_VARIABLE result)
|
||||
if(result)
|
||||
message(FATAL_ERROR "Failed to extract ${package_name}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# --------------------------------------------------------------------------------------------------
|
||||
# Import wxWidgets
|
||||
set(wxWidget_LIBS ${X_DEPLOY_LIBS_DIR}/${package_name})
|
||||
message(STATUS "[wxWidgets] wxWidget_LIBS ${wxWidget_LIBS}")
|
||||
if(EXISTS ${wxWidget_LIBS})
|
||||
message(STATUS "Using pre-deployed wxWidgets from ${wxWidget_LIBS}")
|
||||
set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} ${wxWidget_LIBS})
|
||||
find_package(wxWidgets REQUIRED COMPONENTS core base aui)
|
||||
include(${wxWidgets_USE_FILE})
|
||||
else()
|
||||
add_subdirectory(${CMAKE_SOURCE_DIR}/3rd/${package_name})
|
||||
x_install_3rd_library(wxWidgets ${package_name})
|
||||
set(wxWidgets_LIBRARIES wx::core wx::aui)
|
||||
endif()
|
||||
|
||||
# --------------------------------------------------------------------------------------------------
|
||||
# wxApps
|
||||
file(GLOB_RECURSE wx_files "${CMAKE_CURRENT_LIST_DIR}/wx/*.*")
|
||||
set(X_APPS "xCrc")
|
||||
file(GLOB PRIVATE_APPS "${CMAKE_SOURCE_DIR}/wxapps/*")
|
||||
foreach(private_app ${PRIVATE_APPS})
|
||||
if(NOT IS_DIRECTORY ${private_app})
|
||||
continue()
|
||||
endif()
|
||||
|
||||
get_filename_component(app_name ${private_app} NAME)
|
||||
if(app_name STREQUAL "wx")
|
||||
continue()
|
||||
endif()
|
||||
|
||||
# * The second char of the app name should be uppercase
|
||||
# * if app_name == xcrc, the char2 is 'c', it will be converted to 'C'
|
||||
# * if app_name == xcrc, the rest_of_name is 'rc'
|
||||
# * if app_name == xcrc, the app_name will be 'xCrc'(x + C + rc)
|
||||
string(SUBSTRING ${app_name} 2 1 char3)
|
||||
string(TOUPPER ${char3} char3)
|
||||
string(SUBSTRING "${app_name}" 3 -1 rest_of_name)
|
||||
string(CONCAT app_name "wx${char3}${rest_of_name}")
|
||||
|
||||
# If X_APPS already contains the app_name, skip it
|
||||
if(NOT app_name IN_LIST X_APPS)
|
||||
list(APPEND X_APPS "${app_name}")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# cmake-format: off
|
||||
set(X_APP "xTools" CACHE STRING "Select a x-app to build")
|
||||
set_property(CACHE X_APP PROPERTY STRINGS ${X_APPS})
|
||||
string(TOLOWER ${X_APP} LOWER_X_APP)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/wxapps)
|
||||
include(${CMAKE_SOURCE_DIR}/wxapps/${LOWER_X_APP}/${X_APP}.cmake)
|
||||
# cmake-format: on
|
||||
11
wxapps/wxcrc/src/main.cpp
Normal file
11
wxapps/wxcrc/src/main.cpp
Normal file
@ -0,0 +1,11 @@
|
||||
/***************************************************************************************************
|
||||
* Copyright 2025-2025 x-tools-author(x-tools@outlook.com). All rights reserved.
|
||||
*
|
||||
* The file is encoded using "utf8 with bom", it is a part of xTools project.
|
||||
*
|
||||
* xTools is licensed according to the terms in the file LICENCE(GPL V3) in the root of the source
|
||||
* code directory.
|
||||
**************************************************************************************************/
|
||||
#include "wxcrcapp.h"
|
||||
|
||||
wxIMPLEMENT_APP(wxCrcApp);
|
||||
44
wxapps/wxcrc/src/wxcrcapp.cpp
Normal file
44
wxapps/wxcrc/src/wxcrcapp.cpp
Normal file
@ -0,0 +1,44 @@
|
||||
/***************************************************************************************************
|
||||
* Copyright 2025-2025 x-tools-author(x-tools@outlook.com). All rights reserved.
|
||||
*
|
||||
* The file is encoded using "utf8 with bom", it is a part of xTools project.
|
||||
*
|
||||
* xTools is licensed according to the terms in the file LICENCE(GPL V3) in the root of the source
|
||||
* code directory.
|
||||
**************************************************************************************************/
|
||||
#include "wxcrcapp.h"
|
||||
#include "wxcrcframe.h"
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#include <dwmapi.h>
|
||||
#include <winuser.h>
|
||||
#include <wx/msw/private.h>
|
||||
#endif
|
||||
|
||||
bool wxCrcApp::OnInit()
|
||||
{
|
||||
wxA::OnInit();
|
||||
|
||||
auto* ui = new wxCrcFrame();
|
||||
#if defined(WXT_MAGIC)
|
||||
ui->SetTransparent(50);
|
||||
#endif
|
||||
ui->Show(true);
|
||||
ui->moveTolCenter();
|
||||
ui->SetMinSize(ui->GetSize());
|
||||
ui->SetMaxSize(ui->GetSize());
|
||||
|
||||
#if 1
|
||||
wxColour color = GetTopWindow()->GetBackgroundColour();
|
||||
COLORREF colorref = RGB(color.Red(), color.Green(), color.Blue());
|
||||
auto hwnd = GetTopWindow() ? GetTopWindow()->GetHWND() : nullptr;
|
||||
DwmSetWindowAttribute(hwnd, DWMWA_CAPTION_COLOR, &colorref, sizeof(colorref));
|
||||
#endif
|
||||
|
||||
// Hide minimize and maximize buttons
|
||||
ui->SetWindowStyle(ui->GetWindowStyle() & ~(wxMAXIMIZE_BOX | wxMINIMIZE_BOX));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
wxCrcApp::~wxCrcApp() {}
|
||||
18
wxapps/wxcrc/src/wxcrcapp.h
Normal file
18
wxapps/wxcrc/src/wxcrcapp.h
Normal file
@ -0,0 +1,18 @@
|
||||
/***************************************************************************************************
|
||||
* Copyright 2025-2025 x-tools-author(x-tools@outlook.com). All rights reserved.
|
||||
*
|
||||
* The file is encoded using "utf8 with bom", it is a part of xTools project.
|
||||
*
|
||||
* xTools is licensed according to the terms in the file LICENCE(GPL V3) in the root of the source
|
||||
* code directory.
|
||||
**************************************************************************************************/
|
||||
#pragma once
|
||||
|
||||
#include "wx/wxa.h"
|
||||
|
||||
class wxCrcApp : public wxA
|
||||
{
|
||||
public:
|
||||
bool OnInit() override;
|
||||
~wxCrcApp() override;
|
||||
};
|
||||
60
wxapps/wxcrc/src/wxcrcframe.cpp
Normal file
60
wxapps/wxcrc/src/wxcrcframe.cpp
Normal file
@ -0,0 +1,60 @@
|
||||
/***************************************************************************************************
|
||||
* Copyright 2025-2025 x-tools-author(x-tools@outlook.com). All rights reserved.
|
||||
*
|
||||
* The file is encoded using "utf8 with bom", it is a part of xTools project.
|
||||
*
|
||||
* xTools is licensed according to the terms in the file LICENCE(GPL V3) in the root of the source
|
||||
* code directory.
|
||||
**************************************************************************************************/
|
||||
#include "wxcrcframe.h"
|
||||
|
||||
#include <wx/gbsizer.h>
|
||||
#include <wx/icon.h>
|
||||
#include <wx/stattext.h>
|
||||
|
||||
wxCrcFrame::wxCrcFrame()
|
||||
: wxF()
|
||||
{
|
||||
wxIcon icon;
|
||||
icon.LoadFile("IDI_ICON1", wxBITMAP_TYPE_ICO_RESOURCE);
|
||||
SetIcon(icon);
|
||||
SetTitle(_("wxCRC - CRC Calculator"));
|
||||
|
||||
wxGridBagSizer* leftSizer = new wxGridBagSizer(4, 4);
|
||||
wxStaticText* label = new wxStaticText(this, wxID_ANY, _("Input Format"));
|
||||
wxComboBox* inputFormatCombo = new wxComboBox(this, wxID_ANY);
|
||||
inputFormatCombo->Append(_("Hexadecimal"));
|
||||
inputFormatCombo->Append(_("ASCII"));
|
||||
leftSizer->Add(label, wxGBPosition(0, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL | wxALL, 0);
|
||||
leftSizer->Add(inputFormatCombo, wxGBPosition(1, 0), wxGBSpan(1, 1), wxEXPAND | wxALL, 0);
|
||||
|
||||
label = new wxStaticText(this, wxID_ANY, _("CRC Algorithm"));
|
||||
m_ui.algorithm = new wxComboBox(this, wxID_ANY);
|
||||
leftSizer->Add(label, wxGBPosition(2, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL | wxALL, 0);
|
||||
leftSizer->Add(m_ui.algorithm, wxGBPosition(3, 0), wxGBSpan(1, 1), wxEXPAND | wxALL, 0);
|
||||
|
||||
label = new wxStaticText(this, wxID_ANY, _("CRC Result"));
|
||||
m_ui.result = new wxTextCtrl(this, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxTE_READONLY);
|
||||
leftSizer->Add(label, wxGBPosition(4, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL | wxALL, 0);
|
||||
leftSizer->Add(m_ui.result, wxGBPosition(5, 0), wxGBSpan(1, 1), wxEXPAND | wxALL, 0);
|
||||
|
||||
m_ui.upper = new wxCheckBox(this, wxID_ANY, _("Upper Case Result"));
|
||||
m_ui.calculate = new wxButton(this, wxID_ANY, _("Calculate"));
|
||||
leftSizer->Add(m_ui.upper, wxGBPosition(6, 0), wxGBSpan(1, 1), wxEXPAND | wxALL, 0);
|
||||
leftSizer->Add(m_ui.calculate, wxGBPosition(7, 0), wxGBSpan(1, 1), wxEXPAND | wxALL, 0);
|
||||
|
||||
wxGridBagSizer* sizer = new wxGridBagSizer(4, 4);
|
||||
sizer->Add(leftSizer, wxGBPosition(0, 0), wxGBSpan(2, 1), wxEXPAND | wxALL, 4);
|
||||
|
||||
label = new wxStaticText(this, wxID_ANY, _("CRC Data"));
|
||||
m_ui.data = new wxTextCtrl(this, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE);
|
||||
m_ui.data->SetMinSize(wxSize(360, 128));
|
||||
sizer->Add(label, wxGBPosition(0, 1), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL | wxALL, 4);
|
||||
sizer->Add(m_ui.data, wxGBPosition(1, 1), wxGBSpan(1, 1), wxEXPAND | wxALL, 4);
|
||||
|
||||
SetSizerAndFit(sizer);
|
||||
leftSizer->AddGrowableCol(1, 1);
|
||||
sizer->AddGrowableCol(1, 1);
|
||||
}
|
||||
|
||||
wxCrcFrame::~wxCrcFrame() {}
|
||||
34
wxapps/wxcrc/src/wxcrcframe.h
Normal file
34
wxapps/wxcrc/src/wxcrcframe.h
Normal file
@ -0,0 +1,34 @@
|
||||
/***************************************************************************************************
|
||||
* Copyright 2025-2025 x-tools-author(x-tools@outlook.com). All rights reserved.
|
||||
*
|
||||
* The file is encoded using "utf8 with bom", it is a part of xTools project.
|
||||
*
|
||||
* xTools is licensed according to the terms in the file LICENCE(GPL V3) in the root of the source
|
||||
* code directory.
|
||||
**************************************************************************************************/
|
||||
#pragma once
|
||||
|
||||
#include <wx/button.h>
|
||||
#include <wx/checkbox.h>
|
||||
#include <wx/combobox.h>
|
||||
#include <wx/textctrl.h>
|
||||
|
||||
#include "wx/wxf.h"
|
||||
|
||||
class wxCrcFrame : public wxF
|
||||
{
|
||||
public:
|
||||
wxCrcFrame();
|
||||
~wxCrcFrame() override;
|
||||
|
||||
private:
|
||||
struct UiCtx
|
||||
{
|
||||
wxComboBox* dataFormat;
|
||||
wxComboBox* algorithm;
|
||||
wxTextCtrl* data;
|
||||
wxTextCtrl* result;
|
||||
wxCheckBox* upper;
|
||||
wxButton* calculate;
|
||||
} m_ui;
|
||||
};
|
||||
12
wxapps/wxcrc/wxCrc.cmake
Normal file
12
wxapps/wxcrc/wxCrc.cmake
Normal file
@ -0,0 +1,12 @@
|
||||
file(GLOB_RECURSE wx_src "${CMAKE_CURRENT_LIST_DIR}/src/*.*")
|
||||
list(APPEND wx_src "${CMAKE_CURRENT_LIST_DIR}/wxCrc.rc")
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${X_BIN}/wxCrc)
|
||||
add_executable(wxCrc ${wx_src} ${wx_files})
|
||||
target_link_libraries(wxCrc PRIVATE ${wxWidgets_LIBRARIES} glog::glog)
|
||||
set_target_properties(wxCrc PROPERTIES MACOSX_BUNDLE TRUE WIN32_EXECUTABLE TRUE)
|
||||
|
||||
if(WIN32)
|
||||
target_link_libraries(wxCrc PRIVATE Dwmapi User32)
|
||||
elseif(LINUX)
|
||||
target_link_libraries(wxCrc PRIVATE dl)
|
||||
endif()
|
||||
BIN
wxapps/wxcrc/wxCrc.ico
Normal file
BIN
wxapps/wxcrc/wxCrc.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 66 KiB |
1
wxapps/wxcrc/wxCrc.rc
Normal file
1
wxapps/wxcrc/wxCrc.rc
Normal file
@ -0,0 +1 @@
|
||||
IDI_ICON1 ICON DISCARDABLE "wxCrc.ico"
|
||||
1
wxapps/wxcrc/wxCrc.svg
Normal file
1
wxapps/wxcrc/wxCrc.svg
Normal file
@ -0,0 +1 @@
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1750068146965" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="28170" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M726.230046 393.060741s-16.462831-140.445857-168.680038-144.369641c-152.259857-3.881134-230.394328 105.345055-230.394328 261.443397 0 156.098341 86.408535 280.977014 234.48871 280.977014 148.122825 0 164.628305-156.098341 164.628306-156.098341l283.877201 15.609834s16.67608 141.000305-102.103669 248.563151C789.22383 1006.749001 643.446745 1024.320727 541.598975 1023.59568c-101.84777-0.767697-243.018674 1.450094-379.583398-126.627316C25.578803 768.976254 2.334651 644.566729 2.334651 522.374995c0-122.234384 25.888441-284.090451 188.256306-406.879282C300.883391 32.157964 412.753869 1.407444 524.624347 1.407444 991.639876 1.364794 1022.944843 395.790329 1022.944843 395.790329z" p-id="28171" fill="#1296db"></path></svg>
|
||||
|
After Width: | Height: | Size: 1.0 KiB |
Loading…
Reference in New Issue
Block a user