Esempio n. 1
0
void ImageCanvas::menu(const QPoint&) {
    Q3PopupMenu m(0);
    Q3PopupMenu fontsubm(0);

    MenuFactory::createTitle(m, TR("Image"));
    m.insertSeparator();
    m.insertItem(TR("Upper"), 0);
    m.insertItem(TR("Lower"), 1);
    m.insertItem(TR("Go up"), 2);
    m.insertItem(TR("Go down"), 3);
    m.insertSeparator();
    m.insertItem(TR("Edit"), 4);
    if (linked()) {
        m.insertSeparator();
        m.insertItem(TR("Select linked items"), 5);
    }
    m.insertSeparator();
    m.insertItem(TR("Remove from diagram"), 6);

    int index = m.exec(QCursor::pos());

    switch (index) {
    case 0:
        upper();
        modified();	// call package_modified()
        return;
    case 1:
        lower();
        modified();	// call package_modified()
        return;
    case 2:
        z_up();
        modified();	// call package_modified()
        return;
    case 3:
        z_down();
        modified();	// call package_modified()
        return;
    case 4:
        open();
        // all done by open
        return;
    case 5:
        the_canvas()->unselect_all();
        select_associated();
        return;
    case 6:
        delete_it();
        break;
    }

    package_modified();
}
Esempio n. 2
0
void InfoCanvas::menu(const QPoint&) {
  Q3PopupMenu m(0);
  Q3PopupMenu fontsubm(0);
  
  MenuFactory::createTitle(m, TR("Information"));
  m.insertSeparator();
  m.insertItem(TR("Upper"), 0);
  m.insertItem(TR("Lower"), 1);
  m.insertItem(TR("Go up"), 5);
  m.insertItem(TR("Go down"), 6);
  m.insertSeparator();
  m.insertItem(TR("Edit"), 2);
  m.insertSeparator();
  m.insertItem(TR("Font"), &fontsubm);  
  init_font_menu(fontsubm, the_canvas(), 10);
  m.insertItem(TR("Edit drawing settings"), 3);
  if (linked()) {
    m.insertSeparator();
    m.insertItem(TR("Select linked items"), 4);
  }
  m.insertSeparator();

  int index = m.exec(QCursor::pos());
  
  switch (index) {
  case 0:
    upper();
    modified();	// call package_modified()
    return;
  case 1:
    lower();
    modified();	// call package_modified()
    return;
  case 5:
    z_up();
    modified();	// call package_modified()
    return;
  case 6:
    z_down();
    modified();	// call package_modified()
    return;
  case 2:
    who->open();
    return;
  case 3:
    for (;;) {
      ColorSpecVector co(1);
      
      co[0].set(TR("note color"), &itscolor);

      SettingsDialog dialog(0, &co, FALSE);
      
      dialog.raise();
      if (dialog.exec() == QDialog::Accepted)
	modified();
      if (!dialog.redo())
	return;
    }
    break;
  case 4:
    the_canvas()->unselect_all();
    select_associated();
    return;
  default:
    if (index >= 10) {
      itsfont = (UmlFont) (index - 10);
      modified();
    }
    return;
  }
  
  package_modified();
}
Esempio n. 3
0
void NoteCanvas::menu(const QPoint &)
{
    Q3PopupMenu m(0);
    Q3PopupMenu fontsubm(0);

    MenuFactory::createTitle(m, TR("Note"));
    m.insertSeparator();
    m.insertItem(TR("Upper"), 0);
    m.insertItem(TR("Lower"), 1);
    m.insertItem(TR("Go up"), 7);
    m.insertItem(TR("Go down"), 8);
    m.insertSeparator();
    m.insertItem(TR("Edit"), 2);
    m.insertSeparator();
    m.insertItem(TR("Color of text"), 6);
    m.insertItem(TR("Font"), &fontsubm);
    init_font_menu(fontsubm, the_canvas(), 10);
    m.insertItem(TR("Edit drawing settings"), 3);

    if (linked()) {
        m.insertSeparator();
        m.insertItem(TR("Select linked items"), 4);
    }

    m.insertSeparator();
    m.insertItem(TR("Remove from diagram"), 5);

    int index = m.exec(QCursor::pos());

    switch (index) {
    case 0:
        upper();
        modified();	// call package_modified()
        return;

    case 1:
        lower();
        modified();	// call package_modified()
        return;

    case 7:
        z_up();
        modified();	// call package_modified()
        return;

    case 8:
        z_down();
        modified();	// call package_modified()
        return;

    case 2:
        open();
        // modified then package_modified already called
        return;

    case 3:
        edit_drawing_settings();
        return;

    case 4:
        the_canvas()->unselect_all();
        select_associated();
        return;

    case 5:
        delete_it();
        break;

    case 6:
        for (;;) {
            ColorSpecVector co(1);

            co[0].set(TR("color"), &fg_c);

            SettingsDialog dialog(0, &co, TRUE, FALSE,
                                  TR("Text color dialog"));

            dialog.raise();

            if (dialog.exec() != QDialog::Accepted)
                return;

            // force son reaffichage
            hide();
            show();
            canvas()->update();

            if (!dialog.redo())
                break;
            else
                package_modified();
        }

        break;

    default:
        if (index >= 10) {
            itsfont = (UmlFont)(index - 10);
            modified();
        }

        return;
    }

    package_modified();
}
Esempio n. 4
0
void TextCanvas::menu(const QPoint &)
{
    QMenu m(0);
    QMenu fontsubm(0);

    MenuFactory::createTitle(m,  QObject::tr("Text"));
    m.addSeparator();
    MenuFactory::addItem(m,  QObject::tr("Upper"), 0);
    MenuFactory::addItem(m,  QObject::tr("Lower"), 1);
    MenuFactory::addItem(m,  QObject::tr("Go up"), 6);
    MenuFactory::addItem(m,  QObject::tr("Go down"), 7);
    m.addSeparator();
    MenuFactory::addItem(m,  QObject::tr("Edit"), 2);
    m.addSeparator();
    MenuFactory::addItem(m,  QObject::tr("Color"), 5);
    MenuFactory::insertItem(m,  QObject::tr("Font"), &fontsubm);
    init_font_menu(fontsubm, the_canvas(), 10);

    if (linked()) {
        m.addSeparator();
        MenuFactory::addItem(m,  QObject::tr("Select linked items"), 3);
    }

    m.addSeparator();
    MenuFactory::addItem(m,  QObject::tr("Remove from diagram"), 4);

    QAction* retAction = m.exec(QCursor::pos());
    if(retAction)
    {
        int index = retAction->data().toInt();

        switch (index) {
        case 0:
            upper();
            // force son reaffichage
            hide();
            show();
            canvas()->update();
            break;

        case 1:
            lower();
            // force son reaffichage
            hide();
            show();
            canvas()->update();
            break;

        case 6:
            z_up();
            // force son reaffichage
            hide();
            show();
            canvas()->update();
            break;

        case 7:
            z_down();
            // force son reaffichage
            hide();
            show();
            canvas()->update();
            break;

        case 2:
            open();
            return;	// call package_modified

        case 3:
            the_canvas()->unselect_all();
            select_associated();
            return;

        case 4:
            // delete
            the_canvas()->del(this);
            break;

        case 5:
            for (;;) {
                ColorSpecVector co(2);

                co[0].set( QObject::tr("foreground"), &fg_c);
                co[1].set( QObject::tr("background"), &bg_c);

                SettingsDialog dialog(0, &co, TRUE, FALSE,
                                      QObject::tr("Text color dialog"));

                dialog.raise();

                if (dialog.exec() != QDialog::Accepted)
                    return;

                // force son reaffichage
                hide();
                show();
                canvas()->update();

                if (!dialog.redo())
                    break;
                else
                    package_modified();
            }

            break;

        default:
            if (index >= 10) {
                itsfont = (UmlFont)(index - 10);
                // force son reaffichage
                hide();
                show();
                canvas()->update();
                break;
            }
            else
                return;
        }
    }

    package_modified();
}