Adding logic to graphics bank manipulation.
This commit is contained in:
@@ -21,7 +21,7 @@
|
||||
|
||||
The following items are being tracked here because otherwise they'd be forgotten:
|
||||
|
||||
- [x] Add folders to project panel and support loading different file types (headers, etc.)
|
||||
- [X] Add folders to project panel and support loading different file types (headers, etc.)
|
||||
- [ ] Finish Code Editor lexer for syntax highlights.
|
||||
- It's still a bit buggy with highlighting numbers in label references.
|
||||
- It incorrectly comment-highlights ;'s in "'s.
|
||||
@@ -35,13 +35,13 @@ The following items are being tracked here because otherwise they'd be forgotten
|
||||
or because they were pulled in by the build.
|
||||
- [ ] Figure out how to adjust lines of errors, breakpoints, and symbol lookups...probably have to do background compilation.
|
||||
- [ ] Extend drag-drop capability to allow adding source files (use specified extensions to check) to a project.
|
||||
- [x] Project still does not get cleared out properly when a ROM is loaded after a project has been loaded. Saving the "project" overwrites it with crap.
|
||||
- [x] Execution Visualizer doesn't open file for address that's clicked on and doesn't bring that file to view in the project.
|
||||
- [x] Somehow tabs aren't being removed from the Window menu.
|
||||
- [X] Project still does not get cleared out properly when a ROM is loaded after a project has been loaded. Saving the "project" overwrites it with crap.
|
||||
- [X] Execution Visualizer doesn't open file for address that's clicked on and doesn't bring that file to view in the project.
|
||||
- [X] Somehow tabs aren't being removed from the Window menu.
|
||||
- [ ] Add option to automatically assign names of new elements added to a project based on what they are instead of asking all the time.
|
||||
- [x] Implement "modes" of the UI. "Coding" mode would close all opened debug windows and emulator windows, allowing most screen real-estate for coding. "Debugging". Alternatively this could just be a "remove clutter" button somewhere prominent in the UI that has the same effect.
|
||||
- [ ] Fix emulator window disappearing on project reload and debug mode switch.
|
||||
- [x] Limit symbol watch debug updates to only the symbols in the currently visible tab in the symbol watch window. Makes no sense to update the values of the RAM symbols if the watch tab is selected. Updating of symbols on a non-visible tab can be done in the tab change handler.
|
||||
- [X] Implement "modes" of the UI. "Coding" mode would close all opened debug windows and emulator windows, allowing most screen real-estate for coding. "Debugging". Alternatively this could just be a "remove clutter" button somewhere prominent in the UI that has the same effect.
|
||||
- [X] Fix emulator window disappearing on project reload and debug mode switch.
|
||||
- [X] Limit symbol watch debug updates to only the symbols in the currently visible tab in the symbol watch window. Makes no sense to update the values of the RAM symbols if the watch tab is selected. Updating of symbols on a non-visible tab can be done in the tab change handler.
|
||||
- [ ] Add OpenGL monospace font for overlays for Execution Visualizer, Code/Data Logger, maybe other viewers, and Emulator [with Lua capabilities?]
|
||||
- [ ] Rework CCC65Interface object so that it creates Symbol structures containing all of the relevant information for each symbol in easy-to-access means, rather than using individual CCC65Interface methods to retrieve different pieces of information about symbols all the time. The symbol structures can be built whenever a debug file is loaded, which is either when a project is loaded or when a compile is completed. CCC65Interface::captureDebugInfo.
|
||||
- [ ] Move linker config file into Project Browser folder. Project Properties can still specify the linker config file name, perhaps, but should not contain the linker config file content.
|
||||
@@ -55,7 +55,7 @@ or because they were pulled in by the build.
|
||||
- [ ] Editors should be detachable
|
||||
- [X] Some glitches in long term use, probably related to OpenGL misuse. Find an OpenGL debugger?
|
||||
This included some weird switching of contexts from one widget to another, such as from exevis to emu, etc.
|
||||
- [ ] Should have option to set both start/end of execution visualization markers with one command
|
||||
- [X] Should have option to set both start/end of execution visualization markers with one command
|
||||
- [X] Should have option to remove ALL breakpoints
|
||||
- [ ] Removing execution visualizer markers by line(s) of selected code only, not just ALL
|
||||
- [ ] Alpha-blend of execution markers on visual instead of replace
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "cdockwidgetregistry.h"
|
||||
#include "ccc65interface.h"
|
||||
|
||||
#include "cprojecttreeopenaction.h"
|
||||
#include "model/projectsearcher.h"
|
||||
|
||||
#include "main.h"
|
||||
@@ -18,6 +19,11 @@ CProjectTabWidget::CProjectTabWidget(QWidget *parent) :
|
||||
tabBar()->setVisible(EnvironmentSettingsDialog::useTabBarInEditorArea());
|
||||
}
|
||||
|
||||
void CProjectTabWidget::setProjectModel(CProjectModel *model)
|
||||
{
|
||||
m_pProjectModel = model;
|
||||
}
|
||||
|
||||
bool CProjectTabWidget::eventFilter(QObject *object, QEvent *event)
|
||||
{
|
||||
if ( object == tabBar() )
|
||||
@@ -243,6 +249,8 @@ void CProjectTabWidget::snapToTab(QString item)
|
||||
uint32_t addr;
|
||||
uint32_t absAddr;
|
||||
QList<CSourceItem*> sources = ProjectSearcher::findItemsOfType<CSourceItem>(nesicideProject);
|
||||
QList<CGraphicsBank*> gfxBanks = ProjectSearcher::findItemsOfType<CGraphicsBank>(nesicideProject);
|
||||
QList<CTileStamp*> tileStamps = ProjectSearcher::findItemsOfType<CTileStamp>(nesicideProject);
|
||||
bool found = false;
|
||||
bool open = false;
|
||||
QDir dir;
|
||||
@@ -254,6 +262,7 @@ void CProjectTabWidget::snapToTab(QString item)
|
||||
QString symbol;
|
||||
CDesignerEditorBase* editor = NULL;
|
||||
|
||||
qDebug(item.toUtf8().data());
|
||||
// Make sure item is something we care about
|
||||
if ( item.startsWith("Address,") )
|
||||
{
|
||||
@@ -318,12 +327,8 @@ void CProjectTabWidget::snapToTab(QString item)
|
||||
// File is not open, search the project.
|
||||
if ( !found )
|
||||
{
|
||||
IProjectTreeViewItem* treeItem;
|
||||
treeItem = findProjectItem(uuid);
|
||||
if ( treeItem )
|
||||
{
|
||||
treeItem->openItemEvent(this);
|
||||
}
|
||||
CProjectTreeOpenAction action(this, m_pProjectModel);
|
||||
m_pProjectModel->visitDataItem(uuid, action);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -365,6 +370,32 @@ void CProjectTabWidget::snapToTab(QString item)
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( !found )
|
||||
{
|
||||
foreach ( CGraphicsBank* source, gfxBanks )
|
||||
{
|
||||
if ( source->caption() == file )
|
||||
{
|
||||
source->openItemEvent(this);
|
||||
found = true;
|
||||
open = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( !found )
|
||||
{
|
||||
foreach ( CTileStamp* source, tileStamps )
|
||||
{
|
||||
if ( source->caption() == file )
|
||||
{
|
||||
source->openItemEvent(this);
|
||||
found = true;
|
||||
open = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If we got here we can't find the file in the project, search the project
|
||||
// directory.
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
#include <QToolBar>
|
||||
#include <QDockWidget>
|
||||
|
||||
#include "model/cprojectmodel.h"
|
||||
|
||||
// The IDE uses a system of signals named "snapTo" and "snapToTab" to
|
||||
// communicate information between various debuggers, IDE elements, or
|
||||
// designer forms when things change in the IDE environment that the
|
||||
@@ -36,7 +38,7 @@
|
||||
// As the snapTo usage is expanded I'll try to remember to document its usage
|
||||
// and formats here.
|
||||
//
|
||||
// snapTo formats: emit snapTo(<string>) where <string is one of:
|
||||
// snapTo formats: emit snapTo(<string>) where <string> is one of:
|
||||
// OutputPaneFile,<file>,<line>
|
||||
// Sent from the output pane in response to the user clicking on a line of
|
||||
// a search result or an error in a compile log. This tells the other IDE
|
||||
@@ -76,6 +78,8 @@ public:
|
||||
int addTab(QWidget *page, const QIcon &icon, const QString &label);
|
||||
void removeTab(int index);
|
||||
|
||||
void setProjectModel(CProjectModel* model);
|
||||
|
||||
protected:
|
||||
void tabBar_contextMenuEvent(QContextMenuEvent *event);
|
||||
void tabBar_mouseMoveEvent(QMouseEvent* event);
|
||||
@@ -113,7 +117,8 @@ public slots:
|
||||
void applyAppSettings();
|
||||
|
||||
protected:
|
||||
QMap<QString,QWidget*> tearOffs;
|
||||
QMap<QString,QWidget*> tearOffs;
|
||||
CProjectModel *m_pProjectModel;
|
||||
};
|
||||
|
||||
#endif // CPROJECTTABWIDGET_H
|
||||
|
||||
@@ -336,6 +336,8 @@ MainWindow::MainWindow(CProjectModel *projectModel, QWidget* parent) :
|
||||
m_pProjectBrowser->hide();
|
||||
CDockWidgetRegistry::instance()->addWidget ( "Project Browser", m_pProjectBrowser );
|
||||
|
||||
tabWidget->setProjectModel(m_pProjectModel);
|
||||
|
||||
// expandableStatusBar = new CExpandableStatusBar();
|
||||
// appStatusBar->insertWidget(0, expandableStatusBar, 100); // Stretch is big to allow it to stretch across app pane.
|
||||
|
||||
|
||||
@@ -20,6 +20,8 @@ bool CGraphicsAssembler::assemble()
|
||||
QDir outputDir(nesicideProject->getProjectCHRROMOutputBasePath());
|
||||
QString outputName;
|
||||
QFile chrRomFile;
|
||||
int bankSize;
|
||||
int currentSize;
|
||||
|
||||
// Make sure directory exists...
|
||||
if ( !outputDir.exists() )
|
||||
@@ -48,6 +50,9 @@ bool CGraphicsAssembler::assemble()
|
||||
{
|
||||
CGraphicsBank* curGfxBank = gfxBanks->getGraphicsBanks().at(gfxBankIdx);
|
||||
|
||||
bankSize = curGfxBank->getSize();
|
||||
currentSize = 0;
|
||||
|
||||
buildTextLogger->write("Constructing '" + curGfxBank->caption() + "':");
|
||||
|
||||
if ( curGfxBank->getGraphics().count() )
|
||||
@@ -58,7 +63,14 @@ bool CGraphicsAssembler::assemble()
|
||||
IProjectTreeViewItem* ptvi = dynamic_cast<IProjectTreeViewItem*>(bankItem);
|
||||
buildTextLogger->write(" Adding: "+ptvi->caption()+"("+QString::number(bankItem->getChrRomBankItemSize())+" bytes)");
|
||||
|
||||
chrRomFile.write(bankItem->getChrRomBankItemData().data(), bankItem->getChrRomBankItemSize());
|
||||
QByteArray bankItemData = bankItem->getChrRomBankItemData();
|
||||
currentSize += bankItemData.count();
|
||||
if ( currentSize > bankSize )
|
||||
{
|
||||
buildTextLogger->write("<font color='red'>"+curGfxBank->caption()+"("+QString::number(bankSize)+"): Warning: too much data for specified size</font>");
|
||||
bankItemData.truncate(bankSize);
|
||||
}
|
||||
chrRomFile.write(bankItemData.data(), bankItemData.count());
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
#include "main.h"
|
||||
|
||||
static const char* CLICK_TO_ADD_OR_EDIT = "<click to add or edit>";
|
||||
static const char* CLICK_TO_ADD = "<click to add>";
|
||||
|
||||
CChrRomItemTableDisplayModel::CChrRomItemTableDisplayModel(bool editable,QObject* /*parent*/)
|
||||
{
|
||||
@@ -98,7 +98,7 @@ QVariant CChrRomItemTableDisplayModel::data(const QModelIndex& index, int role)
|
||||
|
||||
if ( index.column() == ChrRomBankItemCol_Name )
|
||||
{
|
||||
return QVariant(CLICK_TO_ADD_OR_EDIT);
|
||||
return QVariant(CLICK_TO_ADD);
|
||||
}
|
||||
}
|
||||
return QVariant();
|
||||
@@ -182,7 +182,7 @@ bool CChrRomItemTableDisplayModel::setData ( const QModelIndex& index, const QVa
|
||||
else
|
||||
{
|
||||
if ( (!value.toString().isEmpty()) &&
|
||||
(value != CLICK_TO_ADD_OR_EDIT) )
|
||||
(value != CLICK_TO_ADD) )
|
||||
{
|
||||
beginInsertRows(QModelIndex(),chrRomBankItems.count()+1,chrRomBankItems.count()+1);
|
||||
chrRomBankItems.append(item);
|
||||
|
||||
@@ -18,7 +18,9 @@ QWidget* CChrRomBankItemDelegate::createEditor(QWidget* parent,
|
||||
{
|
||||
QComboBox* editor = new QComboBox(parent);
|
||||
|
||||
editor->setEditable(true);
|
||||
//CP: I think originally I was going to let people type in objects but
|
||||
// that's just confusing as the drop-down disappears on double click.
|
||||
//editor->setEditable(true);
|
||||
|
||||
return editor;
|
||||
}
|
||||
|
||||
@@ -66,8 +66,9 @@ GraphicsBankEditorForm::GraphicsBankEditorForm(uint32_t size, QList<IChrRomBankI
|
||||
ui->bankSize->setItemData(3,MEM_1KB);
|
||||
if ( size == MEM_1KB ) ui->bankSize->setCurrentIndex(3);
|
||||
|
||||
QObject::connect(model,SIGNAL(rowsInserted(QModelIndex,int,int)),this,SLOT(updateUi()));
|
||||
QObject::connect(model,SIGNAL(layoutChanged()),this,SLOT(updateUi()));
|
||||
QObject::connect(model,SIGNAL(rowsInserted(QModelIndex,int,int)),this,SLOT(updateList()));
|
||||
QObject::connect(model,SIGNAL(layoutChanged()),this,SLOT(updateList()));
|
||||
QObject::connect(ui->tableView,SIGNAL(doubleClicked(QModelIndex)),this,SLOT(tableView_doubleClicked(QModelIndex)));
|
||||
}
|
||||
|
||||
GraphicsBankEditorForm::~GraphicsBankEditorForm()
|
||||
@@ -117,6 +118,17 @@ bool GraphicsBankEditorForm::eventFilter(QObject* obj,QEvent* event)
|
||||
return false;
|
||||
}
|
||||
|
||||
void GraphicsBankEditorForm::tableView_doubleClicked(QModelIndex index)
|
||||
{
|
||||
if ( (index.row() >= 0) && (index.row() < bankItems().count()) )
|
||||
{
|
||||
IChrRomBankItem* pChrItem = bankItems().at(index.row());
|
||||
IProjectTreeViewItem* pProjItem = dynamic_cast<IProjectTreeViewItem*>(pChrItem);
|
||||
|
||||
emit snapToTab("Tile,"+pProjItem->uuid());
|
||||
}
|
||||
}
|
||||
|
||||
void GraphicsBankEditorForm::renderer_enterEvent(QEvent */*event*/)
|
||||
{
|
||||
int pixx;
|
||||
@@ -150,6 +162,13 @@ void GraphicsBankEditorForm::renderer_mouseMoveEvent(QMouseEvent */*event*/)
|
||||
}
|
||||
}
|
||||
|
||||
void GraphicsBankEditorForm::updateList()
|
||||
{
|
||||
updateUi();
|
||||
setModified(true);
|
||||
emit markProjectDirty(true);
|
||||
}
|
||||
|
||||
void GraphicsBankEditorForm::updateUi()
|
||||
{
|
||||
int idx;
|
||||
@@ -224,22 +243,19 @@ void GraphicsBankEditorForm::updateChrRomBankItemList(QList<IChrRomBankItem*> ba
|
||||
|
||||
if ( bankItems != model->bankItems() )
|
||||
{
|
||||
setModified(true);
|
||||
emit markProjectDirty(true);
|
||||
model->setBankItems(bankItems);
|
||||
model->update();
|
||||
ui->tableView->resizeRowsToContents();
|
||||
|
||||
emit prepareToTilify();
|
||||
|
||||
for (idx = 0; idx < bankItems.count(); idx++ )
|
||||
{
|
||||
emit addToTilificator(bankItems.at(idx));
|
||||
}
|
||||
|
||||
emit tilify();
|
||||
}
|
||||
|
||||
model->setBankItems(bankItems);
|
||||
model->update();
|
||||
ui->tableView->resizeRowsToContents();
|
||||
|
||||
emit prepareToTilify();
|
||||
|
||||
for (idx = 0; idx < bankItems.count(); idx++ )
|
||||
{
|
||||
emit addToTilificator(bankItems.at(idx));
|
||||
}
|
||||
|
||||
emit tilify();
|
||||
}
|
||||
|
||||
void GraphicsBankEditorForm::renderData(QByteArray output)
|
||||
@@ -249,20 +265,18 @@ void GraphicsBankEditorForm::renderData(QByteArray output)
|
||||
|
||||
ui->gauge->setValue(output.count());
|
||||
QPalette p = ui->gauge->palette();
|
||||
QString danger = "QProgressBar::chunk {background: QLinearGradient( x1: 0, y1: 0, x2: 1, y2: 0,stop: 0 #FF0350,stop: 0.4999 #FF0020,stop: 0.5 #FF0019,stop: 1 #FF0000 );border-bottom-right-radius: 5px;border-bottom-left-radius: 5px;border: .px solid black;}";
|
||||
QString safe= "QProgressBar::chunk {background: QLinearGradient( x1: 0, y1: 0, x2: 1, y2: 0,stop: 0 #78d,stop: 0.4999 #46a,stop: 0.5 #45a,stop: 1 #238 );border-bottom-right-radius: 7px;border-bottom-left-radius: 7px;border: 1px solid black;}";
|
||||
if ( output.count() > max )
|
||||
{
|
||||
ui->gauge->setValue(max);
|
||||
ui->gauge->setStyleSheet("QProgressBar::chunk {background: #ff0000;}");
|
||||
ui->gauge->setStyleSheet("QProgressBar::chunk {background: #ff0000;border-top-right-radius: 5px;border-top-left-radius: 5px;border-bottom-right-radius: 5px;border-bottom-left-radius: 5px;border: .px solid black;}");
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->gauge->setStyleSheet("QProgressBar::chunk {background: #00ff00;}");
|
||||
ui->gauge->setStyleSheet("QProgressBar::chunk {background: #00ff00;border-top-right-radius: 5px;border-top-left-radius: 5px;border-bottom-right-radius: 5px;border-bottom-left-radius: 5px;border: .px solid black;}");
|
||||
}
|
||||
ui->gauge->setPalette(p);
|
||||
|
||||
// Pad to 8KB.
|
||||
// Pad to boundary-KB.
|
||||
for ( idx = output.count(); idx < max; idx++ )
|
||||
{
|
||||
output.append((char)0);
|
||||
@@ -282,16 +296,31 @@ void GraphicsBankEditorForm::renderData()
|
||||
unsigned char colorIdx;
|
||||
QColor color[4];
|
||||
IChrRomBankItem* item;
|
||||
int x, y, maxx, maxy;
|
||||
int max = ui->bankSize->itemData(ui->bankSize->currentIndex()).toInt();
|
||||
|
||||
color[0] = renderer->getColor(0);
|
||||
color[1] = renderer->getColor(1);
|
||||
color[2] = renderer->getColor(2);
|
||||
color[3] = renderer->getColor(3);
|
||||
|
||||
for (int y = 0; y < 128; y++)
|
||||
maxx = (max==MEM_8KB)?256:128;
|
||||
maxy = (max>=MEM_4KB)?128:(max==MEM_2KB)?64:32;
|
||||
|
||||
for (y = 0; y < 128; y++)
|
||||
{
|
||||
for (int x = 0; x < 256; x += 8)
|
||||
for (x = 0; x < 256; x += 8)
|
||||
{
|
||||
if ( (y >= maxy) || (x >= maxx) )
|
||||
{
|
||||
for ( int xf = 0; xf < 8; xf++ )
|
||||
{
|
||||
imgData[((y<<8)<<2) + (x<<2) + (xf<<2) + 0] = 0xaa;
|
||||
imgData[((y<<8)<<2) + (x<<2) + (xf<<2) + 1] = 0xaa;
|
||||
imgData[((y<<8)<<2) + (x<<2) + (xf<<2) + 2] = 0xaa;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
ppuAddr = ((y>>3)<<8)+((x&0x7F)<<1)+(y&0x7);
|
||||
|
||||
if ( x >= 128 )
|
||||
|
||||
@@ -40,6 +40,7 @@ protected:
|
||||
void renderer_enterEvent(QEvent* event);
|
||||
void renderer_leaveEvent(QEvent* event);
|
||||
void renderer_mouseMoveEvent(QMouseEvent *event);
|
||||
void updateUi();
|
||||
|
||||
private:
|
||||
Ui::GraphicsBankEditorForm* ui;
|
||||
@@ -54,7 +55,7 @@ private:
|
||||
private slots:
|
||||
void renderData();
|
||||
void renderData(QByteArray output);
|
||||
void updateUi();
|
||||
void updateList();
|
||||
void snapTo(QString item);
|
||||
void applyChangesToTab(QString uuid);
|
||||
void applyProjectPropertiesToTab();
|
||||
@@ -65,6 +66,7 @@ private slots:
|
||||
void on_moveDown_clicked();
|
||||
|
||||
void on_bankSize_currentIndexChanged(int index);
|
||||
void tableView_doubleClicked(QModelIndex index);
|
||||
|
||||
signals:
|
||||
void prepareToTilify();
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
#include "model/ctilestampmodel.h"
|
||||
#include "model/cmusicmodel.h"
|
||||
|
||||
CProjectTreeOpenAction::CProjectTreeOpenAction(CProjectTabWidget *tabWidget, QTreeWidget *openItems, CProjectModel *project)
|
||||
: m_tabWidget(tabWidget), m_openItems(openItems), m_project(project)
|
||||
CProjectTreeOpenAction::CProjectTreeOpenAction(CProjectTabWidget *tabWidget, CProjectModel *project)
|
||||
: m_tabWidget(tabWidget), m_project(project)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ class CProjectTreeOpenAction : public QObject, public IUuidVisitor
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
CProjectTreeOpenAction(CProjectTabWidget* tabWidget, QTreeWidget* openItems, CProjectModel* project);
|
||||
CProjectTreeOpenAction(CProjectTabWidget* tabWidget, CProjectModel* project);
|
||||
|
||||
virtual void visit(CUuid&);
|
||||
virtual void visit(CAttributeUuid&);
|
||||
@@ -29,7 +29,6 @@ public:
|
||||
|
||||
private:
|
||||
CProjectTabWidget* m_tabWidget;
|
||||
QTreeWidget* m_openItems;
|
||||
CProjectModel* m_project;
|
||||
|
||||
void doVisit(CSubModel* model, const QUuid& uuid);
|
||||
|
||||
@@ -304,7 +304,7 @@ void ProjectBrowserDockWidget::treeWidgetContextMenuRequested(QPoint pos)
|
||||
void ProjectBrowserDockWidget::openNewProjectItem(QUuid uuid)
|
||||
{
|
||||
int oldOpenItemCount = ui->openProjectItems->topLevelItemCount();
|
||||
CProjectTreeOpenAction action(m_pTarget, ui->openProjectItems, m_pProjectModel);
|
||||
CProjectTreeOpenAction action(m_pTarget, m_pProjectModel);
|
||||
m_pProjectModel->visitDataItem(uuid, action);
|
||||
|
||||
// If a new item has been opened, select it.
|
||||
|
||||
Reference in New Issue
Block a user