Ejemplo n.º 1
0
/**
 * Adds a new child surface for the state to take care of,
 * giving it the game's display palette. Once associated,
 * the state handles all of the surface's behaviour
 * and management automatically.
 * @param surface Child surface.
 * @note Since visible elements can overlap one another,
 * they have to be added in ascending Z-Order to be blitted
 * correctly onto the screen.
 */
void State::add(Surface *surface)
{
	// Set palette
	surface->setPalette(_game->getScreen()->getPalette());

	// Set default fonts
	Text *t = dynamic_cast<Text*>(surface);
	TextButton *tb = dynamic_cast<TextButton*>(surface);
	TextEdit *te = dynamic_cast<TextEdit*>(surface);
	TextList *tl = dynamic_cast<TextList*>(surface);
	if (t)
	{
		t->setFonts(_game->getResourcePack()->getFont("BIGLETS.DAT"), _game->getResourcePack()->getFont("SMALLSET.DAT"));
	}
	else if (tb)
	{
		tb->setFonts(_game->getResourcePack()->getFont("BIGLETS.DAT"), _game->getResourcePack()->getFont("SMALLSET.DAT"));
	}
	else if (te)
	{
		te->setFonts(_game->getResourcePack()->getFont("BIGLETS.DAT"), _game->getResourcePack()->getFont("SMALLSET.DAT"));
	}
	else if (tl)
	{
		tl->setFonts(_game->getResourcePack()->getFont("BIGLETS.DAT"), _game->getResourcePack()->getFont("SMALLSET.DAT"));
	}

	_surfaces.push_back(surface);
}
void Test2Test::testCase10()
{
    TextEdit txt;
    bool p;
    p=txt.textItalic();
    QCOMPARE(true,p);
}
Ejemplo n.º 3
0
void ValueEdit::resizeEditor()
{
    if ( edit )
    {
        QSize sz = size();

        switch ( typ )
        {
        case NifValue::tSizedString:
        case NifValue::tText:
        {
            TextEdit * te = (TextEdit *)edit;
            te->move( QPoint( 0, 0 ) );
            resize( size() );
            te->CalcSize();
        }
        break;

        default:
        {
            edit->move( QPoint( 0, 0 ) );
            edit->resize( sz );
            resize( sz );
        }
        break;
        }
    }
}
void Test2Test::testCase7()
{
    TextEdit txt;
    bool result;
    result=txt.fileOpen("G:/Lab1_tests/textedit/1.docx");
    QCOMPARE(result,true);
}
Ejemplo n.º 5
0
void FrostEdit::pointToIssue(QListWidgetItem* item) {
	IssueItem* issue = static_cast<IssueItem*>(item);
	TabWidgetFrame* curTabFrameWidget = toTabWidgetFrame(mCurrentTabWidget->parentWidget());
	TextEdit* edit = nullptr;

	QString path;
	QString open;
	QFileInfo file(mCompiledFile);
	if(file.exists()  && file.isFile()) {
		path = file.absolutePath();
		QFileInfo finfo(path+"/"+issue->getFile());
		if(finfo.isFile())
			open = finfo.absolutePath();
		else
			open = issue->getFile();
	} else {
		open = mCompiledFile;
	}


	addEditor(curTabFrameWidget, open);


	edit = toTextEdit(mCurrentTabWidget->currentWidget());

	edit->setCursorPosition(issue->getRow()-1, issue->getColumn()-1);
	edit->ensureCursorVisible();
	edit->setFocus();

}
Ejemplo n.º 6
0
void FrostEdit::widgetChanged(QWidget* old, QWidget* now) {

	if(old == now)
		return;

	//Let's test was the last clicked widget A) TextEdit B) TabWidget C) TabBar
	TextEdit* wid = toTextEdit(now);
	TabWidget* tabwid = qobject_cast<TabWidget*>(now);
	QTabBar* bar = qobject_cast<QTabBar*>(now) ;

	//Was TabBar
	if(bar != nullptr && tabwid == nullptr && wid == nullptr) {
		tabwid = qobject_cast<TabWidget*>(bar->parentWidget());
		updateTabWidget(tabwid);

	} else if(wid != nullptr && tabwid == nullptr && bar == nullptr) {
		tabwid = qobject_cast<TabWidget*>(wid->getParentWidget());
		updateTabWidget(tabwid);

	} else if(tabwid != nullptr && bar == nullptr) {
		updateTabWidget(tabwid);
	}

	if(mCurrentTabWidget != nullptr) {
		if(mCurrentTabWidget->count() != 0 && mCurrentTabWidget != nullptr && mCurrentTabWidget->currentWidget() != nullptr) {
			QTextDocument* doc = toTextEdit(mCurrentTabWidget->currentWidget())->document();
			emit documentChanged(toDocument(doc));
		}
	}
}
void Test2Test::testCase5()
{
    TextEdit txt;
    bool p;
    p=txt.textBold();
    QCOMPARE(true,p);
}
void Test2Test::testCase9()
{
    bool success;
    TextEdit txt;
    QString str="5555";
    success=txt.ForSaveWord(str);
    QCOMPARE(success,true);
}
Ejemplo n.º 9
0
 void onAdministrator(Event& ev)
 {
   bool enabled = !m_administrator.isSelected();
   m_usernameLabel.setEnabled(enabled);
   m_usernameEdit.setEnabled(enabled);
   if (!enabled)
     m_usernameEdit.setText(L"root");
 }
