Skip to content
7 changes: 4 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@ All notable changes to this project will be documented in this file.

* pin groups
* added getter for lowest and highest index of pin group
* added column for pin index in pin tree shown in selection details
* added context menu entry to toggle between ascending and descending
* changed drag&drop behavior, allowing to drop pin on pin when ordering
* added column for pin index in GUI module pin tree
* added GUI module pin tree context menu entry to toggle between ascending and descending
* fixed GUI undo function for group delete
* changed GUI module pin tree drag'n drop behavior, allow drop pin(-group) on pin

* fixed availability of "save as" so that does not required modifications to be enabaled
* added feature to unzip and open hal project by dropping zipped file on welcome screen
Expand Down
4 changes: 2 additions & 2 deletions plugins/gui/include/gui/basic_tree_model/base_tree_item.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ namespace hal
* @param index - The column to set the new data.
* @param data - The new column data.
*/
virtual void setDataAtIndex(int index, QVariant& data) = 0;
virtual void setDataAtColumn(int column, QVariant& data) = 0;

/**
* Appends a new column to the item.
Expand Down Expand Up @@ -227,7 +227,7 @@ namespace hal
* @param index - The column to set the new data.
* @param data - The new column data.
*/
void setDataAtIndex(int index, QVariant& data) override;
void setDataAtColumn(int column, QVariant& data) override;

/**
* Appends a new column to the item.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ namespace hal
ContextTreeItem(ContextDirectory* directory);
QVariant getData(int column) const override;
void setData(QList<QVariant> data) override;
void setDataAtIndex(int index, QVariant& data) override;
void setDataAtColumn(int column, QVariant& data) override;
void appendData(QVariant data) override;
int getColumnCount() const override;
int row() const;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@
#pragma once

#include "gatelibrary_tab_interface.h"
#include "gui/selection_details_widget/gate_details_widget/pin_tree_model.h"
#include "hal_core/defines.h"
#include "hal_core/netlist/gate_library/gate_type.h"

#include <QGridLayout>
Expand Down
2 changes: 1 addition & 1 deletion plugins/gui/include/gui/module_model/module_item.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ namespace hal
* @param index - The column to set the new data. Either 0 (name) or 2(type). Other columns will be ignored.
* @param data - The new column data.
*/
void setDataAtIndex(int index, QVariant& data) override;
void setDataAtColumn(int column, QVariant& data) override;
/**
* Unused dummy function overwritten from parent class.
*/
Expand Down
2 changes: 1 addition & 1 deletion plugins/gui/include/gui/pin_model/pin_item.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ namespace hal
enum class TreeItemType {PinGroup, Pin, GroupCreator, PinCreator, InvalidPinGroup, InvalidPin};

