Exemple #1
0
void ofxSimpleGuiToo::setup() {
	config			= &defaultSimpleGuiConfig;

//	guiFocus		= 0;

//	xmlFilename			= OFX_SIMPLEGUITOO_XML_NAME;
	doSave			= false;
//	doSaveBackup	= false;
	changePage		= false;
	titleButton		= NULL;

	headerPage		= &addPage("Header");
	headerPage->height = config->buttonHeight * 2;
	headerPage->width = 0;
	titleButton = &headerPage->addButton("title", changePage);
	headerPage->addToggle("Auto Save", doAutoSave);
	headerPage->addButton("Save Settings", doSave);
//	headerPage->addButton("Backup XML", doSaveBackup);
	headerPage->addFPSCounter();

	addPage();
	setAutoSave(true);
	setAlignRight(false);
	setDraw(false);
	setPage(1);
	
	ofAddListener(ofEvents.keyPressed, this, &ofxSimpleGuiToo::keyPressed);
}
void UIHorizontalLayout::applyStyle(const OTMLNodePtr& styleNode)
{
    UIBoxLayout::applyStyle(styleNode);

    for(const OTMLNodePtr& node : styleNode->children()) {
        if(node->tag() == "align-right")
            setAlignRight(node->value<bool>());
    }
}
void KSimBaseIntSpinBox::init()
{
	setValidator(0);
	connect(this,SIGNAL(valueChanged(int)), this, SLOT(slotValueChanged(int)));
	connect(editor(), SIGNAL(textChanged(const QString &)),SLOT(slotTextChanged(const QString &)));
	KSimSpinBox::setMinValue(Private::s_lowerLimit);
	KSimSpinBox::setMaxValue(Private::s_upperLimit);
	setFocusPolicy(QWidget::WheelFocus);
	setAlignRight();
}
void ofxSimpleGuiToo::setup() {
	config			= &defaultSimpleGuiConfig;

	doSave			= false;
	changePage		= false;
	titleButton		= NULL;

	headerPage		= &addPage("Header");
	headerPage->height = config->buttonHeight * 2;
	headerPage->width = 0;
	titleButton = &headerPage->addButton("title", changePage);
	headerPage->addToggle("Auto Save", doAutoSave);
	headerPage->addButton("Save Settings", doSave);
	headerPage->addFPSCounter();
	
	addPage();
	setAutoSave(true);
	setAlignRight(false);
	setDraw(false);
	setPage(1);
	
	ofAddListener(ofEvents.keyPressed, this, &ofxSimpleGuiToo::keyPressed);
}
Exemple #5
0
int readPrint(char *fname)
{
	if( fname == NULL )
		return -1;

	FILE *f = fopen(fname, "r");
	if( f == NULL ){
		return -1;
	}

	char c;
	while ( (c = fgetc(f) ) != EOF )
	{
		switch(c){
		case '\n':
			linebuffer[len] = '\n';
			printLine();
			break;
		case '\\':
			c = fgetc(f);
			if( c == 'o'){
				printLine();
				setFontNormal();
			}else if(c == 'b'){
				printLine();
				setFontBold();
			}else if( c == 'w'){
				printLine();
				setFontDoubleWidth();
			}else if( c == 'h'){
				printLine();
				setFontDoubleHeight();
			}else if ( c == '0' ){
				setAlignLeft();
			}else if ( c == 'm' ){
				setAlignCenter();
			}else if ( c == '$' ){
				setAlignRight();
			}else{
				linebuffer[len++] = '\\';
				if( c == EOF ){
					//linebuffer[len] = '\n';
					printLine();
				}else{
					linebuffer[len++] = c;
				}
			}
			break;
		default:
			linebuffer[len++] = c;
			break;
		}

		if( len >= 1023 ){
			//printf("print len >= 1023\n");
			printLine();
		}

	}
	printLine();
	feed4Lines();
	fclose(f);
	openCashDrawer();
	cutPaper();

	return 0;
}
void ofxSimpleGuiToo::setup() {
	config			= &defaultSimpleGuiConfig;
	
	doSave			= false;
	changePage		= false;
	titleButton		= NULL;
	keyboardShortcutsEnabled = true;
	doDrawPageBoundary = false;
	
	headerPage		= &addPage("Header");
	headerPage->height = config->buttonHeight * 2;
	headerPage->width = 0;
	titleButton = &headerPage->addButton("title", changePage);
	headerPage->addToggle("Auto Save", doAutoSave);
	headerPage->addButton("Save Settings", doSave);
	headerPage->addFPSCounter();
	
	cols = ceilf(ofGetWidth() / config->gridSize.x);
	rows = ceilf(ofGetHeight() / config->gridSize.y);
	
	addPage(); // default settings page
	addFPSCounter();
	
	setAutoSave(true);
	setAlignRight(false);
	setDraw(false);
	
	
	//addToggle("", <#bool value#>)
	
	//addControl(*titleButton);
	
	page(1).addPageShortcut(addPage("Keyboard Shortcuts"));
	page(1).addPageShortcut(addPage("GUI"));
	//setPage("GUI");
	addButton("save settings", doSave);
	addToggle("auto save", doAutoSave);
	//gui.addTitle("gui display");

	gui.addTitle("controls");
	string choices[] = {"simple","advanced","all"};
	gui.addComboBox("display priority", ofxSimpleGuiPage::mainPriority, 3, choices);
	gui.addButton("collapse all", 't', this, &ofxSimpleGuiToo::closeAllTitles);
	gui.addButton("open all", 'T', this, &ofxSimpleGuiToo::openAllTitles);
	
	gui.addTitle("display mode");
	string displayModeChoices[GUI_MODE_COUNT] = {"fixed","floating"};
	addComboBox("display mode", displayMode, GUI_MODE_COUNT, displayModeChoices);
	gui.addTitle("floating parameters");
	gui.addSlider("x", displayRect.x, 0, ofGetWidth());
	gui.addSlider("y", displayRect.y, 0, ofGetHeight());
	gui.addSlider("columns", cols, 1, 10);
	gui.addSlider("rows", rows, 5, 30);
	gui.addButton("reset", this, &ofxSimpleGuiToo::setDefaultDimensions);
	gui.addToggle("draw boundaries", doDrawPageBoundary);
	//gui.addSlider("gui width", displayRect.width, 256, ofGetWidth());
	//gui.addSlider("gui height", displayRect.height, 256, ofGetHeight());

	setPage(1);
	
	//addSlider("advanced gui", ofxSimpleGuiControl::mainPriority, 0, 2);
	ofAddListener(ofEvents.keyPressed, this, &ofxSimpleGuiToo::keyPressed);
}
Exemple #7
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
//    QString s = QString::number(colors[1][0]);
//    ui->textEdit->append(s);
//    colors = new int*[12];
//    for(int i = 0; i < 12; ++i){
//        colors[i] = new int[3];
//    }
    connect(ui->italic,SIGNAL(clicked()),this,SLOT(setItalic()));
    connect(ui->underline,SIGNAL(clicked()),this,SLOT(setUnderline()));
    connect(ui->bold,SIGNAL(clicked()),this,SLOT(setBold()));
    connect(ui->sizebox,SIGNAL(currentIndexChanged(int)),this,SLOT(setSize(int)));
    connect(ui->alignLeft,SIGNAL(clicked()),this,SLOT(setAlignLeft()));
    connect(ui->alignCenter,SIGNAL(clicked()),this,SLOT(setAlignCenter()));
    connect(ui->alignRight,SIGNAL(clicked()),this,SLOT(setAlignRight()));
    connect(ui->justify,SIGNAL(clicked()),this,SLOT(setJustify()));
   // connect(ui->foregroundCombo,SIGNAL(clicked()),this,SLOT(colorHandle()));
    //connect(ui->backColorChooser,SIGNAL(clicked()),this,SLOT(backColorHandle()));
    connect(ui->fontComboBox,SIGNAL(currentFontChanged(QFont)),this,SLOT(setFont(QFont)));
    connect(ui->menuEdit,SIGNAL(triggered()),this,SLOT(enablePasteee()));
    connect(ui->menuEdit,SIGNAL(clicked()),this,SLOT(enablePasteee()));
    connect(ui->menuEdit,SIGNAL(hovered()),this,SLOT(enablePasteee()));
    connect(ui->actionUndo,SIGNAL(triggered()),this,SLOT(undo()));
    connect(ui->actionREdo,SIGNAL(triggered()),this,SLOT(redo()));
    connect(ui->actionCopy,SIGNAL(triggered()),this,SLOT(copy()));
    connect(ui->actionCut,SIGNAL(triggered()),this,SLOT(cut()));
    connect(ui->actionPaste_2,SIGNAL(triggered()),this,SLOT(paste()));
    connect(ui->actionLoad,SIGNAL(triggered()),this,SLOT(load()));
    connect(ui->actionSave,SIGNAL(triggered()),this,SLOT(save()));
    connect(ui->actionSelectAll,SIGNAL(triggered()),this,SLOT(selectAll()));
    connect(ui->actionExit,SIGNAL(triggered()),this,SLOT(exit()));
    QIcon *i0 = new QIcon(":/new/colors/0.png");
    QIcon *i1 = new QIcon(":/new/colors/1.png");
    QIcon *i2 = new QIcon(":/new/colors/2.png");
    QIcon *i3 = new QIcon(":/new/colors/3.png");
    QIcon *i4 = new QIcon(":/new/colors/4.png");
    QIcon *i5 = new QIcon(":/new/colors/5.png");
    QIcon *i6 = new QIcon(":/new/colors/6.png");
    QIcon *i7 = new QIcon(":/new/colors/7.png");
    QIcon *i8 = new QIcon(":/new/colors/8.png");
    QIcon *i9 = new QIcon(":/new/colors/9.png");
    QIcon *i10 = new QIcon(":/new/colors/10.png");
    QIcon *i11 = new QIcon(":/new/colors/11.png");
    QIcon *i12 = new QIcon(":/new/colors/12.png");
    QIcon *i13 = new QIcon(":/new/colors/13.png");
    QIcon *i14 = new QIcon(":/new/colors/14.png");
    QIcon *i15 = new QIcon(":/new/colors/15.png");
    QIcon *i16 = new QIcon(":/new/colors/16.png");
    ui->foregroundCombo->setItemIcon(0,*i0);
    ui->foregroundCombo->setItemIcon(1,*i1);
    ui->foregroundCombo->setItemIcon(2,*i2);
    ui->foregroundCombo->setItemIcon(3,*i3);
    ui->foregroundCombo->setItemIcon(4,*i4);
    ui->foregroundCombo->setItemIcon(5,*i5);
    ui->foregroundCombo->setItemIcon(6,*i6);
    ui->foregroundCombo->setItemIcon(7,*i7);
    ui->foregroundCombo->setItemIcon(8,*i8);
    ui->foregroundCombo->setItemIcon(9,*i9);
    ui->foregroundCombo->setItemIcon(10,*i10);
    ui->foregroundCombo->setItemIcon(11,*i11);
    ui->foregroundCombo->setItemIcon(12,*i12);
    ui->foregroundCombo->setItemIcon(13,*i13);
    ui->foregroundCombo->setItemIcon(14,*i14);
    ui->foregroundCombo->setItemIcon(15,*i15);
    ui->foregroundCombo->setItemIcon(16,*i16);
    //----------------------------------------------------
            ui->backgroundCombo->setItemIcon(0,*i16);
            ui->backgroundCombo->setItemIcon(1,*i0);
            ui->backgroundCombo->setItemIcon(2,*i1);
            ui->backgroundCombo->setItemIcon(3,*i2);
            ui->backgroundCombo->setItemIcon(4,*i3);
            ui->backgroundCombo->setItemIcon(5,*i4);
            ui->backgroundCombo->setItemIcon(6,*i5);
            ui->backgroundCombo->setItemIcon(7,*i6);
            ui->backgroundCombo->setItemIcon(8,*i7);
            ui->backgroundCombo->setItemIcon(9,*i8);
            ui->backgroundCombo->setItemIcon(10,*i9);
            ui->backgroundCombo->setItemIcon(11,*i10);
            ui->backgroundCombo->setItemIcon(12,*i11);
            ui->backgroundCombo->setItemIcon(13,*i12);
            ui->backgroundCombo->setItemIcon(14,*i13);
            ui->backgroundCombo->setItemIcon(15,*i14);
            ui->backgroundCombo->setItemIcon(16,*i15);

//    QPixmap pixmap3(":/Editing-Align-Left-icon.png");
//    QIcon leftIcon(pixmap3);
//    ui->alignLeft->setIcon(leftIcon);
//    ui->alignLeft->setIconSize(QSize(25,25));

    saved = false;
    foregroundColor=Qt::black;
    backgroundColor=Qt::white;
    QIcon *if0 = new QIcon(":/new/colors/0f.png");
    QIcon *ib0 = new QIcon(":/new/colors/16b.png");

    ui->forecolor->setIcon(*if0);
    ui->backcolor->setIcon(*ib0);
    fileName ="";
}