From 9caf79b3f422d6f177bccb9d940fddd42a68f90a Mon Sep 17 00:00:00 2001 From: taynpg Date: Thu, 26 Dec 2024 11:56:43 +0800 Subject: [PATCH] =?UTF-8?q?base=EF=BC=9A=E5=9F=BA=E6=9C=AC=E6=9E=B6?= =?UTF-8?q?=E5=AD=90=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .clang-format | 17 +++++++++++++++++ .gitignore | 4 ++++ .gitmodules | 3 +++ .vscode/settings.json | 35 +++++++++++++++++++++++++++++++++++ CMakeLists.txt | 22 ++++++++++++++++++++++ MainFrame.cpp | 9 +++++++++ MainFrame.h | 11 +++++++++++ main.cpp | 21 +++++++++++++++++++++ ofen | 1 + 9 files changed, 123 insertions(+) create mode 100644 .clang-format create mode 100644 .gitignore create mode 100644 .gitmodules create mode 100644 .vscode/settings.json create mode 100644 CMakeLists.txt create mode 100644 MainFrame.cpp create mode 100644 MainFrame.h create mode 100644 main.cpp create mode 160000 ofen diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000..402f22e --- /dev/null +++ b/.clang-format @@ -0,0 +1,17 @@ +BasedOnStyle: LLVM +IndentWidth: 4 +PointerAlignment: Left +AccessModifierOffset: -4 +BreakBeforeBraces: Custom +BraceWrapping: + AfterFunction: true + AfterClass: true +Cpp11BracedListStyle: true +ReflowComments: true +SpacesBeforeTrailingComments: 3 +TabWidth: 4 +ConstructorInitializerAllOnOneLineOrOnePerLine: true +ColumnLimit: 80 +AllowShortBlocksOnASingleLine: Never +AllowShortFunctionsOnASingleLine: None +AllowShortEnumsOnASingleLine: false diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5b861d3 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +build +.vs +.cache +cmake-* \ No newline at end of file diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..f5e7bbc --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "ofen"] + path = ofen + url = https://www.sinxmiao.cn/taynpg/ofen diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..16b39fa --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,35 @@ +{ + "files.autoSave": "onFocusChange", + "editor.fontSize": 14, + "editor.fontFamily": "'FiraCode Nerd Font Mono', 'FiraCode Nerd Font Mono', 'FiraCode Nerd Font Mono'", + "cmake.configureOnOpen": true, + "cmake.debugConfig": { + "console": "integratedTerminal", + "setupCommands": [ + { + "description": "-gdb-set charset utf-8", + "text": "-gdb-set charset UTF-8" + }, + { + "description": "Enable gdb pretty-printing", + "text": "-enable-pretty-printing", + "ignoreFailures": true + } + ], + "args": [ + ] + }, + "cmake.configureSettings": { + "CMAKE_TOOLCHAIN_FILE": "${env:VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" + }, + "cmake.options.statusBarVisibility": "visible", + "cmake.generator": "Ninja", + "C_Cpp.default.compileCommands": "${workspaceRoot}/build/compile_commands.json", + "C_Cpp.default.cppStandard": "c++17", + "editor.inlayHints.enabled": "off", + "editor.unicodeHighlight.allowedLocales": { + "ja": true, + "zh-hant": true, + "zh-hans": true + } +} \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..7787125 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,22 @@ +cmake_minimum_required(VERSION 3.16) + +project(PictureTool LANGUAGES CXX) +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +if (MSVC) + add_compile_options(/source-charset:utf-8) +endif() + +message(STATUS "System: ${CMAKE_SYSTEM_NAME}") +message(STATUS "Compiler CXX ID: ${CMAKE_CXX_COMPILER_ID}") +set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib/${CMAKE_BUILD_TYPE}) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin/${CMAKE_BUILD_TYPE}/) + +add_subdirectory(ofen) +find_package(wxWidgets CONFIG REQUIRED) +find_package(OpenCV CONFIG REQUIRED) + +add_executable(PictureTool main.cpp MainFrame.h MainFrame.cpp) +target_link_libraries(PictureTool PRIVATE wx::core wx::base Ofen ${OpenCV_LIBS}) +set_target_properties(PictureTool PROPERTIES WIN32_EXECUTABLE TRUE) \ No newline at end of file diff --git a/MainFrame.cpp b/MainFrame.cpp new file mode 100644 index 0000000..07a39d8 --- /dev/null +++ b/MainFrame.cpp @@ -0,0 +1,9 @@ +#include "MainFrame.h" + +CMainFrame::CMainFrame(const wxString& title) : wxFrame(NULL, wxID_ANY, title) +{ +} + +CMainFrame::~CMainFrame() +{ +} diff --git a/MainFrame.h b/MainFrame.h new file mode 100644 index 0000000..3b287c9 --- /dev/null +++ b/MainFrame.h @@ -0,0 +1,11 @@ +#pragma once +#include + +class CMainFrame : public wxFrame +{ +public: + CMainFrame(const wxString& title); + virtual ~CMainFrame(); +public: + +}; \ No newline at end of file diff --git a/main.cpp b/main.cpp new file mode 100644 index 0000000..6738c9f --- /dev/null +++ b/main.cpp @@ -0,0 +1,21 @@ +#include "MainFrame.h" +#include + +class CPictureTool : public wxApp +{ +public: + virtual bool OnInit() + { + wxString title = wxString::Format(wxT("")); + auto* f = new CMainFrame(title); + f->Show(true); + return true; + } + virtual int OnExit() + { + return wxApp::OnExit(); + } +}; + +IMPLEMENT_APP(CPictureTool); +DECLARE_APP(CPictureTool); \ No newline at end of file diff --git a/ofen b/ofen new file mode 160000 index 0000000..1d86de1 --- /dev/null +++ b/ofen @@ -0,0 +1 @@ +Subproject commit 1d86de126afe83c7a9c934adca74006ca90ec65f