mirror of https://github.com/KLayout/klayout.git
Merge pull request #87 from lightwave-lab/open-with-macos
Open with macos
This commit is contained in:
commit
dc5792d768
|
|
@ -18,6 +18,21 @@
|
|||
<string>APPL</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>${VERSION}</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>${VERSION}</string>
|
||||
<key>CFBundleDocumentTypes</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>CFBundleTypeExtensions</key>
|
||||
<array>
|
||||
<string>gds</string>
|
||||
</array>
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>Editor</string>
|
||||
<key>CFBundleTypeIconFile</key>
|
||||
<string>${ICONFILE}</string>
|
||||
</dict>
|
||||
</array>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
|
|
@ -1391,6 +1391,35 @@ GuiApplication::force_update_app_menu ()
|
|||
#endif
|
||||
}
|
||||
|
||||
#if defined(__APPLE__)
|
||||
// By Thomas Lima (March 7, 2018)
|
||||
//
|
||||
// This event interceptor catches MacOS "Open With" event, and KLayout should respond
|
||||
// similarly to the Drop event in MainWindow::dropEvent.
|
||||
//
|
||||
// This particular implementation always creates a new window.
|
||||
//
|
||||
// This was implemented with the inspiration of http://doc.qt.io/qt-5/qfileopenevent.html
|
||||
bool
|
||||
GuiApplication::event (QEvent *event)
|
||||
{
|
||||
if (event->type() == QEvent::FileOpen) {
|
||||
QFileOpenEvent *openEvent = static_cast<QFileOpenEvent *>(event);
|
||||
if (mp_mw)
|
||||
{
|
||||
const std::string tech = mp_mw->initial_technology();
|
||||
const std::string file = tl::to_string (openEvent->file());
|
||||
const int mode = 1; // open in new window
|
||||
mp_mw->load_layout (file, tech, mode);
|
||||
mp_mw->add_mru (file, tech);
|
||||
}
|
||||
}
|
||||
|
||||
return QApplication::event(event);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
int
|
||||
GuiApplication::exec ()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -28,6 +28,9 @@
|
|||
|
||||
#include <QApplication>
|
||||
#include <QEventLoop>
|
||||
#ifdef __APPLE__
|
||||
# include <QEvent>
|
||||
#endif
|
||||
|
||||
#include "gsi.h"
|
||||
|
||||
|
|
@ -438,6 +441,14 @@ public:
|
|||
*/
|
||||
void force_update_app_menu ();
|
||||
|
||||
/**
|
||||
* @brief Handles MacOS file open
|
||||
* This function is used to process the "Open With" event sent by MacOS.
|
||||
*/
|
||||
#ifdef __APPLE__
|
||||
bool event (QEvent *event);
|
||||
#endif
|
||||
|
||||
protected:
|
||||
virtual void setup ();
|
||||
virtual void shutdown ();
|
||||
|
|
|
|||
Loading…
Reference in New Issue