void VoxelEditor::keyPressEvent(QKeyEvent *e) { int key = e->key(); int tool = window->get_tool(); switch (key) { case Qt::Key_C: if (e->modifiers() & Qt::ControlModifier) copy_selected(); else pick_color(); break; case Qt::Key_V: if (e->modifiers() & Qt::ControlModifier) paste(); break; case Qt::Key_Insert: use_tool_primary(true); break; case Qt::Key_Delete: if (tool == POINTER_EDIT_TOOL) delete_selected(); else use_tool_secondary(true); break; case Qt::Key_Left: window->set_animation_frame(false); break; case Qt::Key_Right: window->set_animation_frame(true); break; } }
void line_edit_control::delete_word_forward() { set_key_state( ks_Shift, true ); move_pos_right_word(); compute_positions(); delete_selected( false ); set_key_state( ks_Shift, false ); }
void line_edit_control::delete_word_back() { set_key_state( ks_Shift, true ); move_pos_left_word(); compute_positions(); delete_selected( true ); set_key_state( ks_Shift, false ); }
void mainloop() { while (!done) { if (PeekMessage(&msg,NULL,0,0,PM_REMOVE)) { TranslateMessage(&msg); DispatchMessage(&msg); } else if (keys[VK_ESCAPE]) done=true; else { memcpy(tooltip,defaulttooltip,256); glClear(0x4100); switchto2d(); /*glPushAttrib(GL_ALL_ATTRIB_BITS); glDisable(GL_DEPTH_TEST); glDisable(GL_BLEND); glDisable(GL_LIGHTING); glDisable(GL_TEXTURE_2D); glBegin(GL_QUADS); glColor4d( 40.0/255.0, 75.0/255.0, 128.0/255.0,1.0); glVertex2i(0,0); glVertex2i(800,0); glColor4f(backgroundcol); glVertex2i(800,600); glVertex2i(0,600); glEnd(); glPopAttrib();*/ glBindTexture(GL_TEXTURE_2D,cubetex); /*glEnable(GL_TEXTURE_2D); //145*32 addict logo glColor4f(1,1,1,1); glBegin(GL_QUADS); glTexCoord2d(0,(255.0-31.0)/256.0); glVertex2i(800-144,0); glTexCoord2d(144.0/256.0,(255.0-31.0)/256.0); glVertex2i(800,0); glTexCoord2d(144.0/256.0,1.0); glVertex2i(800,31); glTexCoord2d(0,1.0); glVertex2i(800-144,31); glEnd(); glDisable(GL_TEXTURE_2D);*/ menu(DD_Check); if (keys[46] && (mainmenu==2)) { delete_selected(); keys[46]=false; } if (keys[65] && (mainmenu==2)) { { o=actualscene->objects; while (o!=NULL) { if (!o->effect) o->selected=true; o=o->next; } } keys[65]=false; } if (keys[78] && (mainmenu==2)) { { o=actualscene->objects; while (o!=NULL) { o->selected=false; o=o->next; } } keys[78]=false; } if (keys[73] && (mainmenu==2)) { { o=actualscene->objects; while (o!=NULL) { if (!o->effect) o->selected=!o->selected; o=o->next; } } keys[73]=false; } if (keys[77] && (mainmenu==2)) { for (int x=0; x<4; x++) modellviews[x].transformation=1; keys[77]=false; } if (keys[82] && (mainmenu==2)) { for (int x=0; x<4; x++) modellviews[x].transformation=2; keys[82]=false; } if (keys[83] && (mainmenu==2)) { for (int x=0; x<4; x++) modellviews[x].transformation=3; keys[83]=false; } if (keys[79] && (mainmenu==2)) { for (int x=0; x<4; x++) modellviews[x].centertransform=!modellviews[x].centertransform; keys[79]=false; } //if (keys[79] && (mainmenu==2)) { sprintf(s2s,"eye: %.3f %.3f %.3f\n dest: %.3f %.3f %.3f",modellviews[3].cam2.eye.b.x,modellviews[3].cam2.eye.b.y,modellviews[3].cam2.eye.b.z,modellviews[3].cam2.target.b.x,modellviews[3].cam2.target.b.y,modellviews[3].cam2.target.b.z); MessageBox( 0, s2s, "HelloWorld", MB_OK ); keys[79]=false; } menu(DD_Draw); if ((strlen(cursorstring)!=0)) //&& (leftbutton || rightbutton)) { glColor4f(1,1,1,1); if (leftbutton) { line(lx-5,ly,lx+5,ly); line(lx,ly-5,lx,ly+5); } glDisable(GL_DEPTH_TEST); glRasterPos2i(mx+15,my+15); glPrint(cursorstring,base2); glEnable(GL_DEPTH_TEST); memset(cursorstring,0,256); } glColor4f(buttontextlit); /*glRasterPos2i(495,14); glPrint(tooltip,base);*/ glColor4f(1,1,1,1); SwapBuffers(hDC); menu(DD_AfterCheck); if (waitleftbutton) {waitforleftbuttonrelease(); waitleftbutton=false;} if (waitrightbutton) {waitforrightbuttonrelease(); waitrightbutton=false;} if (keys[VK_ESCAPE]) {done=false; keys[VK_ESCAPE]=false;} if (leftbutton || rightbutton || middlebutton) SetCapture(hWnd); else ReleaseCapture(); wheel=0; Sleep(10); } } }
void line_edit_control::delete_selected_forward() { delete_selected( false ); }
void line_edit_control::delete_selected_back() { delete_selected( true ); }