Пример #1
0
void Button::draw(gcn::Graphics *graphics)
{
    int mode;

    if (!isEnabled())
        mode = BUTTON_DISABLED;
    else if (isPressed())
        mode = BUTTON_PRESSED;
    else if (mHasMouse || isFocused())
        mode = BUTTON_HIGHLIGHTED;
    else
        mode = BUTTON_STANDARD;

    updateAlpha();

    static_cast<Graphics*>(graphics)->
        drawImageRect(0, 0, getWidth(), getHeight(), button[mode]);

    if (mode == BUTTON_DISABLED)
        graphics->setColor(guiPalette->getColor(Palette::BUTTON_DISABLED));
    else
        graphics->setColor(guiPalette->getColor(Palette::BUTTON));

    int textX;
    int textY = getHeight() / 2 - getFont()->getHeight() / 2;

    switch (getAlignment())
    {
        case gcn::Graphics::LEFT:
            textX = 4;
            break;
        case gcn::Graphics::CENTER:
            textX = getWidth() / 2;
            break;
        case gcn::Graphics::RIGHT:
            textX = getWidth() - 4;
            break;
        default:
            throw GCN_EXCEPTION("Button::draw. Unknown alignment.");
    }

    if (isFocused())
        graphics->setFont(boldFont);
    else
        graphics->setFont(getFont());

    if (isPressed())
        graphics->drawText(getCaption(), textX + 1, textY + 1, getAlignment());
    else
        graphics->drawText(getCaption(), textX, textY, getAlignment());
}
Пример #2
0
	void TwoButton::draw(Graphics *graphics) {
		Image* img = m_upImage;
		int32_t xoffset = 0;
		int32_t yoffset = 0;

		if (isPressed()) {
			if( m_downImage ) {
				img = m_downImage;
				xoffset = x_downoffset;
				yoffset = y_downoffset;
			}
		} else if(mHasMouse) {
			if( m_hoverImage ) {
				img = m_hoverImage;
			}
		}

		if (img) {
			graphics->drawImage(img, xoffset, yoffset);
		}

		graphics->setColor(getForegroundColor());
		int32_t textX;
		int32_t textY = getHeight() / 2 - getFont()->getHeight() / 2;
		switch (getAlignment())
		{
			case Graphics::LEFT:
				textX = 4;
				break;
			case Graphics::CENTER:
				textX = getWidth() / 2;
				break;
			case Graphics::RIGHT:
				textX = getWidth() - 4;
				break;
			default:
				textX = 4;
				FL_WARN(_log, FIFE::LMsg("TwoButton::draw() - ") << "Unknown alignment: "
				              << getAlignment() << ".  Using the default of Graphics::LEFT");
		}

		graphics->setFont(getFont());
		if (mCaption.size() > 0) {
			if (isPressed())
				graphics->drawText(getCaption(), textX + 1,
						textY + 1, getAlignment());
			else
				graphics->drawText(getCaption(), textX, textY, getAlignment());
		}
	}
Пример #3
0
	void TwoButton::draw(Graphics *graphics) {
		Image* img = m_upImage;
		int xoffset = 0;
		int yoffset = 0;
		
		if (isPressed()) {
			if( m_downImage ) {
				img = m_downImage;
				xoffset = x_downoffset;
				yoffset = y_downoffset;
			}
		} else if(mHasMouse) {
			if( m_hoverImage ) {
				img = m_hoverImage;
			}
		}
		
		if (img) {
			graphics->drawImage(img, xoffset, yoffset);
		}

		graphics->setColor(getForegroundColor());
		int textX;
		int textY = getHeight() / 2 - getFont()->getHeight() / 2;
		switch (getAlignment())
		{
			case Graphics::LEFT:
				textX = 4;
				break;
			case Graphics::CENTER:
				textX = getWidth() / 2;
				break;
			case Graphics::RIGHT:
				textX = getWidth() - 4;
				break;
			default:
				throw GCN_EXCEPTION("Unknown alignment.");
		}

		graphics->setFont(getFont());
		if (mCaption.size() > 0) {
			if (isPressed())
				graphics->drawText(getCaption(), textX + 1, 
						textY + 1, getAlignment());
			else
				graphics->drawText(getCaption(), textX, textY, getAlignment());
		}
	}
