| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
#pragma once |
| 5 |
|
| 6 |
#include <QDockWidget> |
| 7 |
|
| 8 |
#include "Common/Assembler/GekkoAssembler.h" |
| 9 |
#include "Core/Core.h" |
| 10 |
|
| 11 |
class QTabWidget; |
| 12 |
class AsmEditor; |
| 13 |
class QAction; |
| 14 |
class QComboBox; |
| 15 |
class QLineEdit; |
| 16 |
class QPlainTextEdit; |
| 17 |
class QPushButton; |
| 18 |
class QTextEdit; |
| 19 |
class QToolBar; |
| 20 |
|
| 21 |
namespace Core |
| 22 |
{ |
| 23 |
class System; |
| 24 |
} |
| 25 |
|
| 26 |
class AssemblerWidget : public QDockWidget |
| 27 |
{ |
| 28 |
Q_OBJECT |
| 29 |
public: |
| 30 |
explicit AssemblerWidget(QWidget* parent); |
| 31 |
|
| 32 |
bool ApplicationCloseRequest(); |
| 33 |
|
| 34 |
~AssemblerWidget() override; |
| 35 |
|
| 36 |
protected: |
| 37 |
void closeEvent(QCloseEvent*) override; |
| 38 |
|
| 39 |
private: |
| 40 |
enum class AsmKind |
| 41 |
{ |
| 42 |
Raw, |
| 43 |
ActionReplay, |
| 44 |
Gecko, |
| 45 |
GeckoExec, |
| 46 |
GeckoTrampoline |
| 47 |
}; |
| 48 |
static constexpr int OUTPUT_BOX_WIDTH = 18; |
| 49 |
void CreateWidgets(); |
| 50 |
void ConnectWidgets(); |
| 51 |
|
| 52 |
void OnEditChanged(); |
| 53 |
|
| 54 |
void OnAssemble(std::vector<Common::GekkoAssembler::CodeBlock>* asm_out); |
| 55 |
void OnCopyOutput(); |
| 56 |
void OnOpen(); |
| 57 |
void OnNew(); |
| 58 |
void OnInject(); |
| 59 |
void OnSave(); |
| 60 |
void OnZoomIn(); |
| 61 |
void OnZoomOut(); |
| 62 |
void OnZoomReset(); |
| 63 |
void OnBaseAddressChanged(); |
| 64 |
void OnTabChange(int index); |
| 65 |
QString TabTextForEditor(AsmEditor* editor, bool with_dirty); |
| 66 |
AsmEditor* GetEditor(int idx); |
| 67 |
void NewEditor(const QString& path = QStringLiteral()); |
| 68 |
bool SaveEditor(AsmEditor* editor); |
| 69 |
void OnEmulationStateChanged(Core::State state); |
| 70 |
void OnTabClose(int index); |
| 71 |
void CloseTab(int index, AsmEditor* editor); |
| 72 |
int AllocateTabNum(); |
| 73 |
void FreeTabNum(int num); |
| 74 |
void UpdateTabText(AsmEditor* editor); |
| 75 |
void DisambiguateTabTitles(AsmEditor* editor); |
| 76 |
void UpdateIcons(); |
| 77 |
void ZoomAllEditors(int amount); |
| 78 |
|
| 79 |
static constexpr int INVALID_EDITOR_NUM = -1; |
| 80 |
|
| 81 |
Core::System& m_system; |
| 82 |
|
| 83 |
QTabWidget* m_asm_tabs; |
| 84 |
QPlainTextEdit* m_output_box; |
| 85 |
QComboBox* m_output_type; |
| 86 |
QPushButton* m_copy_output_button; |
| 87 |
QTextEdit* m_error_box; |
| 88 |
QLineEdit* m_address_line; |
| 89 |
QToolBar* m_toolbar; |
| 90 |
QAction* m_open; |
| 91 |
QAction* m_new; |
| 92 |
QAction* m_assemble; |
| 93 |
QAction* m_inject; |
| 94 |
QAction* m_save; |
| 95 |
|
| 96 |
std::list<int> m_free_editor_nums; |
| 97 |
int m_unnamed_editor_count; |
| 98 |
int m_net_zoom_delta; |
| 99 |
bool m_dark_scheme; |
| 100 |
}; |