Ejemplo n.º 10
0
int main(int argc, char * argv[])
{
    QApplication app(argc, argv);

    TextEdit *textEdit = new TextEdit;
    textEdit->show();

    return app.exec();
}
void Test2Test::testCase2()
{
    TextEdit txt;
    QString result =txt.textSize("12");
    bool success;
    if (result=="12")
        success=true;
    else success=false;
    QCOMPARE(true,success);
}
Ejemplo n.º 12
0
int main( int argc, char ** argv ) 
{
    QApplication a( argc, argv );
    TextEdit * mw = new TextEdit();
    mw->setCaption( "Richtext Editor" );
    mw->resize( 640, 800 );
    mw->show();
    a.connect( &a, SIGNAL( lastWindowClosed() ), &a, SLOT( quit() ) );
    return a.exec();
}
Ejemplo n.º 13
0
void MainWindow::NewFileSlot()
{
	TextEdit* child = CreateTextEdit();
	child->NewFile();
	//child->show();
	tabWidget->addTab(child, child->GetCurrentFileName());
	int index = tabWidget->count();
	//tabWidget->addTab(child, child->GetCurrentFileName());
	tabWidget->setTabToolTip(index, child->GetCurrentFile());
}
void Test2Test::testCase6()
{
    TextEdit txt;
    bool success;
    int result =txt.textStyle(0);
    if (result==0)
        success=true;
    else success=false;
    QCOMPARE(true,success);
}
Ejemplo n.º 15
0
 int main( int argc, char ** argv )
 {
     Q_INIT_RESOURCE(textedit);

     QApplication a( argc, argv );
     TextEdit mw;
     mw.resize( 700, 800 );
     mw.show();
     return a.exec();
 }
Ejemplo n.º 16
0
int main(int argc, char *argv[])
{
    GWindow::initX();
    TextEdit *editor = new TextEdit();
    if (argc > 1) { editor->loadFile(argv[1]); }
    editor->createWindow();
    XSetIOErrorHandler(&IOErrorHandler);
    GWindow::messageLoop();
    GWindow::closeX();
    delete editor;
}
Ejemplo n.º 17
0
    void create() {
	if ( created )
	    return;
	created = TRUE;
	TextEdit *te = new TextEdit( stack );
	te->load( "textdrawing/example.html" );
	stack->addWidget( te, categoryOffset() + 0 );
	QString home = QDir( "../../doc/html/index.html" ).absPath();
	HelpWindow *w = new HelpWindow( home, ".", stack, "helpviewer" );
	stack->addWidget( w, categoryOffset() + 1 );
    }
