/* -*- c++ -*- ---------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories LAMMPS development team: developers@lammps.org Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ #ifndef CODEEDITOR_H #define CODEEDITOR_H #include #include #include #include #include class CodeEditor : public QPlainTextEdit { Q_OBJECT public: CodeEditor(QWidget *parent = nullptr); void lineNumberAreaPaintEvent(QPaintEvent *event); int lineNumberAreaWidth(); void setFont(const QFont &newfont); void setCursor(int block); void setHighlight(int block, bool error); QString reformatLine(const QString &line); static constexpr int NO_HIGHLIGHT = 1 << 30; protected: void resizeEvent(QResizeEvent *event) override; void dragEnterEvent(QDragEnterEvent *event) override; bool canInsertFromMimeData(const QMimeData *source) const override; void dropEvent(QDropEvent *event) override; void contextMenuEvent(QContextMenuEvent *event) override; void keyPressEvent(QKeyEvent *event) override; private slots: void updateLineNumberAreaWidth(int newBlockCount); void updateLineNumberArea(const QRect &rect, int dy); void get_help(); void find_help(QString &page, QString &help); void open_help(); void reformatCurrentLine(); private: QWidget *lineNumberArea; QShortcut *help_action; int highlight; QMap cmd_map; QMap fix_map; QMap compute_map; QMap pair_map; QMap bond_map; QMap angle_map; QMap dihedral_map; QMap improper_map; QMap dump_map; }; #endif // Local Variables: // c-basic-offset: 4 // End: