mirror of
https://github.com/KLayout/klayout.git
synced 2026-09-02 02:47:48 +02:00
WIP: turned ext module into plugins.
This commit is contained in:
@@ -0,0 +1,116 @@
|
||||
|
||||
/*
|
||||
|
||||
KLayout Layout Viewer
|
||||
Copyright (C) 2006-2018 Matthias Koefferlein
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
#include "layDiffToolDialog.h"
|
||||
|
||||
#include "layPlugin.h"
|
||||
|
||||
namespace lay
|
||||
{
|
||||
|
||||
class DiffPlugin
|
||||
: public lay::Plugin
|
||||
{
|
||||
public:
|
||||
DiffPlugin (Plugin *parent, lay::LayoutView *view)
|
||||
: lay::Plugin (parent), mp_view (view)
|
||||
{
|
||||
mp_dialog = new lay::DiffToolDialog (0);
|
||||
}
|
||||
|
||||
~DiffPlugin ()
|
||||
{
|
||||
delete mp_dialog;
|
||||
mp_dialog = 0;
|
||||
}
|
||||
|
||||
void menu_activated (const std::string &symbol)
|
||||
{
|
||||
if (symbol == "lay::diff_tool") {
|
||||
|
||||
if (mp_dialog->exec_dialog (mp_view)) {
|
||||
|
||||
// ... implementation is in layDiffToolDialog.cc ...
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
lay::LayoutView *mp_view;
|
||||
lay::DiffToolDialog *mp_dialog;
|
||||
};
|
||||
|
||||
class DiffPluginDeclaration
|
||||
: public lay::PluginDeclaration
|
||||
{
|
||||
public:
|
||||
DiffPluginDeclaration ()
|
||||
{
|
||||
// .. nothing yet ..
|
||||
}
|
||||
|
||||
virtual void get_options (std::vector < std::pair<std::string, std::string> > &options) const
|
||||
{
|
||||
options.push_back (std::pair<std::string, std::string> (cfg_diff_run_xor, "false"));
|
||||
options.push_back (std::pair<std::string, std::string> (cfg_diff_detailed, "false"));
|
||||
options.push_back (std::pair<std::string, std::string> (cfg_diff_summarize, "false"));
|
||||
options.push_back (std::pair<std::string, std::string> (cfg_diff_expand_cell_arrays, "false"));
|
||||
options.push_back (std::pair<std::string, std::string> (cfg_diff_exact, "false"));
|
||||
}
|
||||
|
||||
virtual lay::ConfigPage *config_page (QWidget * /*parent*/, std::string & /*title*/) const
|
||||
{
|
||||
// .. nothing yet ..
|
||||
return 0;
|
||||
}
|
||||
|
||||
virtual void get_menu_entries (std::vector<lay::MenuEntry> &menu_entries) const
|
||||
{
|
||||
lay::PluginDeclaration::get_menu_entries (menu_entries);
|
||||
menu_entries.push_back (lay::MenuEntry ("lay::diff_tool", "diff_tool:edit", "tools_menu.post_verification_group", tl::to_string (QObject::tr ("Diff Tool"))));
|
||||
}
|
||||
|
||||
virtual bool configure (const std::string & /*name*/, const std::string & /*value*/)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual void config_finalize ()
|
||||
{
|
||||
// .. nothing yet ..
|
||||
}
|
||||
|
||||
lay::Plugin *create_plugin (db::Manager *, lay::PluginRoot *root, lay::LayoutView *view) const
|
||||
{
|
||||
return new DiffPlugin (root, view);
|
||||
}
|
||||
};
|
||||
|
||||
static tl::RegisteredClass<lay::PluginDeclaration> config_decl (new lay::DiffPluginDeclaration (), 3001, "lay::DiffPlugin");
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user