Ejemplo n.º 18
0
int FrostEdit::tabWidgetContains(TabWidget* wid, Document* doc) {
	for(int i = 0; i < wid->count(); i++) {
		TextEdit* edit = toTextEdit(wid->widget(i));
		if(edit == nullptr)
			continue;
		if(toDocument(edit->document()) == doc) {
			return i;
		}
	}
	return -1;
}
Ejemplo n.º 19
0
void OpenFolderAction::doExeute(ActionTabWidget* tablWidget)
{
    TextEdit* textEdit = static_cast<TextEdit*>(
                             tablWidget->currentWidget());
    if (textEdit) {
        QString textPath = textEdit->getPath();
        int stuffIndex = textPath.lastIndexOf("/");
        textPath = textPath.left(stuffIndex);
        QDesktopServices::openUrl(QUrl(textPath));
    }
}
Ejemplo n.º 20
0
void ScriptTextEditor::reload(bool p_soft) {

	TextEdit *te = code_editor->get_text_edit();
	Ref<Script> scr = get_edited_script();
	if (scr.is_null())
		return;
	scr->set_source_code(te->get_text());
	bool soft =  p_soft || scr->get_instance_base_type()=="EditorPlugin"; //always soft-reload editor plugins

	scr->get_language()->reload_tool_script(scr,soft);
}
Ejemplo n.º 21
0
void FrostEdit::updateTabHeader(Document* doc, bool b) {
	for(TabWidgetFrame* tab: mTabWidgetFrames) {
		for(int i = 0; i < tab->tabWidget()->count(); i++) {
			TextEdit* edit = toTextEdit(tab->tabWidget()->widget(i));
			if(edit != nullptr && edit->document() == doc) {
				tab->tabWidget()->setTabText(i, doc->getDynamicName());
				changeTitle(tab->tabWidget(), i);
			}
		}
	}
}
Ejemplo n.º 22
0
int main(int argc, char **argv)
{
    Q_INIT_RESOURCE(textedit);

    QApplication a(argc, argv);
    a.setStyle(new MyProxyStyle);
    TextEdit mw;
    mw.resize(700, 800);
    mw.show();
    //...
}
Ejemplo n.º 23
0
int FrostEdit::openEditors(Document* doc) {
	int open = 0;
	for(TabWidgetFrame* tab: mTabWidgetFrames) {
		for(int i = 0; i < tab->tabWidget()->count(); i++) {
			TextEdit* edit = toTextEdit(tab->tabWidget()->widget(i));
			if(edit != NULL && edit->document() == doc)
				open++;
		}
	}
	return open;
}
Ejemplo n.º 24
0
int main( int argc, char ** argv )
{
    Q_INIT_RESOURCE(textedit);

    QApplication a( argc, argv );
    //QApplication::setStyle(QStyleFactory::create("cleanlooks"));
    //QApplication::setPalette(QApplication::style()->standardPalette());
    TextEdit mw;
    mw.resize( 700, 800 );
    mw.show();
    return a.exec();
}
Ejemplo n.º 25
0
void configure_editor(TextEdit &edit, Font &normalFont, Font &hotFont, int preferredWidth)
{
  edit.FocusEnter.connect(Bind(&Widget::setFont, &edit, hotFont));
  edit.FocusLeave.connect(Bind(&Widget::setFont, &edit, normalFont));

  edit.MouseEnter.connect(Bind(&Widget::setBgColor, &edit, Color(255, 255, 190)));
  edit.MouseLeave.connect(Bind(&Widget::setBgColor, &edit, Color::White));
  edit.MouseEnter.connect(Bind(&Widget::invalidate, &edit, true));
  edit.MouseLeave.connect(Bind(&Widget::invalidate, &edit, true));

  edit.setFont(normalFont);
  edit.setPreferredSize(Size(preferredWidth, edit.getPreferredSize().h));
}
Ejemplo n.º 26
0
int testmain() {

    char c;
    TextEdit t;
    char* buf;

    while ((c = getchar()) != '.') {
        if (c == EOF) return(0);
        t.handle(c);
        printf("\n== %s ==\n", buf = t.GetPrintText());
        delete buf;
    }
    return(0);
}
Ejemplo n.º 27
0
/**
 * switch all the colours to something a little more battlescape appropriate.
 */