Пример #4
0
void Windowiki::draw(gcn::Graphics *graphics)
{
    Graphics *g = static_cast<Graphics*>(graphics);

    g->drawImageRect(0, 0, getWidth(), getHeight(), borderiki);

    // Draw title
    if (mShowTitle)
    {
        graphics->setFont(getFont());
        graphics->drawText(getCaption(), 7, 5, gcn::Graphics::LEFT);
    }

    g->drawImage(sagustImage, getWidth() - sagustImage->getWidth(),
            0);
    if (mCloseButton)
    {
        g->drawImage(closeImage,
            getWidth() - closeImage->getWidth(),
            0
        );
    }
    g->drawImage(solustImage, 0,0);

    g->drawImage(sagaltImage, getWidth() - sagaltImage->getWidth(),
            getHeight() - sagaltImage->getHeight());
    g->drawImage(solaltImage, 0,getHeight() - solaltImage->getHeight() );
    drawChildren(graphics);
}
Пример #5
0
    void RadioButton::adjustSize()
    {
        int height = getFont()->getHeight();

        setHeight(height);
        setWidth(getFont()->getWidth(getCaption()) + height + height/2);
    }
Пример #6
0
bool AdInventoryBox::saveAsText(BaseDynamicBuffer *buffer, int indent) {
	buffer->putTextIndent(indent, "INVENTORY_BOX\n");
	buffer->putTextIndent(indent, "{\n");

	buffer->putTextIndent(indent + 2, "NAME=\"%s\"\n", getName());
	buffer->putTextIndent(indent + 2, "CAPTION=\"%s\"\n", getCaption());

	buffer->putTextIndent(indent + 2, "AREA { %d, %d, %d, %d }\n", _itemsArea.left, _itemsArea.top, _itemsArea.right, _itemsArea.bottom);

	buffer->putTextIndent(indent + 2, "EXCLUSIVE=%s\n", _exclusive ? "TRUE" : "FALSE");
	buffer->putTextIndent(indent + 2, "HIDE_SELECTED=%s\n", _hideSelected ? "TRUE" : "FALSE");
	buffer->putTextIndent(indent + 2, "ALWAYS_VISIBLE=%s\n", _visible ? "TRUE" : "FALSE");
	buffer->putTextIndent(indent + 2, "SPACING=%d\n", _spacing);
	buffer->putTextIndent(indent + 2, "ITEM_WIDTH=%d\n", _itemWidth);
	buffer->putTextIndent(indent + 2, "ITEM_HEIGHT=%d\n", _itemHeight);
	buffer->putTextIndent(indent + 2, "SCROLL_BY=%d\n", _scrollBy);

	buffer->putTextIndent(indent + 2, "\n");

	// window
	if (_window) {
		_window->saveAsText(buffer, indent + 2);
	}

	buffer->putTextIndent(indent + 2, "\n");

	// editor properties
	BaseClass::saveAsText(buffer, indent + 2);

	buffer->putTextIndent(indent, "}\n");
	return STATUS_OK;
}
Пример #7
0
void Label::draw(Graphics* graphics)
{
    int textX;
    int textY = getHeight() / 2 - getFont()->getHeight() / 2;

    switch (getAlignment())
    {
    case Graphics::LEFT:
        textX = 0;
        break;
    case Graphics::CENTER:
        textX = getWidth() / 2;
        break;
    case Graphics::RIGHT:
        textX = getWidth();
        break;
    default:
        //throw GCN_EXCEPTION("Unknown alignment.");
        assert(!"Unknown alignment.");
    }

    graphics->setFont(getFont());
    graphics->setColor(getForegroundColor());
    graphics->drawText(getCaption(), textX, textY, getAlignment());
}
Пример #8
0
bool BaseRegion::saveAsText(BaseDynamicBuffer *buffer, int indent, const char *nameOverride) {
	if (!nameOverride) {
		buffer->putTextIndent(indent, "REGION {\n");
	} else {
		buffer->putTextIndent(indent, "%s {\n", nameOverride);
	}

	buffer->putTextIndent(indent + 2, "NAME=\"%s\"\n", getName());
	buffer->putTextIndent(indent + 2, "CAPTION=\"%s\"\n", getCaption());
	buffer->putTextIndent(indent + 2, "ACTIVE=%s\n", _active ? "TRUE" : "FALSE");
	buffer->putTextIndent(indent + 2, "EDITOR_SELECTED_POINT=%d\n", _editorSelectedPoint);

	for (uint32 i = 0; i < _scripts.size(); i++) {
		buffer->putTextIndent(indent + 2, "SCRIPT=\"%s\"\n", _scripts[i]->_filename);
	}

	for (uint32 i = 0; i < _points.size(); i++) {
		buffer->putTextIndent(indent + 2, "POINT {%d,%d}\n", _points[i]->x, _points[i]->y);
	}

	if (_scProp) {
		_scProp->saveAsText(buffer, indent + 2);
	}

	buffer->putTextIndent(indent, "}\n\n");

	return STATUS_OK;
}
Пример #9
0
void GlassWindow::buildTitleBar(int flags) {
	titleBarContainer.setHeight(titleBar->getHeight());
	titleBarContainer.setOpaque(false);
	//add(&titleBarContainer);
	
	GlassLabel *working = new GlassLabel();
	working->setId("working");
	working->setVisible(false);
	working->setImage(gcn::Image::load("textures/econs/loading/loading0000.s2g"));
	working->setSize(titleBarContainer.getHeight()-2,titleBarContainer.getHeight()-2);
	working->setForegroundColor(gcn::Color(0,0,0));
	
	titleBarContainer.add(working, 
				1, 
				titleBarContainer.getHeight()/2-working->getHeight()/2-1);
	
	if(flags & WT_HELP) {
		help = new ImageButton(std::string("Help")+":"+getCaption(), "/gui/standard/menu_bar_help.png");
		help->addActionListener(&wmhandler);
		titleBarContainer.add(help, 
					working->getWidth()+2, 
					titleBarContainer.getHeight()/2-help->getHeight()/2-1);
	}
	
	if(flags & WT_CLOSE) {
		closeButton = new ImageButton("Close", "/gui/standard/menu_bar_close_x.png");
		closeButton->addActionListener(&wmhandler);
		titleBarContainer.add(closeButton, 
					working->getWidth()+2+help->getWidth() + 2, 
					titleBarContainer.getHeight()/2-closeButton->getHeight()/2-1);
	}
	
	titleBarContainer.setWidth(working->getWidth()+2+help->getWidth() + 2 + closeButton->getWidth()+2);
	titleBarContainer.setX(this->getWidth() - titleBarContainer.getWidth());
}
Пример #10
0
bool AdRegion::saveAsText(BaseDynamicBuffer *buffer, int indent) {
	buffer->putTextIndent(indent, "REGION {\n");
	buffer->putTextIndent(indent + 2, "NAME=\"%s\"\n", getName());
	buffer->putTextIndent(indent + 2, "CAPTION=\"%s\"\n", getCaption());
	buffer->putTextIndent(indent + 2, "BLOCKED=%s\n", _blocked ? "TRUE" : "FALSE");
	buffer->putTextIndent(indent + 2, "DECORATION=%s\n", _decoration ? "TRUE" : "FALSE");
	buffer->putTextIndent(indent + 2, "ACTIVE=%s\n", _active ? "TRUE" : "FALSE");
	buffer->putTextIndent(indent + 2, "SCALE=%d\n", (int)_zoom);
	buffer->putTextIndent(indent + 2, "ALPHA_COLOR { %d,%d,%d }\n", RGBCOLGetR(_alpha), RGBCOLGetG(_alpha), RGBCOLGetB(_alpha));
	buffer->putTextIndent(indent + 2, "ALPHA = %d\n", RGBCOLGetA(_alpha));
	buffer->putTextIndent(indent + 2, "EDITOR_SELECTED=%s\n", _editorSelected ? "TRUE" : "FALSE");

	for (uint32 i = 0; i < _scripts.size(); i++) {
		buffer->putTextIndent(indent + 2, "SCRIPT=\"%s\"\n", _scripts[i]->_filename);
	}

	if (_scProp) {
		_scProp->saveAsText(buffer, indent + 2);
	}

	for (uint32 i = 0; i < _points.size(); i++) {
		buffer->putTextIndent(indent + 2, "POINT {%d,%d}\n", _points[i]->x, _points[i]->y);
	}

	BaseClass::saveAsText(buffer, indent + 2);

	buffer->putTextIndent(indent, "}\n\n");

	return STATUS_OK;
}
Пример #11
0
void SpeechBubble::adjustSize()
{
    int width = mCaption->getWidth() + 2 * getPadding();
    const int speechWidth = mSpeechBox->getMinWidth() + 2 * getPadding();

    const int fontHeight = getFont()->getHeight();
    const int nameHeight = getCaption() != "" ? mCaption->getHeight() +
                           (getPadding() / 2) : 0;
    const int numRows = mSpeechBox->getNumberOfRows();
    const int height = numRows * fontHeight + nameHeight + getPadding();

    if (width < speechWidth)
        width = speechWidth;

    width += 2 * getPadding();

    setContentSize(width, height);

    const int xPos = (getWidth() - width) / 2;
    const int yPos = (getHeight() - height) / 2 + nameHeight;

    mCaption->setPosition(xPos, getPadding());
    mSpeechBox->setPosition(xPos, yPos);

    requestMoveToTop();
}
Пример #12
0
Window::~Window()
{
    logger->log("Window::~Window(\"%s\")", getCaption().c_str());

    saveWindowState();

    destroy(mLayout);
    destroy(mClose);

    while (!mWidgets.empty())
    {
        if (mWidgets.front() == mPreviousFocus)
            mPreviousFocus = NULL;
        destroy(mWidgets.front());
    }

    windowContainer->remove(this);

    removeWidgetListener(this);

    instances--;

    mSkin->instances--;

    if (instances == 0)
        destroy(skinLoader);
}
Пример #13
0
    void CheckBox::draw(Graphics* graphics)
    {
        drawBox(graphics);

        graphics->setFont(getFont());
        graphics->setColor(getForegroundColor());

        int h = getHeight() + getHeight() / 2;

        graphics->drawText(getCaption(), h - 2, 0);

        if (hasFocus() && !getCaption().empty())
        {        
            graphics->drawRectangle(Rectangle(h - 4, 0, getWidth() - h + 3, getHeight()));
        }        
    }
