/*************************************************************************** * Copyright (C) 2005 Nicolas Hadacek * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * ***************************************************************************/ #include "pic_group_ui.h" #include #include "libgui/main_global.h" #include "pic_hex_view.h" #include "pic_register_view.h" #include "pic_config_editor.h" #include "coff/base/text_coff.h" #include "libgui/gui_debug_manager.h" #include "common/gui/list_container.h" Device::HexView *Pic::GroupUI::createHexView(const HexEditor &editor, TQWidget *parent) const { return new HexView(editor, parent); } Register::View *Pic::GroupUI::createRegisterView(TQWidget *parent) const { return new RegisterView(parent); } Device::MemoryEditor *Pic::GroupUI::createConfigEditor(Device::Memory &memory, TQWidget *parent) const { return new MemoryConfigEditorWidget(static_cast(memory), false, parent); } void Pic::GroupUI::fillWatchListContainer(ListContainer *container, TQValueVector &ids) const { ids.clear(); const Pic::Data &data = static_cast(*Main::deviceData()); const Pic::RegistersData &rdata = data.registersData(); ListContainer *branch = container->appendBranch(i18n("SFRs")); TQValueVector list = Pic::sfrList(data); for (uint i=0; iappendItem(list[i].label(), ids.count(), ListContainer::UnChecked); ids.append(list[i].data()); } branch = container->appendBranch(i18n("I/Os")); for (uint i=0; iappendItem(name, ids.count(), ListContainer::UnChecked); ids.append(Register::TypeData(rdata.sfrs[name].address, rdata.nbChars())); } branch = container->appendBranch(i18n("GPRs")); const Coff::Object *coff = Debugger::manager->coff(); list = Pic::gprList(data, coff); for (uint k=0; kappendBranch(i18n("Bank %1").tqarg(k))); uint nb = 0; for (uint i=0; iappendItem(list[i].label(), ids.count(), ListContainer::UnChecked); ids.append(list[i].data()); nb++; } } branch = container->appendBranch(i18n("Variables")); if (coff) { list = Pic::variableList(data, *coff); if ( list.count()==0 ) { branch->appendItem(i18n("No variable"), ids.count(), ListContainer::Disabled); ids.append(Register::TypeData()); } else for (uint i=0; iappendItem(list[i].label(), ids.count(), ListContainer::UnChecked); ids.append(list[i].data()); } } else { branch->appendItem(i18n("Please compile the current project"), ids.count(), ListContainer::Disabled); ids.append(Register::TypeData()); } } Register::ListViewItem *Pic::GroupUI::createWatchItem(const Register::TypeData &data, KListViewItem *parent) const { return new Pic::RegisterListViewItem(data, parent); }