Пример #1
0
//------------------------------------------------------------------------------
// updateData() - updates the values
//------------------------------------------------------------------------------
void MapPage::updateData(const LCreal dt)
{
   // find our nearest map page above us and get the data from it!
   MapPage* page = static_cast<MapPage*>(findContainerByType(typeid(MapPage)));
   if (page != nullptr) {
      setHeadingDeg(page->getHeadingDeg());
      setDisplacement(page->getDisplacement());
      setReferenceLatDeg(page->getReferenceLatDeg());
      setReferenceLonDeg(page->getReferenceLonDeg());
      setOuterRadius(page->getOuterRadius());
      setOuterRadiusDC(page->getOuterRadiusDC());
      setCentered(page->getCentered());
      setRange(page->getRange());
      setNorthUp(page->getNorthUp());
      nm2Screen = page->getScale();
   }
   // if we are the top map page, we do the calculations ourself
   else {
      // determine if we are centered or not, and set our displacement and radius accordingly
      if (isCentered) nm2Screen = outerRadius / range;
      else nm2Screen = outerRadiusDC / range;
   }

   // update base class stuff
   BaseClass::updateData(dt);
}
Пример #2
0
AboutWindow::AboutWindow() {
  aboutWindow = this;

  setTitle("About higan ...");
  setBackgroundColor({255, 255, 240});
  layout.setMargin(10);
  auto logo = image{Resource::Logo::higan};
  logo.alphaBlend(0xfffff0);
  canvas.setIcon(logo);
  informationLeft.setFont(Font().setBold()).setAlignment(1.0).setText({
    "Version:\n",
    "Author:\n",
    "License:\n",
    "Website:"
  });
  informationRight.setFont(Font().setBold()).setAlignment(0.0).setText({
    Emulator::Version, "\n",
    Emulator::Author, "\n",
    Emulator::License, "\n",
    Emulator::Website
  });

  setResizable(false);
  setSize(layout.minimumSize());
  setCentered();
}
Пример #3
0
Presentation::Presentation() {
  presentation = this;

  onClose([&] { program->quit(); });

  setTitle({"loki v", Emulator::Version});
  setResizable(false);
  setBackgroundColor({0, 0, 0});
  setSize({512, 480});
  setCentered();
  setVisible();
}
Пример #4
0
// CCPrimitiveText
CCPrimitiveText::CCPrimitiveText(const char *inText, const float inHeight)
{
    setText( inText );
    setHeight( inHeight );
    setCentered( true );
}
//------------------------------------------------------------------------------
// onUpdateCentered() - change our centered status
//------------------------------------------------------------------------------
bool CompassRose::onUpdateCentered(const Basic::Number* const x)
{
    bool ok = false; 
    if (x != nullptr) ok = setCentered(x->getBoolean());
    return ok;
}
Пример #6
0
HtmlEditor::HtmlEditor(HtmlContent *htmlContent, QWidget *parent)
        : NoteEditor(htmlContent), m_htmlContent(htmlContent)
{
    FocusedTextEdit *textEdit = new FocusedTextEdit(/*disableUpdatesOnKeyPress=*/true,parent);
    textEdit->setLineWidth(0);
    textEdit->setMidLineWidth(0);
    textEdit->setFrameStyle(QFrame::Box);
    textEdit->setAutoFormatting(Settings::autoBullet() ? QTextEdit::AutoAll :
                                QTextEdit::AutoNone);

    QPalette palette;
    palette.setColor(textEdit->backgroundRole(), note()->backgroundColor());
    palette.setColor(textEdit->foregroundRole(), note()->textColor());
    textEdit->setPalette(palette);

    textEdit->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    textEdit->setHtml(Tools::tagCrossReferences(m_htmlContent->html(), /*userLink=*/true));
    textEdit->moveCursor(QTextCursor::End);
    textEdit->verticalScrollBar()->setCursor(Qt::ArrowCursor);
    setInlineEditor(textEdit);

    connect(textEdit,                                    SIGNAL(mouseEntered()),  this, SIGNAL(mouseEnteredEditorWidget()));
    connect(textEdit,                                    SIGNAL(escapePressed()), this, SIGNAL(askValidation()));

    connect(InlineEditors::instance()->richTextFont,     SIGNAL(currentFontChanged(const QFont&)),  this, SLOT(onFontSelectionChanged(const QFont&)));
    connect(InlineEditors::instance()->richTextFontSize, SIGNAL(sizeChanged(qreal)),            textEdit, SLOT(setFontPointSize(qreal)));
    connect(InlineEditors::instance()->richTextColor,    SIGNAL(activated(const QColor&)),    textEdit, SLOT(setTextColor(const QColor&)));

    connect(InlineEditors::instance()->focusWidgetFilter, SIGNAL(escapePressed()),  textEdit, SLOT(setFocus()));
    connect(InlineEditors::instance()->focusWidgetFilter, SIGNAL(returnPressed()), textEdit, SLOT(setFocus()));
    connect(InlineEditors::instance()->richTextFont,     SIGNAL(activated(int)),   textEdit, SLOT(setFocus()));

    connect(InlineEditors::instance()->richTextFontSize, SIGNAL(activated(int)),   textEdit, SLOT(setFocus()));

    connect(textEdit,  SIGNAL(cursorPositionChanged()),  this, SLOT(cursorPositionChanged()));
    connect(textEdit,  SIGNAL(currentCharFormatChanged(const QTextCharFormat&)), this, SLOT(charFormatChanged(const QTextCharFormat&)));
//  connect( textEdit,  SIGNAL(currentVerticalAlignmentChanged(VerticalAlignment)), this, SLOT(slotVerticalAlignmentChanged()) );

    connect(InlineEditors::instance()->richTextBold,      SIGNAL(triggered(bool)),    this, SLOT(setBold(bool)));
    connect(InlineEditors::instance()->richTextItalic,    SIGNAL(triggered(bool)),    textEdit, SLOT(setFontItalic(bool)));
    connect(InlineEditors::instance()->richTextUnderline, SIGNAL(triggered(bool)),    textEdit, SLOT(setFontUnderline(bool)));
    connect(InlineEditors::instance()->richTextLeft,      SIGNAL(triggered()), this, SLOT(setLeft()));
    connect(InlineEditors::instance()->richTextCenter,    SIGNAL(triggered()), this, SLOT(setCentered()));
    connect(InlineEditors::instance()->richTextRight,     SIGNAL(triggered()), this, SLOT(setRight()));
    connect(InlineEditors::instance()->richTextJustified, SIGNAL(triggered()), this, SLOT(setBlock()));

//  InlineEditors::instance()->richTextToolBar()->show();
    cursorPositionChanged();
    charFormatChanged(textEdit->currentCharFormat());
    //QTimer::singleShot( 0, this, SLOT(cursorPositionChanged()) );
    InlineEditors::instance()->enableRichTextToolBar();

    connect(InlineEditors::instance()->richTextUndo,      SIGNAL(triggered()), textEdit, SLOT(undo()));
    connect(InlineEditors::instance()->richTextRedo,      SIGNAL(triggered()), textEdit, SLOT(redo()));
    connect(textEdit, SIGNAL(undoAvailable(bool)), InlineEditors::instance()->richTextUndo, SLOT(setEnabled(bool)));
    connect(textEdit, SIGNAL(redoAvailable(bool)), InlineEditors::instance()->richTextRedo, SLOT(setEnabled(bool)));
    connect(textEdit, SIGNAL(textChanged()), this, SLOT(editTextChanged()));
    InlineEditors::instance()->richTextUndo->setEnabled(false);
    InlineEditors::instance()->richTextRedo->setEnabled(false);

    connect(textEdit, SIGNAL(cursorPositionChanged()), htmlContent->note()->basket(), SLOT(editorCursorPositionChanged()));
    // In case it is a very big note, the top is displayed and Enter is pressed: the cursor is on bottom, we should enure it visible:
    QTimer::singleShot(0, htmlContent->note()->basket(), SLOT(editorCursorPositionChanged()));
}
Пример #7
0
//------------------------------------------------------------------------------
// setSlotCentered() - sets if we are centered or decentered
//------------------------------------------------------------------------------
bool MapPage::setSlotCentered(const Basic::Number* const newC)
{
   bool ok = false;
   if (newC != nullptr) ok = setCentered(newC->getBoolean());
   return ok;
}
Пример #8
0
NotepadWin::NotepadWin(Notepad *notepad, SaveFunctionPointer sv, QWidget *parent) : QWidget(parent)
{
    pad = notepad;
    saveText = sv;
    layout = new QVBoxLayout(this);
    layout->setContentsMargins(0, 0, 0, 0);
    setLayout(layout);
    edit = new QTextEdit();
    layout->addWidget(edit);
    connect(edit, SIGNAL(textChanged()), this, SLOT(textChanged()));
    panel = new QWidget();
    panel->setFixedHeight(25);
    layout->addWidget(edit);
	/*QFile file("/home/nay/.razor/desktop/notepad.qss");
    file.open(QFile::ReadOnly);
    QString styleSheet = QLatin1String(file.readAll());
	setStyleSheet(styleSheet);
	file.close();*/
    panelLayout = new QHBoxLayout();
    layout->addLayout(panelLayout);
    bold = new QToolButton();
    bold->setText(QString("B"));
    bold->setIcon(XdgIcon::fromTheme("format-text-bold"));

    italic = new QToolButton();
    italic->setText(QString("I"));
    italic->setIcon(XdgIcon::fromTheme("format-text-italic"));

    underline = new QToolButton();
    underline->setText(QString("U"));
    underline->setIcon(XdgIcon::fromTheme("format-text-underline"));

    strikethrough = new QToolButton();
    strikethrough->setText(QString("S"));
    strikethrough->setIcon(XdgIcon::fromTheme("format-text-strikethrough"));


    leftSided = new QToolButton();
    leftSided->setText(QString("L"));
    leftSided->setIcon(XdgIcon::fromTheme("format-justify-left"));


    centered = new QToolButton();
    centered->setText(QString("C"));
    centered->setIcon(XdgIcon::fromTheme("format-justify-center"));

    rightSided = new QToolButton();
    rightSided->setText(QString("R"));
    rightSided->setIcon(XdgIcon::fromTheme("format-justify-right"));

    justified = new QToolButton();
    justified->setText(QString("J"));
    justified->setIcon(XdgIcon::fromTheme("format-justify-fill"));


    int btnWidth = 21;
    bold->setCheckable(true);
    italic->setCheckable(true);
    underline->setCheckable(true);
    strikethrough->setCheckable(true);
    leftSided->setCheckable(true);
    centered->setCheckable(true);
    rightSided->setCheckable(true);
    justified->setCheckable(true);
    bold->setFixedWidth(btnWidth);
    italic->setFixedWidth(btnWidth);
    underline->setFixedWidth(btnWidth);
    strikethrough->setFixedWidth(btnWidth);
    leftSided->setFixedWidth(btnWidth);
    centered->setFixedWidth(btnWidth);
    rightSided->setFixedWidth(btnWidth);
    justified->setFixedWidth(btnWidth);
    bold->setObjectName(QString("boldButton"));
    italic->setObjectName(QString("italicButton"));
    underline->setObjectName(QString("underlineButton"));
    strikethrough->setObjectName(QString("strikethroughButton"));
    leftSided->setObjectName(QString("leftSided"));
    centered->setObjectName(QString("centered"));
    rightSided->setObjectName(QString("rightSided"));
    justified->setObjectName(QString("justified"));
    
    panelLayout->addWidget(bold);
    panelLayout->addWidget(italic);
    panelLayout->addWidget(underline);
    panelLayout->addWidget(strikethrough);
    
    panelLayout->setSpacing(0);
    panelLayout->addWidget(leftSided);
    panelLayout->addWidget(centered);
    panelLayout->addWidget(rightSided);
    panelLayout->addWidget(justified);
    layout->setAlignment(panelLayout, Qt::AlignLeft);
    connect(bold, SIGNAL(clicked()), this, SLOT(setBold()));
    connect(italic, SIGNAL(clicked()), this, SLOT(setItalic()));
    connect(underline, SIGNAL(clicked()), this, SLOT(setUnderline()));
    connect(strikethrough, SIGNAL(clicked()), this, SLOT(setStrike()));

    connect(leftSided, SIGNAL(clicked()), this, SLOT(setLeftSided()));
    connect(centered, SIGNAL(clicked()), this, SLOT(setCentered()));
    connect(rightSided, SIGNAL(clicked()), this, SLOT(setRightSided()));
    connect(justified, SIGNAL(clicked()), this, SLOT(setJustified()));

    connect(edit, SIGNAL(selectionChanged()), this, SLOT(onSelectionChanged()));
    connect(edit, SIGNAL(cursorPositionChanged()), this, SLOT(onSelectionChanged()));
}