void MainWindow::createActions() { //exportAct = new QAction(tr("&Export as ..."),this); //exportAct->setShortcut(tr("Ctrl+E")); //connect(exportAct, SIGNAL(triggered()), this, SLOT(export_as())); zoomAllAct = new QAction(QIcon(":/images/home.png"),tr("Zoom All"),this); connect(zoomAllAct, SIGNAL(triggered()), this, SLOT(zoom_all())); zoomBoxAct = new QAction(QIcon(":/images/zoombox.png"),tr("Zoom To Box"),this); zoomBoxAct->setCheckable(true); connect(zoomBoxAct, SIGNAL(triggered()), this, SLOT(zoom_to_box())); panAct = new QAction(QIcon(":/images/pan.png"),tr("Pan"),this); panAct->setCheckable(true); connect(panAct, SIGNAL(triggered()), this, SLOT(pan())); infoAct = new QAction(QIcon(":/images/info.png"),tr("Info"),this); infoAct->setCheckable(true); connect(infoAct, SIGNAL(triggered()), this, SLOT(info())); toolsGroup=new QActionGroup(this); toolsGroup->addAction(zoomBoxAct); toolsGroup->addAction(panAct); toolsGroup->addAction(infoAct); zoomBoxAct->setChecked(true); openAct=new QAction(tr("Open Map definition"),this); connect(openAct,SIGNAL(triggered()),this,SLOT(open())); saveAct=new QAction(tr("Save Map definition"),this); connect(saveAct,SIGNAL(triggered()),this,SLOT(save())); panLeftAct = new QAction(QIcon(":/images/left.png"),tr("&Pan Left"),this); connect(panLeftAct, SIGNAL(triggered()), this, SLOT(pan_left())); panRightAct = new QAction(QIcon(":/images/right.png"),tr("&Pan Right"),this); connect(panRightAct, SIGNAL(triggered()), this, SLOT(pan_right())); panUpAct = new QAction(QIcon(":/images/up.png"),tr("&Pan Up"),this); connect(panUpAct, SIGNAL(triggered()), this, SLOT(pan_up())); panDownAct = new QAction(QIcon(":/images/down.png"),tr("&Pan Down"),this); connect(panDownAct, SIGNAL(triggered()), this, SLOT(pan_down())); reloadAct = new QAction(QIcon(":/images/reload.png"),tr("Reload"),this); connect(reloadAct, SIGNAL(triggered()), this, SLOT(reload())); layerInfo = new QAction(QIcon(":/images/info.png"),tr("&Layer info"),layerTab_); connect(layerInfo, SIGNAL(triggered()), layerTab_,SLOT(layerInfo())); connect(layerTab_, SIGNAL(doubleClicked(QModelIndex const&)), layerTab_,SLOT(layerInfo2(QModelIndex const&))); foreach (QByteArray format, QImageWriter::supportedImageFormats()) { QString text = tr("%1...").arg(QString(format).toUpper()); QAction *action = new QAction(text, this); action->setData(format); connect(action, SIGNAL(triggered()), this, SLOT(export_as())); exportAsActs.append(action); }
void edit( int ch ) { struct viewporttype tmp; char key, *buff; take_char( ( char ) ch ); backup_char( ); getviewsettings( &tmp ); setviewport( 400, 30, getmaxx( ), getmaxy( ), 1 ); buff = ( char* ) malloc( imagesize( 0 + align, 0, X*( 2 + WIDTH_X ) + align, Y*( 2 + WIDTH_Y ) ) ); getimage( 0 + align, 0, X*( 2 + WIDTH_X ) + align, Y*( 2 + WIDTH_Y ), buff ); draw_char( ); start_clock( EDIT_FONT ); while ( ( key = get_pos( &pos_x, &pos_y, X - 1, Y - 1, 1, 1 ) ) != 3 ) { switch ( tolower( key ) ) { case 1: xor_dot( pos_x, pos_y ); continue; case '8': pan_up( ); draw_char( ); break; case '2': pan_down( ); draw_char( ); break; case '4': pan_left( ); draw_char( ); break; case '6': pan_right( ); draw_char( ); break; case 'r': insert_row( pos_y ); draw_char( ); break; case 'c': insert_col( pos_x ); draw_char( ); break; case 'e': del_row( pos_y ); draw_char( ); break; case 'd': del_col( pos_x ); draw_char( ); break; case 'i': invert( ); draw_char( ); break; case 'm': mirror( ); draw_char( ); break; case '.': ++draw_mode; switch ( draw_mode ) { case 0: break; case 1: put_dot( pos_x, pos_y ); edit_font[pos_x][pos_y] = ~0; break; case 2: square( pos_x, pos_y ); edit_font[pos_x][pos_y] = 0; break; case 3: draw_mode = 0; } continue; case 'u': undo( ); draw_char( ); goto exit; case '?': help( ); break; default: if ( draw_mode == 1 ) { put_dot( pos_x, pos_y ); edit_font[pos_x][pos_y] = ~0; } if ( draw_mode == 2 ) { square( pos_x, pos_y ); edit_font[pos_x][pos_y] = 0; } } } update_char( ( char ) ch ); exit: putimage( 0 + align, 0, buff, COPY_PUT ); free( buff ); stop_clock( ); dispblank( 50, 16, strlen( "Move mode" ), 0 ); setviewport( tmp.left, tmp.top, tmp.right, tmp.bottom, tmp.clip ); print_table( which_page( ch ) ); }