1
0
mirror of synced 2024-11-24 15:50:16 +01:00

feat: Added close button for welcome screen

This commit is contained in:
WerWolv 2022-08-10 10:28:40 +02:00
parent 5c13cf9dbf
commit d55c59c796
4 changed files with 14 additions and 9 deletions

View File

@ -131,7 +131,7 @@ namespace hex::prv {
u32 Provider::getPageCount() const {
return std::ceil(this->getActualSize() / double(PageSize));
return std::max(1.0, std::ceil(this->getActualSize() / double(PageSize)));
}
u32 Provider::getCurrentPage() const {

View File

@ -64,10 +64,6 @@ namespace hex {
}
static void signalHandler(int signalNumber) {
// Ignore SIGTERMs and SIGINTs so ImHex can be killed with Ctrl+C and a debugger
if (signalNumber == SIGTERM || signalNumber == SIGINT)
return;
log::fatal("Terminating with signal {}", signalNumber);
EventManager::post<EventAbnormalTermination>(signalNumber);
@ -150,9 +146,11 @@ namespace hex {
this->m_popupsToOpen.push_back(name);
});
for (u32 signal = 0; signal < NSIG; signal++)
for (u32 signal = 0; signal < NSIG; signal++) {
if (signal != SIGTERM && signal != SIGINT)
std::signal(signal, signalHandler);
std::set_terminate([]{ signalHandler(SIGTERM); });
}
std::set_terminate([]{ signalHandler(SIGABRT); });
auto imhexLogo = romfs::get("logo.png");
this->m_logoTexture = ImGui::LoadImageFromMemory(reinterpret_cast<const ImU8 *>(imhexLogo.data()), imhexLogo.size());

View File

@ -410,7 +410,7 @@ namespace hex::plugin::builtin {
ImGui::BeginDisabled(this->m_searchRunning);
{
ui::regionSelectionPicker(&this->m_searchSettings.range);
ui::regionSelectionPicker(&this->m_searchSettings.range, true, true);
ImGui::NewLine();

View File

@ -262,6 +262,13 @@ namespace hex::plugin::builtin {
ImGui::EndTable();
}
ImGui::SetCursorPos(ImVec2(ImGui::GetWindowSize().x - ImGui::CalcTextSize("X").x * 2, 0));
if (ImGui::Hyperlink("X")) {
auto provider = ImHexApi::Provider::createProvider("hex.builtin.provider.null");
if (provider != nullptr)
(void)provider->open();
}
}
static void drawWelcomeScreen() {