Skip to content

Commit

Permalink
Add about menu item and dialogue
Browse files Browse the repository at this point in the history
  • Loading branch information
kosude committed Apr 15, 2024
1 parent b8ae60b commit 542e781
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
BUILD_DIR := build
SRC_DIR := .

PROJECT_VERS := $(shell "$(SRC_DIR)/util/version.sh" --long)

CMAKE := cmake
CMAKEFLAGS = -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
CMAKEFLAGS = -DTEXEDIT_VERSION="$(PROJECT_VERS)" -DCMAKE_EXPORT_COMPILE_COMMANDS=ON

CARGO := cargo
CARGOCHAN := +nightly
Expand Down
3 changes: 3 additions & 0 deletions frontend/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ if (CMAKE_BUILD_TYPE STREQUAL "Debug")
endif()
endif()

option(TEXEDIT_VERSION "TexEdit project version inform" v0.0.0)

set(TARGET_NAME "${PROJECT_NAME}")
set(DEPS_DIR "${CMAKE_CURRENT_LIST_DIR}/../deps/")

Expand All @@ -45,3 +47,4 @@ target_include_directories(${TARGET_NAME} PRIVATE "${CMAKE_CURRENT_LIST_DIR}")
target_link_libraries(${TARGET_NAME}
cutils
${wxWidgets_LIBRARIES})
target_compile_definitions(${TARGET_NAME} PRIVATE TEXEDIT_VERSION="${TEXEDIT_VERSION}")
15 changes: 15 additions & 0 deletions frontend/gui/main_frame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "command_ids.hpp"
#include "editor_panel.hpp"

#include <wx/aboutdlg.h>
#include <wx/splitter.h>

namespace te {
Expand Down Expand Up @@ -55,6 +56,8 @@ namespace te {
helpMenu->Append(cmds::Menu_URLSourcePage, "Git &Repository");
helpMenu->Append(cmds::Menu_URLFeatureRequest, "&Feature Requests");
helpMenu->Append(cmds::Menu_URLBugReport, "&Bug Reports");
helpMenu->AppendSeparator();
helpMenu->Append(wxID_ABOUT, "&About TexEdit");
menuBar->Append(helpMenu, "&Help");

SetMenuBar(menuBar);
Expand All @@ -66,6 +69,17 @@ namespace te {
}
}

void MainFrame::OnMenuAbout(wxCommandEvent &event) {
wxAboutDialogInfo aboutInfo{};
aboutInfo.SetName("TexEdit");
aboutInfo.SetVersion(TEXEDIT_VERSION);
aboutInfo.SetDescription("Integrated viewer, compiler and editor for TeX documents");
aboutInfo.SetCopyright("(c) 2024 Jack Bennett");
aboutInfo.SetWebSite("https://kosude.github.io/texedit/");

wxAboutBox(aboutInfo);
}

void MainFrame::OnMenuQuit(wxCommandEvent &event) {
Close(true);
}
Expand All @@ -88,6 +102,7 @@ namespace te {

wxBEGIN_EVENT_TABLE(MainFrame, wxFrame)
EVT_MENU(wxID_EXIT, MainFrame::OnMenuQuit)
EVT_MENU(wxID_ABOUT, MainFrame::OnMenuAbout)
EVT_MENU(cmds::Menu_URLSourcePage, MainFrame::OnMenuURLSourcePage)
EVT_MENU(cmds::Menu_URLFeatureRequest, MainFrame::OnMenuURLFeatureRequest)
EVT_MENU(cmds::Menu_URLBugReport, MainFrame::OnMenuURLBugReport)
Expand Down
1 change: 1 addition & 0 deletions frontend/gui/main_frame.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ namespace te {

void ShowURL(const std::string &url);

void OnMenuAbout(wxCommandEvent &event);
void OnMenuQuit(wxCommandEvent &event);
void OnMenuURLSourcePage(wxCommandEvent &event);
void OnMenuURLFeatureRequest(wxCommandEvent &event);
Expand Down

0 comments on commit 542e781

Please sign in to comment.