2018-06-22 22:21:20 +08:00
|
|
|
/*
|
|
|
|
* nextpnr -- Next Generation Place and Route
|
|
|
|
*
|
2021-06-09 20:09:08 +08:00
|
|
|
* Copyright (C) 2018 Miodrag Milanovic <micko@yosyshq.com>
|
2018-06-22 22:21:20 +08:00
|
|
|
*
|
|
|
|
* Permission to use, copy, modify, and/or distribute this software for any
|
|
|
|
* purpose with or without fee is hereby granted, provided that the above
|
|
|
|
* copyright notice and this permission notice appear in all copies.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
|
|
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
|
|
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
|
|
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
|
|
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
|
|
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
|
|
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2018-06-21 19:41:16 +08:00
|
|
|
#ifndef BASEMAINWINDOW_H
|
|
|
|
#define BASEMAINWINDOW_H
|
|
|
|
|
2019-06-26 00:19:25 +08:00
|
|
|
#include "command.h"
|
2018-06-21 19:41:16 +08:00
|
|
|
#include "nextpnr.h"
|
2018-08-03 00:50:08 +08:00
|
|
|
#include "worker.h"
|
2018-06-21 19:41:16 +08:00
|
|
|
|
|
|
|
#include <QMainWindow>
|
|
|
|
#include <QMenu>
|
|
|
|
#include <QMenuBar>
|
2018-07-13 04:04:13 +08:00
|
|
|
#include <QProgressBar>
|
2018-06-21 19:41:16 +08:00
|
|
|
#include <QStatusBar>
|
2018-06-21 19:55:36 +08:00
|
|
|
#include <QTabWidget>
|
|
|
|
#include <QToolBar>
|
2018-06-21 19:41:16 +08:00
|
|
|
|
2018-06-21 21:41:40 +08:00
|
|
|
Q_DECLARE_METATYPE(std::string)
|
2018-07-15 01:44:37 +08:00
|
|
|
Q_DECLARE_METATYPE(NEXTPNR_NAMESPACE_PREFIX DecalXY)
|
2018-06-21 21:41:40 +08:00
|
|
|
|
2018-06-22 19:10:27 +08:00
|
|
|
NEXTPNR_NAMESPACE_BEGIN
|
|
|
|
|
2018-07-14 20:06:05 +08:00
|
|
|
class PythonTab;
|
2018-07-16 02:31:42 +08:00
|
|
|
class DesignWidget;
|
2018-07-26 19:21:46 +08:00
|
|
|
class FPGAViewWidget;
|
2018-07-14 20:06:05 +08:00
|
|
|
|
2018-06-21 19:41:16 +08:00
|
|
|
class BaseMainWindow : public QMainWindow
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2019-06-14 21:18:35 +08:00
|
|
|
explicit BaseMainWindow(std::unique_ptr<Context> context, CommandHandler *handler, QWidget *parent = 0);
|
2018-06-21 21:41:40 +08:00
|
|
|
virtual ~BaseMainWindow();
|
2018-07-13 15:14:48 +08:00
|
|
|
Context *getContext() { return ctx.get(); }
|
2019-06-14 17:14:18 +08:00
|
|
|
void updateActions();
|
|
|
|
|
2018-08-09 03:15:54 +08:00
|
|
|
void notifyChangeContext();
|
2018-08-09 00:17:34 +08:00
|
|
|
|
2018-06-21 19:41:16 +08:00
|
|
|
protected:
|
|
|
|
void createMenusAndBars();
|
2018-08-03 00:50:08 +08:00
|
|
|
void disableActions();
|
2019-12-20 22:25:10 +08:00
|
|
|
void enableDisableDecals();
|
2018-08-06 00:02:33 +08:00
|
|
|
|
2018-08-03 01:25:20 +08:00
|
|
|
virtual void onDisableActions(){};
|
2019-06-14 17:14:18 +08:00
|
|
|
virtual void onUpdateActions(){};
|
2018-06-21 19:41:16 +08:00
|
|
|
|
|
|
|
protected Q_SLOTS:
|
|
|
|
void writeInfo(std::string text);
|
2018-07-17 03:15:49 +08:00
|
|
|
void closeTab(int index);
|
2018-06-21 23:44:18 +08:00
|
|
|
|
2018-06-26 20:17:17 +08:00
|
|
|
virtual void new_proj() = 0;
|
2018-08-09 00:14:22 +08:00
|
|
|
|
2018-08-03 00:50:08 +08:00
|
|
|
void open_json();
|
2019-06-14 17:14:18 +08:00
|
|
|
void save_json();
|
2018-08-03 00:50:08 +08:00
|
|
|
void place();
|
|
|
|
|
2018-12-15 00:20:25 +08:00
|
|
|
void execute_python();
|
|
|
|
|
2018-08-03 00:50:08 +08:00
|
|
|
void pack_finished(bool status);
|
|
|
|
void place_finished(bool status);
|
|
|
|
void route_finished(bool status);
|
|
|
|
|
|
|
|
void taskCanceled();
|
|
|
|
void taskStarted();
|
|
|
|
void taskPaused();
|
|
|
|
|
2020-01-05 20:51:12 +08:00
|
|
|
void screenshot();
|
|
|
|
void saveMovie();
|
2020-02-27 16:37:09 +08:00
|
|
|
void saveSVG();
|
2020-01-05 20:51:12 +08:00
|
|
|
|
2021-07-25 19:06:51 +08:00
|
|
|
void about();
|
|
|
|
|
2018-06-26 21:47:22 +08:00
|
|
|
Q_SIGNALS:
|
|
|
|
void contextChanged(Context *ctx);
|
2018-07-06 02:06:12 +08:00
|
|
|
void updateTreeView();
|
2018-06-26 21:47:22 +08:00
|
|
|
|
2018-06-21 19:41:16 +08:00
|
|
|
protected:
|
2018-08-03 01:21:25 +08:00
|
|
|
// state variables
|
2019-06-14 21:18:35 +08:00
|
|
|
CommandHandler *handler;
|
2018-07-13 15:14:48 +08:00
|
|
|
std::unique_ptr<Context> ctx;
|
2018-08-03 00:50:08 +08:00
|
|
|
TaskManager *task;
|
2018-08-03 01:21:25 +08:00
|
|
|
bool timing_driven;
|
2018-08-09 00:14:22 +08:00
|
|
|
std::string currentProj;
|
2018-08-03 01:21:25 +08:00
|
|
|
|
|
|
|
// main widgets
|
2018-06-21 19:41:16 +08:00
|
|
|
QTabWidget *tabWidget;
|
2018-06-21 20:12:02 +08:00
|
|
|
QTabWidget *centralTabWidget;
|
2018-07-14 20:06:05 +08:00
|
|
|
PythonTab *console;
|
2018-08-03 01:21:25 +08:00
|
|
|
DesignWidget *designview;
|
|
|
|
FPGAViewWidget *fpgaView;
|
2018-06-21 19:55:36 +08:00
|
|
|
|
2018-08-03 01:21:25 +08:00
|
|
|
// Menus, bars and actions
|
2018-06-21 19:41:16 +08:00
|
|
|
QMenuBar *menuBar;
|
2018-08-03 01:21:25 +08:00
|
|
|
QMenu *menuDesign;
|
2018-06-21 19:41:16 +08:00
|
|
|
QStatusBar *statusBar;
|
2018-08-03 01:21:25 +08:00
|
|
|
QToolBar *mainActionBar;
|
|
|
|
QProgressBar *progressBar;
|
2018-08-03 01:25:20 +08:00
|
|
|
|
2019-06-14 17:14:18 +08:00
|
|
|
QAction *actionNew;
|
2018-08-03 00:50:08 +08:00
|
|
|
QAction *actionLoadJSON;
|
2019-06-14 17:14:18 +08:00
|
|
|
QAction *actionSaveJSON;
|
|
|
|
|
2018-08-03 00:50:08 +08:00
|
|
|
QAction *actionPack;
|
|
|
|
QAction *actionPlace;
|
|
|
|
QAction *actionRoute;
|
2018-12-15 00:20:25 +08:00
|
|
|
|
|
|
|
QAction *actionExecutePy;
|
|
|
|
|
2018-08-03 00:50:08 +08:00
|
|
|
QAction *actionPlay;
|
|
|
|
QAction *actionPause;
|
|
|
|
QAction *actionStop;
|
2019-12-20 22:25:10 +08:00
|
|
|
|
|
|
|
QAction *actionDisplayBel;
|
|
|
|
QAction *actionDisplayWire;
|
|
|
|
QAction *actionDisplayPip;
|
|
|
|
QAction *actionDisplayGroups;
|
2020-01-05 20:51:12 +08:00
|
|
|
|
|
|
|
QAction *actionScreenshot;
|
|
|
|
QAction *actionMovie;
|
2020-02-27 16:37:09 +08:00
|
|
|
QAction *actionSaveSVG;
|
2018-06-21 19:41:16 +08:00
|
|
|
};
|
|
|
|
|
2018-06-22 19:10:27 +08:00
|
|
|
NEXTPNR_NAMESPACE_END
|
|
|
|
|
2018-06-21 19:41:16 +08:00
|
|
|
#endif // BASEMAINWINDOW_H
|