void State::applyBattlescapeTheme()
{
	for (std::vector<Surface*>::iterator i = _surfaces.begin(); i != _surfaces.end(); ++i)
	{
		Window* window = dynamic_cast<Window*>(*i);
		if (window)
		{
			window->setColor(Palette::blockOffset(0)-1);
			window->setHighContrast(true);
			window->setBackground(_game->getResourcePack()->getSurface("TAC00.SCR"));
		}
		Text* text = dynamic_cast<Text*>(*i);
		if (text)
		{
			text->setColor(Palette::blockOffset(0)-1);
			text->setHighContrast(true);
		}
		TextButton* button = dynamic_cast<TextButton*>(*i);
		if (button)
		{
			button->setColor(Palette::blockOffset(0)-1);
			button->setHighContrast(true);
		}
		TextEdit* edit = dynamic_cast<TextEdit*>(*i);
		if (edit)
		{
			edit->setColor(Palette::blockOffset(0)-1);
			edit->setHighContrast(true);
		}
		TextList* list = dynamic_cast<TextList*>(*i);
		if (list)
		{
			list->setColor(Palette::blockOffset(0)-1);
			list->setArrowColor(Palette::blockOffset(0));
			list->setHighContrast(true);
		}
		ArrowButton *arrow = dynamic_cast<ArrowButton*>(*i);
		if (arrow)
		{
			arrow->setColor(Palette::blockOffset(0));
		}
		Slider *slider = dynamic_cast<Slider*>(*i);
		if (slider)
		{
			slider->setColor(Palette::blockOffset(0)-1);
			slider->setHighContrast(true);
		}
	}
}
Ejemplo n.º 28
0
void FrostEdit::on_actionSave_triggered() {
	TextEdit* e = toTextEdit(mCurrentTabWidget->currentWidget());
	Document* doc = toDocument(e->document());
	if(doc->getFileInfo().isFile()) {
		mDocumentWatcher->removePath(doc->getFullPath());
		doc->save();
		mDocumentWatcher->addPath(doc->getFullPath());
	} else {
		QString prevPath = doc->getFullPath();
		on_actionSave_As_triggered();
		if(mCompiledFile == prevPath)
			mCompiledFile = doc->getFullPath();
	}
	updateTabHeader(doc, doc->isModified());
}
Ejemplo n.º 29
0
Archivo: WebCam.cpp Proyecto: Jmos/vaca
  void onChangeRate()
  {
    int rate = m_rate.getValue();

    m_rateEdit.setText(convert_to<String>(rate));
    m_webcam.setPreviewRate(rate);
  }
Ejemplo n.º 30
0
int main( int argc, char ** argv )
{
    QApplication a( argc, argv );
    a.setOrganizationName("Oasis Test Reader");
    a.setOrganizationDomain("QTuser");
    a.setApplicationName("Mini Office");
    #if QT_VERSION >= 0x040500
    qDebug() << "### QT_VERSION main  -> " << QT_VERSION;
    qDebug() << "### QT_VERSION_STR main -> " << QT_VERSION_STR;
    #endif
    TextEdit mw;
    mw.resize( 700, 450 );
    mw.show();
    QObject::connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()));
    return a.exec();
}