Пример #14
0
void Window::draw(gcn::Graphics *graphics)
{
    Graphics *g = static_cast<Graphics*>(graphics);

    g->drawImageRect(0, 0, getWidth(), getHeight(), mSkin->getBorder());

    // Draw title
    if (mShowTitle)
    {
        g->setColor(Theme::getThemeColor(Theme::TEXT));
        g->setFont(getFont());
        g->drawText(getCaption(), 7, 5, gcn::Graphics::LEFT);
    }

    // Draw Close Button
    if (mCloseButton)
    {
        g->drawImage(mSkin->getCloseImage(),
            getWidth() - mSkin->getCloseImage()->getWidth() - getPadding(),
            getPadding());
    }

    // Draw Sticky Button
    if (mStickyButton)
    {
        Image *button = mSkin->getStickyImage(mSticky);
        int x = getWidth() - button->getWidth() - getPadding();
        if (mCloseButton)
            x -= mSkin->getCloseImage()->getWidth();

        g->drawImage(button, x, getPadding());
    }

    drawChildren(graphics);
}
Пример #15
0
/**
 * Associates the page with a query's type and text.
 * @param	nType	The type of the query
 * @param	sText	The text of the query
 */
void QueryPage::query(uint nType, const QString& sText)
{
	m_nType = nType;
	m_sText = sText;
	m_sName = getCaption();

	m_pDriver->query(nType, sText);
}
Пример #16
0
void Minimap::setMap(Map *map)
{
    // Set the title for the Minimap
    std::string caption;

    if (map)
        caption = map->getName();

    if (caption.empty())
        caption = _("Map");

    minimap->setCaption(caption);

    // Adapt the image
    if (mMapImage)
    {
        mMapImage->decRef();
        mMapImage = 0;
    }

    if (map)
    {
        ResourceManager *resman = ResourceManager::getInstance();
        mMapImage = resman->getImage(map->getProperty("minimap"));
    }

    if (mMapImage)
    {
        const int offsetX = 2 * getPadding();
        const int offsetY = getTitleBarHeight() + getPadding();
        const int titleWidth = getFont()->getWidth(getCaption()) + 15;
        const int mapWidth = mMapImage->getWidth() < 100 ?
                             mMapImage->getWidth() + offsetX : 100;
        const int mapHeight = mMapImage->getHeight() < 100 ?
                              mMapImage->getHeight() + offsetY : 100;

        setMinWidth(mapWidth > titleWidth ? mapWidth : titleWidth);
        setMinHeight(mapHeight);

        mWidthProportion = (float) mMapImage->getWidth() / map->getWidth();
        mHeightProportion = (float) mMapImage->getHeight() / map->getHeight();

        setMaxWidth(mMapImage->getWidth() > titleWidth ?
                    mMapImage->getWidth() + offsetX : titleWidth);
        setMaxHeight(mMapImage->getHeight() + offsetY);

        setDefaultSize(getX(), getY(), getWidth(), getHeight());
        resetToDefaultSize();

        if (mShow)
            setVisible(true);
    }
    else
    {
        if (!isSticky())
            setVisible(false);
    }
}
Пример #17
0
void RadioButton::draw(gcn::Graphics* graphics)
{
    drawBox(graphics);

    graphics->setFont(getFont());
    graphics->setColor(getForegroundColor());

    graphics->drawText(getCaption(), 16, 0);
}
Пример #18
0
void Window::fontChanged()
{
    std::list<Widget*>::iterator iter;
    for (iter = mWidgets.begin(); iter != mWidgets.end(); ++iter)
        (*iter)->fontChanged();

    if (!getCaption().empty())
        setTitleBarHeight(getFont()->getHeight() + 10);
}
Пример #19
0
void NativeEditBox::activate(NativeEditBoxListener* listener) {
	mListener = listener;
	wsprintf(mString, L"%s",getCaption().c_str());
	int res = maTextBox((const wchar*)mTitleString.c_str(), (wchar*)mString,
		(wchar*)mString, mMaxSize, mOptions);
	if(res < 0) {
		PANIC_MESSAGE("maTextBox failed");
	}
	Environment::getEnvironment().addTextBoxListener(this);
}
Пример #20
0
void EntryDisplayState::display(){
	system("cls");
	for (int i = 0; i < getFieldCount(); i++) {
		cout << i << ". " << getCaption(i) << " : " << getValue(i) << endl << endl;
	}

	cout << endl << endl;
	cout << "Enter your operation: " << endl;
	cout << "1. edit\n2. exit\n";

}
Пример #21
0
    void CheckBox::Draw(Graphics* graphics)
    {
        drawBox(graphics);

        graphics->SetFont(GetFont());
        graphics->setColor(getForegroundColor());

        const int h = GetHeight() + GetHeight() / 2;

        graphics->drawText(getCaption(), h - 2, 0);
    }
