dialogAnalog::dialogAnalog( int nbbits,QWidget * parent, Qt::WFlags f) : QDialog(parent, f) { setupUi(this); connect(chkBCapture, SIGNAL(stateChanged(int)), this, SLOT(updatecapture(int))); connect(pbZoomIn, SIGNAL(clicked()), this, SLOT(zoomin())); connect(pbZoomOut, SIGNAL(clicked()), this, SLOT(zoomout())); connect(pbFit, SIGNAL(clicked()), this, SLOT(fitmarkers())); connect(hlScrollBar, SIGNAL(valueChanged(int)), this, SLOT(scroll(int))); connect(pbSave, SIGNAL(clicked()), this, SLOT(slotSave())); connect(pbLoad, SIGNAL(clicked()), this, SLOT(slotLoad())); connect(pbMarker, SIGNAL(clicked()), this, SLOT(slotMarker())); connect(twWatchPoint, SIGNAL(currentItemChanged ( QTreeWidgetItem * , QTreeWidgetItem * )), this, SLOT(slotChangeWatchPoint( QTreeWidgetItem * , QTreeWidgetItem * ))); connect(mainwindow,SIGNAL(DestroySignal(CPObject*)),this,SLOT(DestroySlot(CPObject*))); Capture = false; NbBits = nbbits; m_zoom = 1.0; pPC = 0; currentWatchPoint = 0; currentWatchPointSize=8; fill_twWatchPoint(); twWatchPoint->expandAll(); }
void MainWindow::work() { QString fileName=pathE->text(); for(int i=0;i<fileName.length();i++) if(fileName[i]=='\\') fileName[i]='/'; int picNum=numE->text().toInt(); wd=new ImageWidget(NULL,fileName,picNum); matchFBtn->setVisible(wd->tp.linev.size()==Hei); findMBtn->setVisible(true); findSBtn->setVisible(true); preBtn->setVisible(true); addBtn->setVisible(true); delBtn->setVisible(true); redoBtn->setVisible(true); nextBtn->setVisible(true); zinBtn->setVisible(true); zoutBtn->setVisible(true); // listSBtn->setVisible(true); connect(listSBtn,SIGNAL(clicked()),this,SLOT(listSameLine())); connect(findMBtn,SIGNAL(clicked()),this,SLOT(findMatch())); connect(findSBtn,SIGNAL(clicked()),this,SLOT(findSameLine())); connect(preBtn,SIGNAL(clicked()),this,SLOT(getPre())); connect(nextBtn,SIGNAL(clicked()),this,SLOT(getNext())); connect(addBtn,SIGNAL(clicked()),this,SLOT(addEdge())); connect(delBtn,SIGNAL(clicked()),this,SLOT(delEdge())); connect(redoBtn,SIGNAL(clicked()),this,SLOT(redo())); connect(dispBtn,SIGNAL(clicked()),this,SLOT(disp())); connect(matchFBtn,SIGNAL(clicked()),this,SLOT(matchFinall())); connect(zinBtn,SIGNAL(clicked()),this,SLOT(zoomin())); connect(zoutBtn,SIGNAL(clicked()),this,SLOT(zoomout())); updateLayout(); wd->show(); }
cqDialogGraph::cqDialogGraph(QWidget *parent) :QDialog(parent) ,dialog_ui(new Ui::DialogGraph) ,m_scaleFactor(5.0) { dialog_ui->setupUi(this); connect(dialog_ui->pushButtonClose, SIGNAL(clicked()), this, SLOT(accept())); connect(dialog_ui->pushButtonZoomOut, SIGNAL(clicked()), this, SLOT(zoomout())); connect(dialog_ui->pushButtonZoomIn, SIGNAL(clicked()), this, SLOT(zoomin())); /*connect(dialog_ui->checkBoxAutoResize, SIGNAL(stateChanged(int)), this, SLOT(autoResizeChanged(int)));*/ connect(dialog_ui->pushButtonSave, SIGNAL(clicked()), this, SLOT(savetoimagefile())); connect(dialog_ui->pushButtonSaveDot, SIGNAL(clicked()), this, SLOT(savetodotfile())); }
cqDialogGraph::cqDialogGraph(QWidget *parent) :QDialog(parent) ,dialog_ui(new Ui::DialogGraph) ,m_scaleFactor(5.0) { dialog_ui->setupUi(this); connect(dialog_ui->pushButtonClose, SIGNAL(clicked()), this, SLOT(accept())); connect(dialog_ui->pushButtonZoomOut, SIGNAL(clicked()), this, SLOT(zoomout())); connect(dialog_ui->pushButtonZoomIn, SIGNAL(clicked()), this, SLOT(zoomin())); connect(dialog_ui->pushButtonSave, SIGNAL(clicked()), this, SLOT(savetoimagefile())); connect(dialog_ui->pushButtonSaveDot, SIGNAL(clicked()), this, SLOT(savetodotfile())); connect(dialog_ui->comboBoxNbrOfLevels, SIGNAL(currentIndexChanged(int)), this, SLOT(numberOfLevelsChanged(int))); }
void TopLevel::wheelEvent( QWheelEvent *e ) { e->accept(); if ( e->state() & ShiftButton ) { if ( e->delta() < 0 ) zoomin(); else zoomout(); } else { int offset = QApplication::wheelScrollLines()*vsb->lineStep(); if ( e->state() & ControlButton ) offset = vsb->pageStep(); offset = -e->delta()*offset/120; vsb->setValue( vsb->value() + offset ); } }
void TopLevel::setupMenuBar() { // File menu KStdAction::open( this, SLOT( faxOpen() ), actionCollection() ); actRecent = KStdAction::openRecent( this, SLOT( faxOpen( const KURL & ) ), actionCollection() ); actSave = KStdAction::save( this, SLOT( faxSave() ), actionCollection() ); actSaveAs = KStdAction::saveAs( this, SLOT( faxSaveAs() ), actionCollection() ); actPrint = KStdAction::print( this, SLOT( print() ), actionCollection() ); KStdAction::quit( this, SLOT( close() ), actionCollection() ); actAdd = new KAction( i18n( "A&dd..." ), "filenew", KShortcut(), this, SLOT( faxAdd() ), actionCollection(), "file_add_fax" ); actRecent->setMaxItems( 5 ); // View Menu actSize = KStdAction::actualSize( this, SLOT( actualSize() ), actionCollection() ); actZoomIn = KStdAction::zoomIn( this, SLOT( zoomin() ), actionCollection() ); actZoomOut = KStdAction::zoomOut( this, SLOT( zoomout() ), actionCollection() ); actRotate = new KAction( i18n( "&Rotate Page" ), "rotate", KShortcut(), this, SLOT( rotatePage() ), actionCollection(), "view_rotate" ); actMirror = new KAction( i18n( "Mirror Page" ), KShortcut(), this, SLOT( mirrorPage() ), actionCollection(), "view_mirror" ); actFlip = new KAction( i18n( "&Flip Page" ), KShortcut(), this, SLOT( flipPage() ), actionCollection(), "view_flip" ); // Go menu actNext = KStdAction::next( this, SLOT( nextPage() ), actionCollection() ); actPrev = KStdAction::prior( this, SLOT( prevPage() ), actionCollection() ); actFirst = KStdAction::firstPage( this, SLOT( firstPage() ), actionCollection() ); actLast = KStdAction::lastPage( this, SLOT( lastPage() ), actionCollection() ); // Settings menu KStdAction::preferences( this, SLOT( faxoptions() ), actionCollection() ); }
void key_events(t_env *w) { shape(w); move(w); choose_mode(w); if (w->inkeys[SDL_SCANCODE_MINUS]) iteration_less(w); if (w->inkeys[SDL_SCANCODE_EQUALS]) iteration_more(w); if (w->inkeys[SDL_SCANCODE_M]) zoomin(w); if (w->inkeys[SDL_SCANCODE_N]) zoomout(w); if (w->inkeys[SDL_SCANCODE_V]) setcursor(w); if (w->inkeys[SDL_SCANCODE_P]) { w->posx = 0; w->posy = 0; } }
/*! MyWindow constructor * \param w - window width * \param h - window hight */ MyWindow::MyWindow(int w, int h) : num_of_colors(18) { myBar = new QTabWidget(this); setCentralWidget(myBar); m_width = w; m_height = h; tab_number = 0; number_of_tabs = 0; testlayer = new Qt_layer( myBar ); colors_flag = true; statusBar(); m_scailing_factor = 2; // Traits Group QActionGroup *traitsGroup = new QActionGroup( this ); // Connected later traitsGroup->setExclusive( TRUE ); /*setSegmentTraits = new QAction("Segment Traits", QPixmap( (const char**)line_xpm ), "&Segment Traits", 0 ,traitsGroup, "Segment Traits" ); setSegmentTraits->setToggleAction( TRUE ); setPolylineTraits = new QAction("Polyline Traits", QPixmap( (const char**)polyline_xpm ), "&Polyline Traits", 0 , traitsGroup, "Polyline Traits" ); setPolylineTraits->setToggleAction( TRUE ); #ifdef CGAL_USE_CORE setConicTraits = new QAction("Conic Traits", QPixmap( (const char**)conic_xpm ), "&Conic Traits", 0 , traitsGroup, "Conic Traits" ); setConicTraits->setToggleAction( TRUE ); #endif */ // Snap Mode Group setSnapMode = new QAction("Snap Mode", QPixmap( (const char**)snapvertex_xpm ), "&Snap Mode", 0 , this, "Snap Mode" ); setSnapMode->setToggleAction( TRUE ); setGridSnapMode = new QAction("Grid Snap Mode", QPixmap( (const char**)snapgrid_xpm ), "&Grid Snap Mode", 0 , this, "Grid Snap Mode" ); setGridSnapMode->setToggleAction( TRUE ); // insert - delete - point_location Mode Group QActionGroup *modeGroup = new QActionGroup( this ); // Connected later modeGroup->setExclusive( TRUE ); insertMode = new QAction("Insert", QPixmap( (const char**)insert_xpm ), "&Insert", 0 , modeGroup, "Insert" ); insertMode->setToggleAction( TRUE ); deleteMode = new QAction("Delete", QPixmap( (const char**)delete_xpm ), "&Delete", 0 , modeGroup, "Delete" ); deleteMode->setToggleAction( TRUE ); pointLocationMode = new QAction("PointLocation", QPixmap( (const char**)pointlocation_xpm ), "&Point Location", 0 , modeGroup, "Point Location" ); pointLocationMode->setToggleAction( TRUE ); dragMode = new QAction("Drag", QPixmap( (const char**)hand_xpm ), "&Drag", 0 , modeGroup, "Drag" ); dragMode->setToggleAction( TRUE ); // zoom in zoominBt = new QAction("Zoom in", QPixmap( (const char**)zoomin_xpm ), "&Zoom in", 0 , this, "Zoom in" ); // zoom out zoomoutBt = new QAction("Zoom out", QPixmap( (const char**)zoomout_xpm ), "&Zoom out", 0 , this, "Zoom out" ); // color dialog color_dialog_bt = new QAction("Choose color", QPixmap( (const char**)demo_colors_xpm ), "&choose color", 0 , this, "choose color" ); // Cartograms carto_new = new QAction("New instance", QPixmap( (const char**)carto_new_xpm ), "&New instance", 0 , this, "New instance" ); carto_weights = new QAction("Set weights", QPixmap( (const char**)carto_weights_xpm ), "&Set weights", 0 , this, "Set weights" ); carto_start = new QAction("Start Cartogram", QPixmap( (const char**)carto_start_xpm ), "&Start Cartogram", 0 , this, "Start Cartogram" ); carto_it = new QAction("Next step", QPixmap( (const char**)carto_nextIt_xpm ), "&Next step", 0 , this, "Next step" ); /* #ifdef CGAL_USE_CORE // Conic Type Group QActionGroup *conicTypeGroup = new QActionGroup( this ); // Connected later conicTypeGroup->setExclusive( TRUE ); setCircle = new QAction("Circle", QPixmap( (const char**)demo_conic_circle_xpm ), "&Circle", 0 ,conicTypeGroup, "Circle" ); setCircle->setToggleAction( TRUE ); setSegment = new QAction("Segment", QPixmap( (const char**)demo_conic_segment_xpm ), "&Segment", 0 ,conicTypeGroup, "Segment" ); setSegment->setToggleAction( TRUE ); setEllipse = new QAction("Ellipse", QPixmap( (const char**)demo_conic_ellipse_xpm ), "&Ellipse", 0 ,conicTypeGroup, "Ellipse" ); setEllipse->setToggleAction( TRUE ); setParabola = new QAction("3 Points Arc", QPixmap( (const char**)demo_conic_3points_xpm ), "&3 Points Arc", 0 ,conicTypeGroup, "3 Points Arc" ); setParabola->setToggleAction( TRUE ); setHyperbola = new QAction("5 Points Arc", QPixmap( (const char**)demo_conic_5points_xpm ), "&5 Points Arc", 0 ,conicTypeGroup, "5 Points Arc" ); setHyperbola->setToggleAction( TRUE ); #endif */ //create a timer for checking if somthing changed QTimer *timer = new QTimer( this ); connect( timer, SIGNAL(timeout()), this, SLOT(timer_done()) ); timer->start( 200, FALSE ); // file menu QPopupMenu * file = new QPopupMenu( this ); menuBar()->insertItem( "&File", file ); /* file->insertItem("&Open Segment File...", this, SLOT(fileOpenSegment())); file->insertItem("&Open Polyline File...", this, SLOT(fileOpenPolyline()));\ file->insertItem("&Open Segment Arr File...", this, SLOT(fileOpenSegmentPm())); file->insertItem("&Open Polyline Arr File...", this, SLOT(fileOpenPolylinePm())); file->insertItem("&Open Conic Pm File", this, SLOT(fileOpenConicPm())); */ file->insertItem("&Open Input File...", this, SLOT(fileOpenSegment())); file->insertItem("&Open Output File...", this, SLOT(fileOpenConic())); file->insertItem("&Save...", this, SLOT(fileSave())); file->insertItem("&Save As...", this, SLOT(fileSaveAs())); //file->insertItem("&Save to ps...", this, SLOT(fileSave_ps())); file->insertSeparator(); file->insertItem("&Print...", this , SLOT(print())); file->insertSeparator(); file->insertItem( "&Close", this, SLOT(close()), CTRL+Key_X ); file->insertItem( "&Quit", qApp, SLOT( closeAllWindows() ), CTRL+Key_Q ); menuBar()->insertSeparator(); // tab menu QPopupMenu * tab = new QPopupMenu( this ); menuBar()->insertItem( "&Tab", tab ); /* tab->insertItem("Add &Segment Tab", this, SLOT(add_segment_tab())); tab->insertItem("Add &Polyline Tab", this, SLOT(add_polyline_tab())); #ifdef CGAL_USE_CORE tab->insertItem("Add &Conic Tab", this, SLOT(add_conic_tab())); tab->insertSeparator(); #endif */ tab->insertItem("Remove &Tab", this, SLOT(remove_tab())); menuBar()->insertSeparator(); // mode menu QPopupMenu * mode = new QPopupMenu( this ); menuBar()->insertItem( "&Mode", mode ); insertMode->addTo( mode ); deleteMode->addTo( mode ); pointLocationMode->addTo( mode ); dragMode->addTo( mode ); menuBar()->insertSeparator(); // snap mode menu QPopupMenu * snap_mode = new QPopupMenu( this ); menuBar()->insertItem( "&Snap mode", snap_mode ); setSnapMode->addTo(snap_mode); setGridSnapMode->addTo(snap_mode); menuBar()->insertSeparator(); // traits menu /*QPopupMenu * traits = new QPopupMenu( this ); menuBar()->insertItem( "&Traits Type", traits ); setSegmentTraits->addTo(traits); setPolylineTraits->addTo(traits); #ifdef CGAL_USE_CORE setConicTraits->addTo(traits); #endif */ // options menu QPopupMenu * options = new QPopupMenu( this ); menuBar()->insertItem( "&Options", options ); options->insertSeparator(); //options->insertItem("Overlay...", this, SLOT(overlay_pm())); options->insertSeparator(); options->insertItem("Properties...", this, SLOT(properties())); options->insertSeparator(); options->insertItem("Show Grid", this, SLOT(showGrid())); options->insertItem("Hide Grid", this, SLOT(hideGrid())); options->insertSeparator(); //options->insertItem("Conic Type", this, SLOT(conicType())); //options->insertSeparator(); options->insertItem("Unbounded Face Color...", this, SLOT(backGroundColor())); options->insertSeparator(); options->insertItem("Edge Color...", this, SLOT(changeEdgeColor())); options->insertSeparator(); options->insertItem("Vertex Color...", this, SLOT(changeVertexColor())); options->insertSeparator(); /*options->insertItem("Point-Locaiton Strategy....", this , SLOT(pointLocationStrategy())); */ QToolBar *modeTools = new QToolBar( this, "mode operations" ); modeTools->setLabel( "Mode Operations" ); insertMode->addTo( modeTools ); deleteMode->addTo( modeTools ); pointLocationMode->addTo( modeTools ); dragMode->addTo( modeTools ); modeTools->addSeparator(); QToolBar *snapModeTools = new QToolBar( this, "snapMode operations" ); snapModeTools->setLabel( "Snap Mode Operations" ); snapModeTools->addSeparator(); setSnapMode->addTo( snapModeTools ); setGridSnapMode->addTo( snapModeTools ); snapModeTools->addSeparator(); /*QToolBar *traitsTool = new QToolBar( this, "traits type" ); traitsTool->setLabel( "Traits Type" ); traitsTool->addSeparator(); setSegmentTraits->addTo( traitsTool ); setPolylineTraits->addTo( traitsTool ); #ifdef CGAL_USE_CORE setConicTraits->addTo( traitsTool ); #endif traitsTool->addSeparator(); */ QToolBar *zoomTool = new QToolBar( this, "zoom" ); zoomTool->setLabel( "Zoom" ); zoomTool->addSeparator(); zoomoutBt->addTo( zoomTool ); zoominBt->addTo( zoomTool ); zoomTool->addSeparator(); QToolBar *colorTool = new QToolBar( this, "color" ); colorTool->addSeparator(); colorTool->setLabel("Choose color"); color_dialog_bt->addTo(colorTool); colorTool->addSeparator(); QToolBar *cartoTool = new QToolBar( this, "cartograms" ); cartoTool->addSeparator(); cartoTool->setLabel("Cartograms"); carto_new->addTo(cartoTool); carto_weights->addTo(cartoTool); carto_start->addTo(cartoTool); carto_it->addTo(cartoTool); cartoTool->addSeparator(); /* #ifdef CGAL_USE_CORE conicTypeTool = new QToolBar( this, "conic type" ); conicTypeTool->setLabel( "Conic Type" ); conicTypeTool->addSeparator(); setSegment->addTo( conicTypeTool ); setCircle->addTo( conicTypeTool ); setEllipse->addTo( conicTypeTool ); setParabola->addTo( conicTypeTool ); setHyperbola->addTo( conicTypeTool ); #endif */ connect( zoomoutBt, SIGNAL( activated () ) , this, SLOT( zoomout() ) ); connect( zoominBt, SIGNAL( activated () ) , this, SLOT( zoomin() ) ); connect (color_dialog_bt , SIGNAL( activated()) , this , SLOT(openColorDialog() ) ); // connect mode group connect( modeGroup, SIGNAL( selected(QAction*) ), this, SLOT( updateMode(QAction*) ) ); // connect Traits Group /* connect( traitsGroup, SIGNAL( selected(QAction*) ), this, SLOT( updateTraitsType(QAction*) ) ); #ifdef CGAL_USE_CORE // connect Conic Type Group connect( conicTypeGroup, SIGNAL( selected(QAction*) ), this, SLOT( updateConicType(QAction*) ) ); #endif */ // connect Snap Mode connect( setSnapMode, SIGNAL( toggled( bool ) ) , this, SLOT( updateSnapMode( bool ) ) ); connect( setGridSnapMode, SIGNAL( toggled( bool ) ) , this, SLOT( updateGridSnapMode( bool ) ) ); // connect the change of current tab connect( myBar, SIGNAL( currentChanged(QWidget * ) ), this, SLOT( update() ) ); // connect cartogram actions connect( carto_start, SIGNAL( activated () ) , this, SLOT( cartogram_start() ) ); connect( carto_weights, SIGNAL( activated () ) , this, SLOT( cartogram_weights() ) ); connect( carto_it, SIGNAL( activated () ) , this, SLOT( print_all_weights())); connect( carto_new, SIGNAL( activated () ) , this, SLOT( cartogram_balance() ) ); colors = new QColor[num_of_colors]; colors[0] = Qt::blue; colors[1] = Qt::gray; colors[2] = Qt::green; colors[3] = Qt::cyan; colors[4] = Qt::magenta; colors[5] = Qt::darkRed; colors[6] = Qt::darkGreen; colors[7] = Qt::darkBlue; colors[8] = Qt::darkMagenta; colors[9] = Qt::darkCyan; colors[10] = Qt::yellow; colors[11] = Qt::white; colors[12] = Qt::darkGray; colors[13] = Qt::gray; colors[14] = Qt::red; colors[15] = Qt::cyan; colors[16] = Qt::darkYellow; colors[17] = Qt::lightGray; //state flag old_state = 0; add_conic_tab(); resize(m_width,m_height); }
void process_input (void) { SDL_Event event; int key; while (SDL_PollEvent (&event)) { key = event.key.keysym.sym; switch (event.type) { case SDL_QUIT: exit (0); case SDL_KEYDOWN: switch (key) { case SDLK_UP: case 'w': arrowkey[UP] = 1; break; case SDLK_DOWN: case 's': arrowkey[DOWN] = 1; break; case SDLK_LEFT: case 'a': arrowkey[LEFT] = 1; if (mousebutton[3] == 1 || mousebutton[2] == 1) arrowkey[FAKE_Q] = 1; break; case SDLK_RIGHT: case 'd': arrowkey[RIGHT] = 1; if (mousebutton[3] == 1 || mousebutton[2] == 1) arrowkey[FAKE_E] = 1; break; case 'q': arrowkey[Q] = 1; break; case 'e': arrowkey[E] = 1; break; case ' ': if (0) { if (player.p.z <= ground_height (&player.p) && player.movtype == GROUNDED) { player.p.z += 1e-6; player.vel.z = 25; player.movtype = FALLING; } } break; case 'r': player.p.x = 0; player.p.y = 0; player.p.z = ground_height (&player.p); break; case 'u': player.p.z = ground_height (&player.p) + 50; player.movtype = FALLING; break; case 'm': printf ("%8.3f %8.3f %8.3f, %8.3f, %8.3f\n", player.p.x, player.p.y, player.p.z, player.theta, playercamera.theta); break; case 'p': if (paused == NO) { paused = YES; } else { paused = NO; } break; case 't': player.p.x = 42.010; player.p.y = 60.977; player.p.z = 0.203; player.theta = 1.441; playercamera.theta = 4.583; break; case 'y': player.p.x = 63.293; player.p.y = 78.532; player.p.z = .203; break; case 'n': vset (&player.vel, 0, 0, 0); break; } break; case SDL_KEYUP: switch (key) { case SDLK_ESCAPE: exit (0); case SDLK_UP: case 'w': arrowkey[UP] = 0; break; case SDLK_DOWN: case 's': arrowkey[DOWN] = 0; break; case SDLK_LEFT: case 'a': arrowkey[LEFT] = 0; if (arrowkey[FAKE_Q]) arrowkey[FAKE_Q] = 0; break; case SDLK_RIGHT: case 'd': arrowkey[RIGHT] = 0; if (arrowkey[FAKE_E]) arrowkey[FAKE_E] = 0; break; case 'q': arrowkey[Q] = 0; break; case 'e': arrowkey[E] = 0; break; } case SDL_MOUSEBUTTONDOWN: mousebutton[event.button.button] = 1; switch (event.button.button) { case 1: leftclickdown (); break; case 2: middleclickdown (); break; case 3: rightclickdown (); break; case 4: zoomin (); break; case 5: zoomout (); break; } break; case SDL_MOUSEBUTTONUP: mousebutton[event.button.button] = 0; switch (event.button.button) { case 1: leftclickup (); break; case 2: middleclickup (); break; case 3: rightclickup (); break; case 4: zoomin (); break; case 5: zoomout (); break; } break; case SDL_MOUSEMOTION: mouse_x = event.button.x; mouse_y = event.button.y; break; } } }
void TopLevel::handle_X_event(XEvent Event) { if(!thispage || !Image || !faxqtwin || !display_is_setup) return; bool putimage = false; // Do we actually have to write the image to the scree? do { switch(Event.type) { case MappingNotify: XRefreshKeyboardMapping((XMappingEvent *)(&Event)); break; case LeaveNotify: /* buttondown = false; XDefineCursor(qtdisplay, Win, ReadyCursor); XFlush(qtdisplay);*/ break; case Expose: { if(Event.xexpose.count != 0) break; if(!Image) break; putimage = TRUE; } break; case KeyPress: if (ExpectConfNotify && (Event.xkey.time < (Lasttime + PATIENCE))) break; Lasttime = Event.xkey.time; ExpectConfNotify = 0; switch(XKeycodeToKeysym(qtdisplay, Event.xkey.keycode, 0)) { case XK_m: mirrorPage(); if (Event.xkey.state & ShiftMask) TurnFollowing(TURN_M, thispage->next); break; case XK_o: zoomout(); break; case XK_i: zoomin(); break; case XK_Up: ypos-= qwindow_height / 3; putimage = TRUE; break; case XK_Down: ypos+= qwindow_height / 3; putimage = TRUE; break; case XK_Left: xpos-= qwindow_width / 4; putimage = TRUE; break; case XK_Right: xpos+= qwindow_width / 4; putimage = TRUE; break; case XK_Home: case XK_R7: if (Event.xkey.state & ShiftMask) { thispage = firstpage; newPage(); resizeView(); putImage(); break; } xpos= 0; ypos= 0; putImage(); break; case XK_End: case XK_R13: if (Event.xkey.state & ShiftMask) { thispage = lastpage; newPage(); resizeView(); putImage(); break; } xpos= Image->width; ypos= Image->height; putImage(); break; case XK_l: case XK_r: rotatePage(); if (Event.xkey.state & ShiftMask) TurnFollowing(TURN_L, thispage->next); break; case XK_p: case XK_minus: case XK_Prior: case XK_R9: case XK_BackSpace: prevPage(); break; case XK_n: case XK_plus: case XK_space: case XK_Next: case XK_R15: nextPage(); break; case XK_u: flipPage(); if (Event.xkey.state & ShiftMask) TurnFollowing(TURN_U, thispage->next); break; case XK_q: if (viewpage) { thispage = viewpage; viewpage = NULL; newPage(); resizeView(); putImage(); } } break; case ButtonPress: if (ExpectConfNotify && (Event.xbutton.time < (Lasttime + PATIENCE))) break; Lasttime = Event.xbutton.time; ExpectConfNotify = 0; switch (Event.xbutton.button) { case Button1: buttondown = true; switch (((Image->width > qwindow_width)<<1) | (Image->height > qwindow_height)) { case 0: break; case 1: XDefineCursor(qtdisplay, Win, UDCursor); break; case 2: XDefineCursor(qtdisplay, Win, LRCursor); break; case 3: XDefineCursor(qtdisplay, Win, MoveCursor); } XFlush(qtdisplay); offx = Event.xbutton.x; offy = Event.xbutton.y; break; } break; case MotionNotify: if(!buttondown) break; do { nx = Event.xmotion.x; ny = Event.xmotion.y; } while (XCheckTypedEvent(qtdisplay, MotionNotify, &Event)); xpos+= offx - nx; ypos+= offy - ny; offx = nx; offy = ny; putimage = TRUE; break; case ButtonRelease: if (Event.xbutton.button == Button1) { buttondown = false; XDefineCursor(qtdisplay, Win, ReadyCursor); XFlush(qtdisplay); } } } while (XCheckWindowEvent(qtdisplay, Win, KeyPressMask|ButtonPressMask, &Event)); if(putimage == TRUE) { Refresh = Resize = 1; putImage(); } }