add open script button next to script labels
This commit is contained in:
parent
582405d68b
commit
43960d4e9e
8 changed files with 103 additions and 200 deletions
|
@ -107,6 +107,7 @@ public:
|
||||||
bool hasUnsavedChanges();
|
bool hasUnsavedChanges();
|
||||||
bool isWithinBounds(int x, int y);
|
bool isWithinBounds(int x, int y);
|
||||||
bool isWithinBorderBounds(int x, int y);
|
bool isWithinBorderBounds(int x, int y);
|
||||||
|
void openScript(QString label);
|
||||||
|
|
||||||
MapPixmapItem *mapItem = nullptr;
|
MapPixmapItem *mapItem = nullptr;
|
||||||
void setMapItem(MapPixmapItem *item) { mapItem = item; }
|
void setMapItem(MapPixmapItem *item) { mapItem = item; }
|
||||||
|
@ -127,6 +128,7 @@ signals:
|
||||||
void mapChanged(Map *map);
|
void mapChanged(Map *map);
|
||||||
void mapDimensionsChanged(const QSize &size);
|
void mapDimensionsChanged(const QSize &size);
|
||||||
void mapNeedsRedrawing();
|
void mapNeedsRedrawing();
|
||||||
|
void openScriptRequested(QString label);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MAP_H
|
#endif // MAP_H
|
||||||
|
|
|
@ -97,7 +97,6 @@ public:
|
||||||
void selectMapEvent(DraggablePixmapItem *object);
|
void selectMapEvent(DraggablePixmapItem *object);
|
||||||
void selectMapEvent(DraggablePixmapItem *object, bool toggle);
|
void selectMapEvent(DraggablePixmapItem *object, bool toggle);
|
||||||
DraggablePixmapItem *addNewEvent(Event::Type type);
|
DraggablePixmapItem *addNewEvent(Event::Type type);
|
||||||
void deleteEvent(Event *);
|
|
||||||
void updateSelectedEvents();
|
void updateSelectedEvents();
|
||||||
void duplicateSelectedEvents();
|
void duplicateSelectedEvents();
|
||||||
void redrawObject(DraggablePixmapItem *item);
|
void redrawObject(DraggablePixmapItem *item);
|
||||||
|
@ -105,6 +104,8 @@ public:
|
||||||
void updateCursorRectPos(int x, int y);
|
void updateCursorRectPos(int x, int y);
|
||||||
void setCursorRectVisible(bool visible);
|
void setCursorRectVisible(bool visible);
|
||||||
|
|
||||||
|
bool eventLimitReached(Map *, Event::Type);
|
||||||
|
|
||||||
QGraphicsScene *scene = nullptr;
|
QGraphicsScene *scene = nullptr;
|
||||||
QGraphicsPixmapItem *current_view = nullptr;
|
QGraphicsPixmapItem *current_view = nullptr;
|
||||||
MapPixmapItem *map_item = nullptr;
|
MapPixmapItem *map_item = nullptr;
|
||||||
|
|
|
@ -325,8 +325,6 @@ private:
|
||||||
DraggablePixmapItem *selectedBG;
|
DraggablePixmapItem *selectedBG;
|
||||||
DraggablePixmapItem *selectedHealspot;
|
DraggablePixmapItem *selectedHealspot;
|
||||||
|
|
||||||
QVector<QToolButton *> openScriptButtons;
|
|
||||||
|
|
||||||
bool isProgrammaticEventTabChange;
|
bool isProgrammaticEventTabChange;
|
||||||
bool projectHasUnsavedChanges;
|
bool projectHasUnsavedChanges;
|
||||||
bool projectOpenFailure = false;
|
bool projectOpenFailure = false;
|
||||||
|
|
|
@ -76,6 +76,7 @@ public:
|
||||||
NoScrollSpinBox *spinner_radius_x;
|
NoScrollSpinBox *spinner_radius_x;
|
||||||
NoScrollSpinBox *spinner_radius_y;
|
NoScrollSpinBox *spinner_radius_y;
|
||||||
NoScrollComboBox *combo_script;
|
NoScrollComboBox *combo_script;
|
||||||
|
QToolButton *button_script;
|
||||||
NoScrollComboBox *combo_flag;
|
NoScrollComboBox *combo_flag;
|
||||||
NoScrollComboBox *combo_trainer_type;
|
NoScrollComboBox *combo_trainer_type;
|
||||||
NoScrollComboBox *combo_radius_treeid;
|
NoScrollComboBox *combo_radius_treeid;
|
||||||
|
|
|
@ -340,6 +340,10 @@ void Map::setBorderDimensions(int newWidth, int newHeight, bool setNewBlockdata,
|
||||||
emit mapChanged(this);
|
emit mapChanged(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Map::openScript(QString label) {
|
||||||
|
emit openScriptRequested(label);
|
||||||
|
}
|
||||||
|
|
||||||
bool Map::getBlock(int x, int y, Block *out) {
|
bool Map::getBlock(int x, int y, Block *out) {
|
||||||
if (isWithinBounds(x, y)) {
|
if (isWithinBounds(x, y)) {
|
||||||
int i = y * getWidth() + x;
|
int i = y * getWidth() + x;
|
||||||
|
|
|
@ -1092,6 +1092,12 @@ bool Editor::setMap(QString map_name) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// disconnect previous map's signals so they are not firing
|
||||||
|
// multiple times if set again in the future
|
||||||
|
if (map) {
|
||||||
|
map->disconnect(this);
|
||||||
|
}
|
||||||
|
|
||||||
if (project) {
|
if (project) {
|
||||||
Map *loadedMap = project->loadMap(map_name);
|
Map *loadedMap = project->loadMap(map_name);
|
||||||
if (!loadedMap) {
|
if (!loadedMap) {
|
||||||
|
@ -1108,6 +1114,7 @@ bool Editor::setMap(QString map_name) {
|
||||||
}
|
}
|
||||||
map_ruler->setMapDimensions(QSize(map->getWidth(), map->getHeight()));
|
map_ruler->setMapDimensions(QSize(map->getWidth(), map->getHeight()));
|
||||||
connect(map, &Map::mapDimensionsChanged, map_ruler, &MapRuler::setMapDimensions);
|
connect(map, &Map::mapDimensionsChanged, map_ruler, &MapRuler::setMapDimensions);
|
||||||
|
connect(map, &Map::openScriptRequested, this, &Editor::openScript);
|
||||||
updateSelectedEvents();
|
updateSelectedEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2130,19 +2137,6 @@ bool Editor::eventLimitReached(Event::Type event_type) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Editor::deleteEvent(Event *event) {
|
|
||||||
Map *map = event->getMap();
|
|
||||||
if (map) {
|
|
||||||
map->removeEvent(event);
|
|
||||||
if (event->getPixmapItem()) {
|
|
||||||
events_group->removeFromGroup(event->getPixmapItem());
|
|
||||||
delete event->getPixmapItem();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//selected_events->removeAll(event);
|
|
||||||
//updateSelectedObjects();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Editor::openMapScripts() const {
|
void Editor::openMapScripts() const {
|
||||||
const QString scriptPath = project->getMapScriptsFilePath(map->name);
|
const QString scriptPath = project->getMapScriptsFilePath(map->name);
|
||||||
openInTextEditor(scriptPath);
|
openInTextEditor(scriptPath);
|
||||||
|
|
|
@ -1632,14 +1632,14 @@ void MainWindow::paste() {
|
||||||
Event *pasteEvent = nullptr;
|
Event *pasteEvent = nullptr;
|
||||||
|
|
||||||
Event::Type type = Event::eventTypeFromString(event["event_type"].toString());
|
Event::Type type = Event::eventTypeFromString(event["event_type"].toString());
|
||||||
if (editor->eventLimitReached(type)) {
|
|
||||||
logWarn(QString("Skipping paste, the map limit for events of type '%1' has been reached.").arg(event["event_type"].toString()));
|
if (this->editor->eventLimitReached(type)) {
|
||||||
continue;
|
logWarn(QString("Cannot paste event, the limit for type '%1' has been reached.").arg(event["event_type"].toString()));
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case Event::Type::Object:
|
case Event::Type::Object:
|
||||||
// TODO: check event limit?
|
|
||||||
pasteEvent = new ObjectEvent();
|
pasteEvent = new ObjectEvent();
|
||||||
pasteEvent->loadFromJson(event["event"].toObject(), this->editor->project);
|
pasteEvent->loadFromJson(event["event"].toObject(), this->editor->project);
|
||||||
break;
|
break;
|
||||||
|
@ -1936,7 +1936,6 @@ void MainWindow::updateObjects() {
|
||||||
updateSelectedObjects();
|
updateSelectedObjects();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Should probably just pass layout and let the editor work it out
|
|
||||||
void MainWindow::updateSelectedObjects() {
|
void MainWindow::updateSelectedObjects() {
|
||||||
// TODO: make events and/or frames list static? don't want to clear and
|
// TODO: make events and/or frames list static? don't want to clear and
|
||||||
// re-add children frames if they are already there in a multi-select
|
// re-add children frames if they are already there in a multi-select
|
||||||
|
@ -1960,60 +1959,67 @@ void MainWindow::updateSelectedObjects() {
|
||||||
QScrollArea *scrollTarget = ui->scrollArea_Multiple;
|
QScrollArea *scrollTarget = ui->scrollArea_Multiple;
|
||||||
QWidget *target = ui->scrollAreaWidgetContents_Multiple;
|
QWidget *target = ui->scrollAreaWidgetContents_Multiple;
|
||||||
|
|
||||||
isProgrammaticEventTabChange = true;
|
this->isProgrammaticEventTabChange = true;
|
||||||
|
|
||||||
if (events.length() == 1) {
|
if (events.length() == 1) {
|
||||||
|
// single selected event case
|
||||||
Event *current = events[0]->event;
|
Event *current = events[0]->event;
|
||||||
Event::Group event_group_type = current->getEventGroup();
|
Event::Group eventGroup = current->getEventGroup();
|
||||||
int event_offs = Event::getIndexOffset(event_group_type);
|
int event_offs = Event::getIndexOffset(eventGroup);
|
||||||
|
|
||||||
// TODO: use switch
|
switch (eventGroup) {
|
||||||
// TODO: don't need to set min/max every time, just when changing number of events in the group
|
case Event::Group::Object: {
|
||||||
if (event_group_type == Event::Group::Object) {
|
|
||||||
scrollTarget = ui->scrollArea_Objects;
|
scrollTarget = ui->scrollArea_Objects;
|
||||||
target = ui->scrollAreaWidgetContents_Objects;
|
target = ui->scrollAreaWidgetContents_Objects;
|
||||||
ui->tabWidget_EventType->setCurrentWidget(ui->tab_Objects);
|
ui->tabWidget_EventType->setCurrentWidget(ui->tab_Objects);
|
||||||
|
|
||||||
this->ui->spinner_ObjectID->setValue(current->getEventIndex() + event_offs);
|
this->ui->spinner_ObjectID->setValue(current->getEventIndex() + event_offs);
|
||||||
this->ui->spinner_ObjectID->setMinimum(event_offs);
|
this->ui->spinner_ObjectID->setMinimum(event_offs);
|
||||||
this->ui->spinner_ObjectID->setMaximum(current->getMap()->events.value(event_group_type).length() + event_offs - 1);
|
this->ui->spinner_ObjectID->setMaximum(current->getMap()->events.value(eventGroup).length() + event_offs - 1);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
else if (event_group_type == Event::Group::Warp) {
|
case Event::Group::Warp: {
|
||||||
scrollTarget = ui->scrollArea_Warps;
|
scrollTarget = ui->scrollArea_Warps;
|
||||||
target = ui->scrollAreaWidgetContents_Warps;
|
target = ui->scrollAreaWidgetContents_Warps;
|
||||||
ui->tabWidget_EventType->setCurrentWidget(ui->tab_Warps);
|
ui->tabWidget_EventType->setCurrentWidget(ui->tab_Warps);
|
||||||
|
|
||||||
this->ui->spinner_WarpID->setValue(current->getEventIndex() + event_offs);
|
this->ui->spinner_WarpID->setValue(current->getEventIndex() + event_offs);
|
||||||
this->ui->spinner_WarpID->setMinimum(event_offs);
|
this->ui->spinner_WarpID->setMinimum(event_offs);
|
||||||
this->ui->spinner_WarpID->setMaximum(current->getMap()->events.value(event_group_type).length() + event_offs - 1);
|
this->ui->spinner_WarpID->setMaximum(current->getMap()->events.value(eventGroup).length() + event_offs - 1);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
else if (event_group_type == Event::Group::Coord) {
|
case Event::Group::Coord: {
|
||||||
scrollTarget = ui->scrollArea_Triggers;
|
scrollTarget = ui->scrollArea_Triggers;
|
||||||
target = ui->scrollAreaWidgetContents_Triggers;
|
target = ui->scrollAreaWidgetContents_Triggers;
|
||||||
ui->tabWidget_EventType->setCurrentWidget(ui->tab_Triggers);
|
ui->tabWidget_EventType->setCurrentWidget(ui->tab_Triggers);
|
||||||
|
|
||||||
this->ui->spinner_TriggerID->setValue(current->getEventIndex() + event_offs);
|
this->ui->spinner_TriggerID->setValue(current->getEventIndex() + event_offs);
|
||||||
this->ui->spinner_TriggerID->setMinimum(event_offs);
|
this->ui->spinner_TriggerID->setMinimum(event_offs);
|
||||||
this->ui->spinner_TriggerID->setMaximum(current->getMap()->events.value(event_group_type).length() + event_offs - 1);
|
this->ui->spinner_TriggerID->setMaximum(current->getMap()->events.value(eventGroup).length() + event_offs - 1);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
else if (event_group_type == Event::Group::Bg) {
|
case Event::Group::Bg: {
|
||||||
scrollTarget = ui->scrollArea_BGs;
|
scrollTarget = ui->scrollArea_BGs;
|
||||||
target = ui->scrollAreaWidgetContents_BGs;
|
target = ui->scrollAreaWidgetContents_BGs;
|
||||||
ui->tabWidget_EventType->setCurrentWidget(ui->tab_BGs);
|
ui->tabWidget_EventType->setCurrentWidget(ui->tab_BGs);
|
||||||
|
|
||||||
this->ui->spinner_BgID->setValue(current->getEventIndex() + event_offs);
|
this->ui->spinner_BgID->setValue(current->getEventIndex() + event_offs);
|
||||||
this->ui->spinner_BgID->setMinimum(event_offs);
|
this->ui->spinner_BgID->setMinimum(event_offs);
|
||||||
this->ui->spinner_BgID->setMaximum(current->getMap()->events.value(event_group_type).length() + event_offs - 1);
|
this->ui->spinner_BgID->setMaximum(current->getMap()->events.value(eventGroup).length() + event_offs - 1);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
else if (event_group_type == Event::Group::Heal) {
|
case Event::Group::Heal: {
|
||||||
scrollTarget = ui->scrollArea_Healspots;
|
scrollTarget = ui->scrollArea_Healspots;
|
||||||
target = ui->scrollAreaWidgetContents_Healspots;
|
target = ui->scrollAreaWidgetContents_Healspots;
|
||||||
ui->tabWidget_EventType->setCurrentWidget(ui->tab_Healspots);
|
ui->tabWidget_EventType->setCurrentWidget(ui->tab_Healspots);
|
||||||
|
|
||||||
this->ui->spinner_HealID->setValue(current->getEventIndex() + event_offs);
|
this->ui->spinner_HealID->setValue(current->getEventIndex() + event_offs);
|
||||||
this->ui->spinner_HealID->setMinimum(event_offs);
|
this->ui->spinner_HealID->setMinimum(event_offs);
|
||||||
this->ui->spinner_HealID->setMaximum(current->getMap()->events.value(event_group_type).length() + event_offs - 1);
|
this->ui->spinner_HealID->setMaximum(current->getMap()->events.value(eventGroup).length() + event_offs - 1);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
ui->tabWidget_EventType->removeTab(ui->tabWidget_EventType->indexOf(ui->tab_Multiple));
|
ui->tabWidget_EventType->removeTab(ui->tabWidget_EventType->indexOf(ui->tab_Multiple));
|
||||||
}
|
}
|
||||||
|
@ -2022,7 +2028,7 @@ void MainWindow::updateSelectedObjects() {
|
||||||
ui->tabWidget_EventType->setCurrentWidget(ui->tab_Multiple);
|
ui->tabWidget_EventType->setCurrentWidget(ui->tab_Multiple);
|
||||||
}
|
}
|
||||||
|
|
||||||
isProgrammaticEventTabChange = false;
|
this->isProgrammaticEventTabChange = false;
|
||||||
|
|
||||||
QList<EventFrame *> frames;
|
QList<EventFrame *> frames;
|
||||||
for (DraggablePixmapItem *item : events) {
|
for (DraggablePixmapItem *item : events) {
|
||||||
|
@ -2030,28 +2036,20 @@ void MainWindow::updateSelectedObjects() {
|
||||||
EventFrame *eventFrame = event->createEventFrame();
|
EventFrame *eventFrame = event->createEventFrame();
|
||||||
eventFrame->populate(this->editor->project);
|
eventFrame->populate(this->editor->project);
|
||||||
eventFrame->initialize();
|
eventFrame->initialize();
|
||||||
eventFrame->setParent(nullptr);
|
|
||||||
// TODO: hide
|
|
||||||
eventFrame->connectSignals();
|
eventFrame->connectSignals();
|
||||||
// connect(item, &DraggablePixmapItem::spriteChanged, frame->ui->label_spritePixmap, &QLabel::setPixmap);
|
|
||||||
frames.append(eventFrame);
|
frames.append(eventFrame);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (target->layout() && target->children().length()) {
|
if (target->layout() && target->children().length()) {
|
||||||
for (QFrame *frame : target->findChildren<EventFrame *>()) {
|
for (QFrame *frame : target->findChildren<EventFrame *>()) {
|
||||||
frame->hide();
|
if (!frames.contains(frame))
|
||||||
|
frame->hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
delete target->layout();
|
delete target->layout();
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: clear every layout instead?
|
// TODO: necessary? keep layout just remove widgets?
|
||||||
// TODO: layout not clearing?
|
|
||||||
// eg: scrolling through objets to clone object you
|
|
||||||
// can see previous obj frame below clone frame
|
|
||||||
// possibly can just set enabled (false) which can hide frame
|
|
||||||
if (!events.empty()) {
|
if (!events.empty()) {
|
||||||
|
|
||||||
QVBoxLayout *layout = new QVBoxLayout;
|
QVBoxLayout *layout = new QVBoxLayout;
|
||||||
target->setLayout(layout);
|
target->setLayout(layout);
|
||||||
scrollTarget->setWidgetResizable(true);
|
scrollTarget->setWidgetResizable(true);
|
||||||
|
@ -2104,25 +2102,26 @@ void MainWindow::eventTabChanged(int index) {
|
||||||
Event::Group group = getEventGroupFromTabWidget(ui->tabWidget_EventType->widget(index));
|
Event::Group group = getEventGroupFromTabWidget(ui->tabWidget_EventType->widget(index));
|
||||||
DraggablePixmapItem *selectedEvent = nullptr;
|
DraggablePixmapItem *selectedEvent = nullptr;
|
||||||
|
|
||||||
// TODO: use switch
|
switch (group) {
|
||||||
if (group == Event::Group::Object) {
|
case Event::Group::Object:
|
||||||
selectedEvent = selectedObject;
|
selectedEvent = selectedObject;
|
||||||
ui->newEventToolButton->setDefaultAction(ui->newEventToolButton->newObjectAction);
|
ui->newEventToolButton->setDefaultAction(ui->newEventToolButton->newObjectAction);
|
||||||
}
|
break;
|
||||||
else if (group == Event::Group::Warp) {
|
case Event::Group::Warp:
|
||||||
selectedEvent = selectedWarp;
|
selectedEvent = selectedWarp;
|
||||||
ui->newEventToolButton->setDefaultAction(ui->newEventToolButton->newWarpAction);
|
ui->newEventToolButton->setDefaultAction(ui->newEventToolButton->newWarpAction);
|
||||||
}
|
break;
|
||||||
else if (group == Event::Group::Coord) {
|
case Event::Group::Coord:
|
||||||
selectedEvent = selectedTrigger;
|
selectedEvent = selectedTrigger;
|
||||||
ui->newEventToolButton->setDefaultAction(ui->newEventToolButton->newTriggerAction);
|
ui->newEventToolButton->setDefaultAction(ui->newEventToolButton->newTriggerAction);
|
||||||
}
|
break;
|
||||||
else if (group == Event::Group::Bg) {
|
case Event::Group::Bg:
|
||||||
selectedEvent = selectedBG;
|
selectedEvent = selectedBG;
|
||||||
ui->newEventToolButton->setDefaultAction(ui->newEventToolButton->newSignAction);
|
ui->newEventToolButton->setDefaultAction(ui->newEventToolButton->newSignAction);
|
||||||
}
|
break;
|
||||||
else if (group == Event::Group::Heal) {
|
case Event::Group::Heal:
|
||||||
selectedEvent = selectedHealspot;
|
selectedEvent = selectedHealspot;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isProgrammaticEventTabChange) {
|
if (!isProgrammaticEventTabChange) {
|
||||||
|
@ -2712,7 +2711,7 @@ void MainWindow::on_actionAbout_Porymap_triggered()
|
||||||
void MainWindow::on_actionOpen_Log_File_triggered() {
|
void MainWindow::on_actionOpen_Log_File_triggered() {
|
||||||
const QString logPath = getLogPath();
|
const QString logPath = getLogPath();
|
||||||
const int lineCount = ParseUtil::textFileLineCount(logPath);
|
const int lineCount = ParseUtil::textFileLineCount(logPath);
|
||||||
editor->openInTextEditor(logPath, lineCount);
|
this->editor->openInTextEditor(logPath, lineCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_actionOpen_Config_Folder_triggered() {
|
void MainWindow::on_actionOpen_Config_Folder_triggered() {
|
||||||
|
@ -2741,14 +2740,6 @@ void MainWindow::on_actionEdit_Preferences_triggered() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::togglePreferenceSpecificUi() {
|
void MainWindow::togglePreferenceSpecificUi() {
|
||||||
if (porymapConfig.getTextEditorGotoLine().isEmpty()) {
|
|
||||||
for (auto *button : openScriptButtons)
|
|
||||||
button->hide();
|
|
||||||
} else {
|
|
||||||
for (auto *button : openScriptButtons)
|
|
||||||
button->show();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (porymapConfig.getTextEditorOpenFolder().isEmpty())
|
if (porymapConfig.getTextEditorOpenFolder().isEmpty())
|
||||||
ui->actionOpen_Project_in_Text_Editor->setEnabled(false);
|
ui->actionOpen_Project_in_Text_Editor->setEnabled(false);
|
||||||
else
|
else
|
||||||
|
|
|
@ -77,19 +77,7 @@ void EventFrame::setup() {
|
||||||
|
|
||||||
l_layout_xyz->addLayout(l_layout_z);
|
l_layout_xyz->addLayout(l_layout_z);
|
||||||
|
|
||||||
// id / index spinner
|
|
||||||
// this->spinner_id = new NoScrollSpinBox(this);
|
|
||||||
|
|
||||||
// QHBoxLayout *l_layout_id = new QHBoxLayout();
|
|
||||||
|
|
||||||
// this->label_id = new QLabel("id");
|
|
||||||
// l_layout_id->addWidget(this->spinner_id);
|
|
||||||
// l_layout_id->addWidget(this->label_id);
|
|
||||||
// l_layout_id->addItem(createSpacerH());
|
|
||||||
|
|
||||||
QVBoxLayout *l_vbox_1 = new QVBoxLayout();
|
QVBoxLayout *l_vbox_1 = new QVBoxLayout();
|
||||||
// l_vbox_1->addLayout(l_layout_id);
|
|
||||||
|
|
||||||
l_vbox_1->addItem(createSpacerV());
|
l_vbox_1->addItem(createSpacerV());
|
||||||
l_vbox_1->addLayout(l_layout_xyz);
|
l_vbox_1->addLayout(l_layout_xyz);
|
||||||
|
|
||||||
|
@ -112,12 +100,6 @@ void EventFrame::setup() {
|
||||||
this->layout_contents->setContentsMargins(0, 0, 0, 0);
|
this->layout_contents->setContentsMargins(0, 0, 0, 0);
|
||||||
|
|
||||||
this->layout_main->addLayout(this->layout_contents);
|
this->layout_main->addLayout(this->layout_contents);
|
||||||
|
|
||||||
|
|
||||||
///
|
|
||||||
/// connect slots to event modifiers -- actually different function
|
|
||||||
///
|
|
||||||
//this->connectSignals();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: add / delete buttons?
|
// TODO: add / delete buttons?
|
||||||
|
@ -131,7 +113,7 @@ void EventFrame::initCustomAttributesTable() {
|
||||||
// ie, mark connections dirty and need redo
|
// ie, mark connections dirty and need redo
|
||||||
void EventFrame::connectSignals() {
|
void EventFrame::connectSignals() {
|
||||||
this->spinner_x->disconnect();
|
this->spinner_x->disconnect();
|
||||||
connect(this->spinner_x, QOverload<int>::of(&QSpinBox::valueChanged), [this](int value){
|
connect(this->spinner_x, QOverload<int>::of(&QSpinBox::valueChanged), [this](int value) {
|
||||||
int delta = value - event->getX();
|
int delta = value - event->getX();
|
||||||
if (delta) this->event->getMap()->editHistory.push(new EventMove(QList<Event *>() << this->event, delta, 0, this->spinner_x->getActionId()));
|
if (delta) this->event->getMap()->editHistory.push(new EventMove(QList<Event *>() << this->event, delta, 0, this->spinner_x->getActionId()));
|
||||||
});
|
});
|
||||||
|
@ -139,7 +121,7 @@ void EventFrame::connectSignals() {
|
||||||
connect(this->event->getPixmapItem(), &DraggablePixmapItem::xChanged, this->spinner_x, &NoScrollSpinBox::setValue);
|
connect(this->event->getPixmapItem(), &DraggablePixmapItem::xChanged, this->spinner_x, &NoScrollSpinBox::setValue);
|
||||||
|
|
||||||
this->spinner_y->disconnect();
|
this->spinner_y->disconnect();
|
||||||
connect(this->spinner_y, QOverload<int>::of(&QSpinBox::valueChanged), [this](int value){
|
connect(this->spinner_y, QOverload<int>::of(&QSpinBox::valueChanged), [this](int value) {
|
||||||
int delta = value - event->getY();
|
int delta = value - event->getY();
|
||||||
if (delta) this->event->getMap()->editHistory.push(new EventMove(QList<Event *>() << this->event, 0, delta, this->spinner_y->getActionId()));
|
if (delta) this->event->getMap()->editHistory.push(new EventMove(QList<Event *>() << this->event, 0, delta, this->spinner_y->getActionId()));
|
||||||
});
|
});
|
||||||
|
@ -147,15 +129,13 @@ void EventFrame::connectSignals() {
|
||||||
|
|
||||||
// TODO??
|
// TODO??
|
||||||
this->spinner_z->disconnect();
|
this->spinner_z->disconnect();
|
||||||
connect(this->spinner_z, QOverload<int>::of(&QSpinBox::valueChanged), [this](int value){
|
connect(this->spinner_z, QOverload<int>::of(&QSpinBox::valueChanged), [this](int value) {
|
||||||
int delta = value - event->getZ();
|
this->event->setZ(value);
|
||||||
//if (delta) this->event->getMap()->editHistory.push(new EventMove(QList<Event *>() << this->event, delta, 0, this->spinner_z->getActionId()));
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void EventFrame::initialize() {
|
void EventFrame::initialize() {
|
||||||
// this->initialized = true;
|
// this->initialized = true;
|
||||||
// move to before add values to combos? will spinners need to be set agane?
|
|
||||||
// TODO: does this signal blocker block spinner signals?
|
// TODO: does this signal blocker block spinner signals?
|
||||||
const QSignalBlocker blocker(this);
|
const QSignalBlocker blocker(this);
|
||||||
|
|
||||||
|
@ -167,12 +147,9 @@ void EventFrame::initialize() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void EventFrame::populate(Project *project) {
|
void EventFrame::populate(Project *project) {
|
||||||
//
|
|
||||||
if (this->populated) return;
|
if (this->populated) return;
|
||||||
const QSignalBlocker blocker(this);
|
const QSignalBlocker blocker(this);
|
||||||
|
|
||||||
// spinBox_index->setValue(editor->project->getMap(map_name)->events.value(event_group_type).indexOf(item->event) + event_offs);
|
|
||||||
|
|
||||||
this->populated = true;
|
this->populated = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -184,17 +161,10 @@ void EventFrame::setActive(bool active) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
///
|
// TODO: spinbox limits
|
||||||
///
|
|
||||||
///
|
|
||||||
|
|
||||||
//*
|
|
||||||
// TODO: spinbox limits, autocompleters
|
|
||||||
void ObjectFrame::setup() {
|
void ObjectFrame::setup() {
|
||||||
EventFrame::setup();
|
EventFrame::setup();
|
||||||
|
|
||||||
//this->label_id->setText("object id");
|
|
||||||
|
|
||||||
// sprite combo
|
// sprite combo
|
||||||
QFormLayout *l_form_sprite = new QFormLayout();
|
QFormLayout *l_form_sprite = new QFormLayout();
|
||||||
this->combo_sprite = new NoScrollComboBox(this);
|
this->combo_sprite = new NoScrollComboBox(this);
|
||||||
|
@ -228,7 +198,19 @@ void ObjectFrame::setup() {
|
||||||
QFormLayout *l_form_script = new QFormLayout();
|
QFormLayout *l_form_script = new QFormLayout();
|
||||||
this->combo_script = new NoScrollComboBox(this);
|
this->combo_script = new NoScrollComboBox(this);
|
||||||
this->combo_script->setToolTip("The script which is executed with this event.");
|
this->combo_script->setToolTip("The script which is executed with this event.");
|
||||||
l_form_script->addRow("Script", this->combo_script);
|
|
||||||
|
// Add button next to combo which opens combo's current script.
|
||||||
|
this->button_script = new QToolButton(this);
|
||||||
|
this->button_script->setToolTip("Go to this script definition in text editor.");
|
||||||
|
this->button_script->setFixedSize(this->combo_script->height(), this->combo_script->height());
|
||||||
|
this->button_script->setIcon(QFileIconProvider().icon(QFileIconProvider::File));
|
||||||
|
|
||||||
|
QHBoxLayout *l_hbox_scr = new QHBoxLayout();
|
||||||
|
l_hbox_scr->setSpacing(3);
|
||||||
|
l_hbox_scr->addWidget(this->combo_script);
|
||||||
|
l_hbox_scr->addWidget(this->button_script);
|
||||||
|
|
||||||
|
l_form_script->addRow("Script", l_hbox_scr);
|
||||||
this->layout_contents->addLayout(l_form_script);
|
this->layout_contents->addLayout(l_form_script);
|
||||||
|
|
||||||
// event flag
|
// event flag
|
||||||
|
@ -255,16 +237,9 @@ void ObjectFrame::setup() {
|
||||||
l_form_radius_treeid->addRow("Sight Radius / Berry Tree ID", this->combo_radius_treeid);
|
l_form_radius_treeid->addRow("Sight Radius / Berry Tree ID", this->combo_radius_treeid);
|
||||||
this->layout_contents->addLayout(l_form_radius_treeid);
|
this->layout_contents->addLayout(l_form_radius_treeid);
|
||||||
|
|
||||||
// in connection
|
|
||||||
// QFormLayout *l_form_connection = new QFormLayout();
|
|
||||||
// this->check_in_connection = new QCheckBox(this);
|
|
||||||
// l_form_connection->addRow("In Connection", this->check_in_connection);
|
|
||||||
// this->layout_contents->addLayout(l_form_connection);
|
|
||||||
|
|
||||||
// custom attributes
|
// custom attributes
|
||||||
EventFrame::initCustomAttributesTable();
|
EventFrame::initCustomAttributesTable();
|
||||||
}
|
}
|
||||||
//*/
|
|
||||||
|
|
||||||
void ObjectFrame::connectSignals() {
|
void ObjectFrame::connectSignals() {
|
||||||
EventFrame::connectSignals();
|
EventFrame::connectSignals();
|
||||||
|
@ -297,12 +272,16 @@ void ObjectFrame::connectSignals() {
|
||||||
|
|
||||||
// script
|
// script
|
||||||
// add local event script labels to combo? or
|
// add local event script labels to combo? or
|
||||||
// TODO: openScriptButton
|
|
||||||
this->combo_script->disconnect();
|
this->combo_script->disconnect();
|
||||||
connect(this->combo_script, &QComboBox::currentTextChanged, [this](const QString &text) {
|
connect(this->combo_script, &QComboBox::currentTextChanged, [this](const QString &text) {
|
||||||
this->object->setScript(text);
|
this->object->setScript(text);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this->button_script->disconnect();
|
||||||
|
connect(this->button_script, &QToolButton::clicked, [this]() {
|
||||||
|
this->object->getMap()->openScript(this->combo_script->currentText());
|
||||||
|
});
|
||||||
|
|
||||||
// flag
|
// flag
|
||||||
this->combo_flag->disconnect();
|
this->combo_flag->disconnect();
|
||||||
connect(this->combo_flag, &QComboBox::currentTextChanged, [this](const QString &text) {
|
connect(this->combo_flag, &QComboBox::currentTextChanged, [this](const QString &text) {
|
||||||
|
@ -348,6 +327,8 @@ void ObjectFrame::initialize() {
|
||||||
|
|
||||||
// script
|
// script
|
||||||
this->combo_script->setCurrentText(this->object->getScript());
|
this->combo_script->setCurrentText(this->object->getScript());
|
||||||
|
if (porymapConfig.getTextEditorGotoLine().isEmpty())
|
||||||
|
this->button_script->hide();
|
||||||
|
|
||||||
// flag
|
// flag
|
||||||
index = this->combo_flag->findText(this->object->getFlag());
|
index = this->combo_flag->findText(this->object->getFlag());
|
||||||
|
@ -467,20 +448,6 @@ void CloneObjectFrame::populate(Project *project) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void WarpFrame::setup() {
|
void WarpFrame::setup() {
|
||||||
EventFrame::setup();
|
EventFrame::setup();
|
||||||
|
|
||||||
|
@ -547,11 +514,6 @@ void WarpFrame::populate(Project *project) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void TriggerFrame::setup() {
|
void TriggerFrame::setup() {
|
||||||
EventFrame::setup();
|
EventFrame::setup();
|
||||||
|
|
||||||
|
@ -570,7 +532,7 @@ void TriggerFrame::setup() {
|
||||||
l_form_var->addRow("Var", this->combo_var);
|
l_form_var->addRow("Var", this->combo_var);
|
||||||
this->layout_contents->addLayout(l_form_var);
|
this->layout_contents->addLayout(l_form_var);
|
||||||
|
|
||||||
// var value spinner
|
// var value combo
|
||||||
QFormLayout *l_form_var_val = new QFormLayout();
|
QFormLayout *l_form_var_val = new QFormLayout();
|
||||||
this->combo_var_value = new NoScrollComboBox(this);
|
this->combo_var_value = new NoScrollComboBox(this);
|
||||||
this->combo_var_value->setToolTip("The variable's value which triggers the script.");
|
this->combo_var_value->setToolTip("The variable's value which triggers the script.");
|
||||||
|
@ -584,10 +546,27 @@ void TriggerFrame::setup() {
|
||||||
void TriggerFrame::connectSignals() {
|
void TriggerFrame::connectSignals() {
|
||||||
EventFrame::connectSignals();
|
EventFrame::connectSignals();
|
||||||
|
|
||||||
//
|
// label
|
||||||
|
this->combo_script->disconnect();
|
||||||
|
connect(this->combo_script, &QComboBox::currentTextChanged, [this](const QString &text) {
|
||||||
|
this->trigger->setScriptLabel(text);
|
||||||
|
});
|
||||||
|
|
||||||
|
// var
|
||||||
|
this->combo_var->disconnect();
|
||||||
|
connect(this->combo_var, &QComboBox::currentTextChanged, [this](const QString &text) {
|
||||||
|
this->trigger->setScriptVar(text);
|
||||||
|
});
|
||||||
|
|
||||||
|
// value
|
||||||
|
this->combo_var_value->disconnect();
|
||||||
|
connect(this->combo_var_value, &QComboBox::currentTextChanged, [this](const QString &text) {
|
||||||
|
this->trigger->setScriptVarValue(text);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void TriggerFrame::initialize() {
|
void TriggerFrame::initialize() {
|
||||||
|
// TODO: make us of this or delete it
|
||||||
//if (this->populated) return;
|
//if (this->populated) return;
|
||||||
const QSignalBlocker blocker(this);
|
const QSignalBlocker blocker(this);
|
||||||
EventFrame::initialize();
|
EventFrame::initialize();
|
||||||
|
@ -630,10 +609,6 @@ void TriggerFrame::populate(Project *project) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void WeatherTriggerFrame::setup() {
|
void WeatherTriggerFrame::setup() {
|
||||||
EventFrame::setup();
|
EventFrame::setup();
|
||||||
|
|
||||||
|
@ -684,16 +659,6 @@ void WeatherTriggerFrame::populate(Project *project) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void SignFrame::setup() {
|
void SignFrame::setup() {
|
||||||
EventFrame::setup();
|
EventFrame::setup();
|
||||||
|
|
||||||
|
@ -771,21 +736,6 @@ void SignFrame::populate(Project *project) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void HiddenItemFrame::setup() {
|
void HiddenItemFrame::setup() {
|
||||||
EventFrame::setup();
|
EventFrame::setup();
|
||||||
|
|
||||||
|
@ -897,19 +847,6 @@ void HiddenItemFrame::populate(Project *project) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void SecretBaseFrame::setup() {
|
void SecretBaseFrame::setup() {
|
||||||
EventFrame::setup();
|
EventFrame::setup();
|
||||||
|
|
||||||
|
@ -962,34 +899,9 @@ void SecretBaseFrame::populate(Project *project) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void HealLocationFrame::setup() {
|
void HealLocationFrame::setup() {
|
||||||
EventFrame::setup();
|
EventFrame::setup();
|
||||||
|
|
||||||
//this->label_id->setText("heal location id");
|
|
||||||
|
|
||||||
// item combo
|
// item combo
|
||||||
QFormLayout *l_form_respawn_map = new QFormLayout();
|
QFormLayout *l_form_respawn_map = new QFormLayout();
|
||||||
this->combo_respawn_map = new NoScrollComboBox(this);
|
this->combo_respawn_map = new NoScrollComboBox(this);
|
||||||
|
|
Loading…
Reference in a new issue