Пример #22
0
void CheckBox::draw(gcn::Graphics* graphics)
{
    drawBox(graphics);

    graphics->setFont(getFont());
    graphics->setColor(Theme::getThemeColor(Theme::TEXT));

    const int h = getHeight() + getHeight() / 2;

    graphics->drawText(getCaption(), h - 2, 0);
}
Пример #23
0
void TSpriteButton::draw(gcn::Graphics* graphics){
    delete image_;
    image_ = InfraellyImageLoader().load( sprite_.getFrame(sprite_.getFrameProgression()) );
    setImage(image_);

// from guichan/widgets/button.c
    int textX;
    int textY = getHeight() / 2 - getFont()->getHeight() / 2;

    switch (getAlignment())
    {
      case gcn::Graphics::LEFT:
          textX = mSpacing;
          break;
      case gcn::Graphics::CENTER:
          textX = getWidth() / 2;
          break;
      case gcn::Graphics::RIGHT:
          textX = getWidth() - mSpacing;
          break;
      default:
          throw GCN_EXCEPTION("Unknown alignment.");
    }

    graphics->setFont(getFont());

    if (isPressed())
    {
        graphics->drawText(getCaption(), textX + 1, textY + 1, getAlignment());
    }
    else
    {
        graphics->drawText(getCaption(), textX, textY, getAlignment());

        if (isFocused())
        {
            graphics->drawRectangle(gcn::Rectangle(2, 2, getWidth() - 4,
                                              getHeight() - 4));
        }
    }
}
Пример #24
0
void RadioButton::draw(gcn::Graphics* graphics)
{
    graphics->pushClipArea(gcn::Rectangle(1, 1, getWidth() - 1,
                                          getHeight() - 1));

    drawBox(graphics);

    graphics->popClipArea();

    graphics->setFont(getFont());
    graphics->setColor(getForegroundColor());

    int h = getHeight() + getHeight() / 2;
    graphics->drawText(getCaption(), h - 2, 0);
}
Пример #25
0
void DBSH07Button::draw(gcn::Graphics* graphics)
{
    int textX = getWidth() / 2;
    int textY = getHeight() / 2 - getFont()->getHeight() / 2;

    if (mHasMouse)
    {
        graphics->setFont(mHighLightFont);
    }
    else
    {
        graphics->setFont(mNormalFont);
    }

    graphics->drawText(getCaption(), textX, textY, getAlignment());
}
Пример #26
0
void TextInputDialog::adjustSize()
{
    const int titleWidth = 3 * getFont()->getWidth(getCaption()) / 2;
    const int fontHeight = getFont()->getHeight();

    setWidth(titleWidth + 4 * getPadding());
    setHeight(fontHeight + mOkButton->getHeight() +
              mValueField->getHeight() + 8 * getPadding());

    setDefaultSize(getWidth(), getHeight(), ImageRect::CENTER);

    Layout &layout = getLayout();
    layout.setRowHeight(0, Layout::AUTO_SET);
    layout.setRowHeight(1, Layout::AUTO_SET);
    layout.setColWidth(2, Layout::AUTO_SET);
    layout.setColWidth(3, Layout::AUTO_SET);
}
Пример #27
0
Window::~Window()
{
    logger->log("Window::~Window(\"%s\")", getCaption().c_str());

    saveWindowState();

    delete mLayout;

    while (!mWidgets.empty())
        delete mWidgets.front();

    removeWidgetListener(this);

    instances--;

    mSkin->instances--;
}
Пример #28
0
Windowiki::~Windowiki()
{
    logger->log("Window::~Window(\"%s\")", getCaption().c_str());
    const std::string &name = mWindowName;

    // Saving X, Y and Width and Height for resizables in the config
    config.setValue(name + "WinX", getX());
    config.setValue(name + "WinY", getY());

    if (mResizable)
    {
        config.setValue(name + "WinWidth", getWidth());
        config.setValue(name + "WinHeight", getHeight());
    }

    instancesiki--;

    if (instancesiki == 0)
    {
        config.removeListener("guialpha", windowikiConfigListener);
        delete windowikiConfigListener;
        windowikiConfigListener = NULL;

        // Clean up static resources
        delete borderiki.grid[0];
        delete borderiki.grid[1];
        delete borderiki.grid[2];
        delete borderiki.grid[3];
        borderiki.grid[4]->decRef();
        delete borderiki.grid[5];
        delete borderiki.grid[6];
        delete borderiki.grid[7];
        delete borderiki.grid[8];
        closeImage->decRef();
        solustImage->decRef();
        sagustImage->decRef();
        solaltImage->decRef();
        sagaltImage->decRef();

    }

    delete mChrome;
    delete mGrip;
}
Пример #29
0
    void RadioButton::draw(Graphics* graphics)
    {
        graphics->pushClipArea(Rectangle(1,
                                         1,
                                         getWidth() - 1,
                                         getHeight() - 1));
        drawBox(graphics);
        graphics->popClipArea();

        
        graphics->setFont(getFont());
        graphics->setColor(getForegroundColor());

        if (isFocused())
        {
            int fh;
            
            if (getHeight()%2 == 0)
            {
                fh = getHeight() - 4;
            }
            else
            {
                fh = getHeight() - 3;
            }

            int hh = (fh + 1) / 2;
        
            graphics->drawLine(0, hh + 1, hh + 1, 0);
            graphics->drawLine(hh + 2, 1, fh + 2, hh + 1);
            graphics->drawLine(fh + 1, hh + 2, hh + 1, fh + 2);
            graphics->drawLine(hh + 1, fh + 2, 1, hh + 2);            
        }
        
        int h = getHeight() + getHeight() / 2;

        graphics->drawText(getCaption(), h - 2, 0);
    }
Пример #30
0
void DSMonitor::watch(DSNodeHandle N, std::vector<Value*> VS, std::string M) {
  if (N.isNull() || N.getNode()->isCollapsedNode()) {
    unwatch();
    return;
  }

  this->N = N;
  this->VS = VS;
  this->message = M;
  DSGraph *G = N.getNode()->getParentGraph();
  caption = getCaption(N.getNode(), G);

  if (!VS.empty()) {
    Instruction *I = getInstruction(VS[0]);
    if (I && I->getMetadata("dbg")) {
      const DebugLoc DL = I->getDebugLoc();
      auto *scope = cast<DIScope>(DL.getScope());
      location = scope->getFilename().str() + ":"
        + std::to_string(DL.getLine()) + ":"
        + std::to_string(DL.getCol());
    }
  }
}