Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
cmake_minimum_required(VERSION 3.25)
set(CMAKE_OSX_DEPLOYMENT_TARGET "13.3" CACHE STRING "needs at least 13.3")
project(QtPMbrowser VERSION 2.5.0 LANGUAGES CXX)
set(MY_RELEASE_DAY "2026-03-13")
set(MY_COPYRIGHT "2020 - 2025 Christian R. Halaszovich")
project(QtPMbrowser VERSION 2.5.1 LANGUAGES CXX)
set(MY_RELEASE_DAY "2026-05-4")
set(MY_COPYRIGHT "2020 - 2026 Christian R. Halaszovich")
set(LINUX_RELEASE_DESCRIPTION "
<p>improved feature: show stimulus protocols in table view</p>
<p>improved feature: 'Select Parameters Dialog' allows selecting / de-selecting all options of a section</p>
<p>improved feature: show amplifier state in table view</p>
<p>bugfix: handle unicode in filenames (for loading and exporting)</p>
<p>new feature: support unbundled PM files</p>
")

set(CMAKE_CXX_STANDARD 20)
Expand Down
3 changes: 1 addition & 2 deletions QtPMbrowser/linux_deploy/de.halaszovich.pmbrowser.desktop.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,5 @@ Name=PM browser
Comment=Browse PM dat files
Terminal=false
Categories=Science
Exec=QtPMbrowser %u
#MimeType=application/octet-stream
Exec=QtPMbrowser %f
Icon=${MY_APP_ID}
23 changes: 16 additions & 7 deletions QtPMbrowser/pmbrowserwindow.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2020 - 2025 Christian R. Halaszovich
Copyright 2020 - 2026 Christian R. Halaszovich

This file is part of PMbrowser.

Expand Down Expand Up @@ -172,7 +172,9 @@ void PMbrowserWindow::animateTraceList(const QString& info_text, const std::vect
if (progress.wasCanceled()) {
break;
}
ui->renderArea->renderTrace(trace_list.at(i), infile);
if(!ui->renderArea->renderTrace(trace_list.at(i), infile)) {
break;
}
ui->renderArea->repaint();
#ifdef __APPLE__
// unfortunately, on macOS Qt doesn't support QWdiget::repaint
Expand Down Expand Up @@ -303,18 +305,25 @@ void PMbrowserWindow::loadFile(QString filename)
QSettings settings;
settings.setValue("pmbrowserwindow/lastloadpath", lastloadpath);
datfile = std::make_unique<DatFile>();
bool do_retry = false;
try {
datfile->InitFromStream(infile);
}
catch (const hkLib::fileformat_error& e) {
datfile = nullptr;
infile.seekg(0, std::ios_base::beg);
qDebug() << e.what();
do_retry = true;
}
catch (const std::exception& e) {
//QMessageBox::warning(this, QString("File Error"),
// QString("error while processing dat file:\n") + QString(e.what()));
QMessageBox::warning(this, QString("File Error"),
QString("error while processing dat file:\n") + QString(e.what()));
qDebug() << e.what();
datfile = nullptr;
infile.seekg(0, std::ios_base::beg);
//infile.close();
//infile.seekg(0, std::ios_base::beg);
infile.close();
}
if (!datfile) {
if (do_retry && !datfile) {
try {
// we might habe an unbundled dat file
datfile = std::make_unique<DatFile>();
Expand Down
2 changes: 1 addition & 1 deletion QtPMbrowser/pmbrowserwindow.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2020 - 2023 Christian R. Halaszovich
Copyright 2020 - 2026 Christian R. Halaszovich

This file is part of PMbrowser.

Expand Down
7 changes: 4 additions & 3 deletions QtPMbrowser/renderarea.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,7 @@ void RenderArea::zoomIn(double x_center, double y_center, double factor)
update();
}

void RenderArea::renderTrace(const hkLib::hkTreeNode* TrRecord, std::istream& infile)
bool RenderArea::renderTrace(const hkLib::hkTreeNode* TrRecord, std::istream& infile)
{
using namespace hkLib;
char dataformat = TrRecord->getChar(TrDataFormat);
Expand All @@ -736,7 +736,7 @@ void RenderArea::renderTrace(const hkLib::hkTreeNode* TrRecord, std::istream& in
}
else {
QMessageBox::warning(this, QString("Data Format Error"), QString("Unknown Dataformat"));
return;
return false;
}

addTrace(DisplayTrace(
Expand All @@ -751,12 +751,13 @@ void RenderArea::renderTrace(const hkLib::hkTreeNode* TrRecord, std::istream& in
catch (const std::exception& e) {
// newYtrace.data.clear();
QMessageBox::warning(nullptr, "File Error", e.what());
return;
return false;
}

if (do_autoscale_on_load) { autoScale(); }
else { update(); } // update is usually done within autoScale()
setMouseTracking(true);
return true; // success
}

void RenderArea::addTrace(DisplayTrace&& dt)
Expand Down
2 changes: 1 addition & 1 deletion QtPMbrowser/renderarea.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class RenderArea : public QWidget
explicit RenderArea(QWidget *parent = nullptr);
~RenderArea();
bool noData() { return !yTrace.isValid(); };
void renderTrace(const hkLib::hkTreeNode* trace, std::istream& infile);
bool renderTrace(const hkLib::hkTreeNode* trace, std::istream& infile);
void addTrace(DisplayTrace&& dt);

/// <summary>
Expand Down
4 changes: 2 additions & 2 deletions doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ Welcome to PMbrowser's documentation!

:program:`PMbrowser` is open-source software aimed at electrophysiologists who use :program:`PATCHMASTER` or
:program:`PATCHMASTER NEXT` from `HEKA <http://www.heka.com/downloads/downloads_main.html#down_patchmaster_next>`_ and
:program:`IgorPro` of `WaveMetrics <https://www.wavemetrics.com/>`_. It can open bundled data files (:file:`.dat`) and
export :program:`IgorPro` compatible files (and supports some additional export formats,
:program:`IgorPro` of `WaveMetrics <https://www.wavemetrics.com/>`_. It can open data files (:file:`.dat`) and
export :program:`IgorPro` compatible files (and supports some additional export formats, e.g. :program:`numpy`,
see :ref:`intro-label` for details).

But even if you do not use :program:`IgorPro`, you might find :program:`PMbrowser` useful for browsing PatchMaster files
Expand Down
4 changes: 2 additions & 2 deletions doc/introduction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
What can :program:`PMbrowser` do for you?
-----------------------------------------

It can open bundled data files (:file:`.dat`) created by :program:`PATCHMASTER` or
It can open data (bundled and unbundled) files (:file:`.dat`) created by :program:`PATCHMASTER` or
:program:`PATCHMASTER NEXT`.

It has been tested with files created by versions of :program:`PATCHMASTER`
Expand Down Expand Up @@ -50,4 +50,4 @@ You can use it freely. The source code can be found `here <https://github.com/Ch
variant under active developement by HEKA, cannot read data files created by old versions of :program:`PATCHMASTER`.
One intention for the creation of :program:`PMbrowser` was to provide support for reading these old data files for
users who now use :program:`PATCHMASTER NEXT`.


4 changes: 2 additions & 2 deletions hekatoolslib/DatFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ void DatFile::InitFromStream(std::istream& infile)
if (!isValid) {
bool isInvalidBundle = std::memcmp(bh->Signature, BundleSignatureInvalid, 8) == 0;
if (isInvalidBundle) {
throw std::runtime_error("invalid bundle signature");
throw fileformat_error("invalid bundle signature");
}
else {
throw std::runtime_error("invalid file (not a PM dat file)");
throw fileformat_error("invalid file (not a PM dat file)");
}
}

Expand Down
8 changes: 7 additions & 1 deletion hekatoolslib/DatFile.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/

/*
Copyright 2020 - 2023 Christian R. Halaszovich
Copyright 2020 - 2026 Christian R. Halaszovich

This file is part of PMbrowser.

Expand Down Expand Up @@ -33,11 +33,17 @@
#include <algorithm>
#include <type_traits>
#include <cassert>
#include <stdexcept>
#include "machineinfo.h"
#include "hkTree.h"
#include "helpers.h"

namespace hkLib {
/// @brief thrown if file is not a bundled dat file
class fileformat_error : public std::runtime_error {
public:
fileformat_error(const std::string& msg) : std::runtime_error(msg) {}
};

/// <summary>
/// each BundleItem describes offset and length of
Expand Down
2 changes: 1 addition & 1 deletion hekatoolslib/hkTree.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2020 - 2022 Christian R. Halaszovich
Copyright 2020 - 2026 Christian R. Halaszovich

This file is part of PMbrowser.

Expand Down
2 changes: 1 addition & 1 deletion hekatoolslib/hkTree.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2020 - 2022 Christian R. Halaszovich
Copyright 2020 - 2026 Christian R. Halaszovich

This file is part of PMbrowser.

Expand Down
Loading