void setData(QList<QVariant> data) override;
void setDataAtIndex(int index, QVariant& data) override;
void setDataAtColumn(int column, QVariant& data) override;
void appendData(QVariant data) override;
int getColumnCount() const override;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ namespace hal
{
class GatePinsTreeModel;
class Gate;
class PinTreeItem;
class GatePinsTreeItem;
class GraphNavigationWidget;

/**
Expand Down Expand Up @@ -98,8 +98,8 @@ namespace hal
bool mClearSelection;

//helper functions
void buildPythonMenuForPin(QMenu &menu, PinTreeItem* clickedPinItem);
void buildPythonMenuForPinGroup(QMenu &menu, PinTreeItem* clickedPinIGrouptem);
void buildPythonMenuForPin(QMenu &menu, GatePinsTreeItem* clickedPinItem);
void buildPythonMenuForPinGroup(QMenu &menu, GatePinsTreeItem* clickedPinIGrouptem);
void addSourceOurDestinationToSelection(int netId, bool isInputPin);
void handleNavigationCloseRequested();
void handleNavigationJumpRequested(const Node& origin, const u32 via_net, const QSet<u32>& to_gates, const QSet<u32>& to_modules);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ namespace hal

class Gate;

class PinTreeItem : public BaseTreeItem
class GatePinsTreeItem : public BaseTreeItem
{
public:
enum Type {None, Pin, Group};
Expand All @@ -51,11 +51,11 @@ namespace hal
int mIndex;
public:

PinTreeItem(const std::string& pinName, QString pinDirection, QString pinTypee, QString netName, int inx);
PinTreeItem();
GatePinsTreeItem(const std::string& pinName, QString pinDirection, QString pinTypee, QString netName, int inx);
GatePinsTreeItem();
QVariant getData(int column) const override;
void setData(QList<QVariant> data) override;
void setDataAtIndex(int index, QVariant& data) override;
void setDataAtColumn(int column, QVariant& data) override;
void appendData(QVariant data) override;
int getColumnCount() const override;
void setType(Type tp) { mType = tp; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ namespace hal
class Net;


class PortTreeItem : public BaseTreeItem
class ModulePinsTreeItem : public BaseTreeItem
{
public:
enum Type {None, Pin, Group};
Expand All @@ -54,11 +54,11 @@ namespace hal

public:

PortTreeItem(Type itype, u32 id_, QString pinName, PinDirection dir, PinType ptype, int inx, QString netName = QString());
PortTreeItem() : mItemType(None), mId(0) {;}
ModulePinsTreeItem(Type itype, u32 id_, QString pinName, PinDirection dir, PinType ptype, int inx, QString netName = QString());
ModulePinsTreeItem() : mItemType(None), mId(0) {;}
QVariant getData(int column) const override;
void setData(QList<QVariant> data) override;
void setDataAtIndex(int index, QVariant& data) override;
void setDataAtColumn(int column, QVariant& data) override;
void appendData(QVariant data) override;
int getColumnCount() const override;
void setItemType(Type tp) { mItemType = tp; }
Expand Down Expand Up @@ -127,7 +127,7 @@ namespace hal
* @param item - The (port) item.
* @return The net or nullptr.
*/
Net* getNetFromItem(PortTreeItem* item);
Net* getNetFromItem(ModulePinsTreeItem* item);

/**
* Get the id of the module that is currently represented.
Expand Down Expand Up @@ -162,18 +162,18 @@ namespace hal
Module* mModule;
//name is (hopefully) enough to identify
QMap<QString, BaseTreeItem*> mNameToTreeItem;
QMap<int, PortTreeItem*> mIdToPinItem;
QMap<int, PortTreeItem*> mIdToGroupItem;
QMap<int, ModulePinsTreeItem*> mIdToPinItem;
QMap<int, ModulePinsTreeItem*> mIdToGroupItem;

void insertItem(PortTreeItem* item, BaseTreeItem* parent, int index);
void removeItem(PortTreeItem* item);
void updateGroupIndex(PortTreeItem* groupItem);
void insertItem(ModulePinsTreeItem* item, BaseTreeItem* parent, int index);
void removeItem(ModulePinsTreeItem* item);
void updateGroupIndex(ModulePinsTreeItem* groupItem);

// helper functions for dnd for more clarity
void dndGroupOnGroup(BaseTreeItem* droppedGroup, BaseTreeItem* onDroppedGroup, int row=-1);
void dndGroupBetweenGroup(PortTreeItem* droppedGroup, int row);
void dndPinOnGroup(PortTreeItem* droppedPin, BaseTreeItem* onDroppedGroup);
void dndPinBetweenPin(PortTreeItem* droppedPin, BaseTreeItem* onDroppedParent, int row);
void dndPinBetweenGroup(PortTreeItem* droppedPin, int row);
void dndGroupBetweenGroup(ModulePinsTreeItem* droppedGroup, int row);
void dndPinOnGroup(ModulePinsTreeItem* droppedPin, BaseTreeItem* onDroppedGroup);
void dndPinBetweenPin(ModulePinsTreeItem* droppedPin, BaseTreeItem* onDroppedParent, int row);
void dndPinBetweenGroup(ModulePinsTreeItem* droppedPin, int row);
};
}
18 changes: 7 additions & 11 deletions plugins/gui/include/gui/user_action/action_pingroup.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,6 @@ namespace hal
static bool useExistingPin(Type tp);
};

int pinGroupIndex(const Module* mod, const PinGroup<ModulePin>* pgrp);

int pinIndex2Row(const ModulePin* pin, int index);

int pinRow2Index(const ModulePin* pin, int row);

QString generateGroupName(const Module* mod, const ModulePin* pin);

void dumpPingroups(Module* m = nullptr);
/**
* @ingroup user_action
Expand All @@ -66,8 +58,7 @@ namespace hal
* negative ID: call constructor without ID, however,
* ID will be used internally for subsequent commands related to crated group
* name : name of group
* value : start index, assume ascending
* negative value: descending order starting with (-value-1)
* value : start index * 2, LSB : 0=descending 1=ascending
*
* GroupDelete
* ID : ID of group to delete
Expand Down Expand Up @@ -135,6 +126,7 @@ namespace hal

QHash<int,PinGroup<ModulePin>*> mPinGroups;
QList<AtomicAction> mPinActions;
QList<QList<AtomicAction> > mTempUndoActions;
Module* mParentModule;
QMap<int,GroupRestore> mGroupRestore;
QSet<u32> mPinsMoved;
Expand All @@ -144,7 +136,6 @@ namespace hal
PinGroup<ModulePin>* getGroup(int grpId) const;
void prepareUndoAction();
void finalizeUndoAction();
void addUndoAction(PinActionType::Type tp, int id = 0, const QString& name=QString(), int value=0);
static int pinGroupRow(const Module *m, PinGroup<ModulePin>* pgroup);
public:
ActionPingroup(PinActionType::Type tp = PinActionType::None, int id = 0, const QString& name=QString(), int value=0);
Expand All @@ -163,6 +154,11 @@ namespace hal
static ActionPingroup* deletePinGroup(const Module* m, u32 grpId);
static ActionPingroup* toggleAscendingGroup(const Module* m, u32 grpId);
static ActionPingroup* changePinGroupType(const Module* m, u32 grpId, int ptype);

static int pinGroupIndex(const Module* mod, const PinGroup<ModulePin>* pgrp);
static int pinIndex2Row(const ModulePin* pin, int index);
static int pinRow2Index(const ModulePin* pin, int row);
static QString generateGroupName(const Module* mod, const ModulePin* pin);
};

/**
Expand Down
6 changes: 3 additions & 3 deletions plugins/gui/src/basic_tree_model/base_tree_item.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,11 @@ namespace hal
}
}

void RootTreeItem::setDataAtIndex(int index, QVariant &data)
void RootTreeItem::setDataAtColumn(int column, QVariant &data)
{
while (index >= mHeaderLabels.size())
while (column >= mHeaderLabels.size())
mHeaderLabels << QString();
mHeaderLabels[index] = data.toString();
mHeaderLabels[column] = data.toString();
}

void RootTreeItem::appendData(QVariant data)
Expand Down
2 changes: 1 addition & 1 deletion plugins/gui/src/basic_tree_model/base_tree_model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ namespace hal
else
for (int i=0; i<labels.size(); i++) {
QVariant qv = QVariant(labels.at(i));
mRootItem->setDataAtIndex(i, qv);
mRootItem->setDataAtColumn(i, qv);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,9 @@ namespace hal

}

void ContextTreeItem::setDataAtIndex(int index, QVariant &data)
void ContextTreeItem::setDataAtColumn(int column, QVariant &data)
{

// TODO: implement
}

void ContextTreeItem::appendData(QVariant data)
Expand Down
4 changes: 2 additions & 2 deletions plugins/gui/src/module_model/module_item.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@ ModuleItem::ModuleItem(const u32 id, const TreeItemType type, ModuleModel *model
setModuleType(data.at(2).toString());
}

void ModuleItem::setDataAtIndex(int index, QVariant &data)
void ModuleItem::setDataAtColumn(int column, QVariant &data)
{
switch (index) {
switch (column) {
case 0:
setName(data.toString());
return;
Expand Down
4 changes: 2 additions & 2 deletions plugins/gui/src/pin_model/pin_item.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ namespace hal
mId = newId;
}

void PinItem::setDataAtIndex(int index, QVariant &data)
void PinItem::setDataAtColumn(int column, QVariant &data)
{

// TODO : implement ?!
}

QString PinItem::getName() const
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "gui/selection_details_widget/gate_details_widget/gate_pin_tree.h"
#include "gui/selection_details_widget/gate_details_widget/pin_tree_model.h"
#include "gui/selection_details_widget/gate_details_widget/gate_pins_tree_model.h"
//#include "gui/gui_globals.h"
#include "hal_core/netlist/gate.h"
#include <QHeaderView>
Expand Down Expand Up @@ -69,8 +69,8 @@ namespace hal
if(!idx.isValid())
return;

PinTreeItem* clickedItem = dynamic_cast<PinTreeItem*>(mPinModel->getItemFromIndex(idx));
if(!clickedItem || clickedItem->type() != PinTreeItem::Pin)
GatePinsTreeItem* clickedItem = dynamic_cast<GatePinsTreeItem*>(mPinModel->getItemFromIndex(idx));
if(!clickedItem || clickedItem->type() != GatePinsTreeItem::Pin)
return;

auto netId = clickedItem->netIds().front();
Expand All @@ -96,7 +96,7 @@ namespace hal
if(!idx.isValid())
return;

PinTreeItem* clickedItem = dynamic_cast<PinTreeItem*>(mPinModel->getItemFromIndex(idx));
GatePinsTreeItem* clickedItem = dynamic_cast<GatePinsTreeItem*>(mPinModel->getItemFromIndex(idx));
QMenu menu;
bool isMiscSectionSet = false;//so that the misc-section is not set multiple times

Expand All @@ -117,7 +117,7 @@ namespace hal
});

//Check if jump to source or destination is possible
if(clickedItem->type() == PinTreeItem::Pin && clickedItem->netIds().size()==1)
if(clickedItem->type() == GatePinsTreeItem::Pin && clickedItem->netIds().size()==1)
{
auto netId = clickedItem->netIds().front();
auto clickedNet = gNetlist->get_net_by_id(netId);
Expand Down Expand Up @@ -156,15 +156,15 @@ namespace hal

//Add nets to selection if possible
QList<u32> netIds;
if(clickedItem->type() == PinTreeItem::Pin)
if(clickedItem->type() == GatePinsTreeItem::Pin)
{
netIds = clickedItem->netIds();
}
else
{
for(auto childItem : clickedItem->getChildren())
{
PinTreeItem* pti = dynamic_cast<PinTreeItem*>(childItem);
GatePinsTreeItem* pti = dynamic_cast<GatePinsTreeItem*>(childItem);
if (pti)
netIds.append(pti->netIds());
}
Expand Down Expand Up @@ -194,7 +194,7 @@ namespace hal

menu.addSection("Python");

if(clickedItem->type() == PinTreeItem::Pin)
if(clickedItem->type() == GatePinsTreeItem::Pin)
buildPythonMenuForPin(menu, clickedItem);
else
buildPythonMenuForPinGroup(menu, clickedItem);
Expand All @@ -204,7 +204,7 @@ namespace hal

}

void GatePinTree::buildPythonMenuForPin(QMenu &menu, PinTreeItem *clickedPinItem)
void GatePinTree::buildPythonMenuForPin(QMenu &menu, GatePinsTreeItem *clickedPinItem)
{
// 1.) NET-OBJECT
QList<u32> netIdsOfItem = clickedPinItem->netIds();
Expand Down Expand Up @@ -246,7 +246,7 @@ namespace hal

}

void GatePinTree::buildPythonMenuForPinGroup(QMenu &menu, PinTreeItem *clickedPinIGrouptem)
void GatePinTree::buildPythonMenuForPinGroup(QMenu &menu, GatePinsTreeItem *clickedPinIGrouptem)
{
// 1. PYTHON LIST OF PIN GROUPS
QString pythonList = "[";
Expand Down
Loading
Loading