void SoXipPolygon::mouseDown( const SbVec3f& newPos ) { if( !isEditing() ) { if( point.getNum() == 0 ) point.set1Value( point.getNum(), newPos ); // If the shape can be closed and is consitent (big enough) if( canClose( newPos ) && isConsistent() ) { closed.setValue( TRUE ); // Remove the last point corresponding to the moving point. point.setNum( point.getNum() - 1 ); // Creation is done status.setValue( NONE ); } else { point.set1Value( point.getNum(), newPos ); } } }
void TextField::setText(const char * text) { reloadScroll(); m_contentView.setText(text); if (isEditing()) { setCursorLocation(draftTextLength()); } }
TRIGGER( use )(obj user) { int Q4Q1; obj Q491 = Q4SE(this); if(Q491 == NULL()) { return(0x00); } if(isDead(user)) { return(0x00); } if(isEditing(user) || Q4ZV(user, this)) { Q4Q1 = openContainer(user, Q491); } else { if(testSkill(user, 0x1C)) { Q4Q1 = openContainer(user, Q491); } else { ebarkTo(user, user, "You fail to peek into the animal's pack."); } } return(0x00); }
void SoXipPolygon::mouseUp( const SbVec3f& newPos ) { if( isEditing() ) return ; // If the shape can be closed and is consitent (big enough) if( canClose( newPos ) && isConsistent() ) { closed.setValue( TRUE ); // Remove the last point corresponding to the moving point. point.setNum( point.getNum() - 1 ); // Creation is done status.setValue( NONE ); } // If user keeps the mouse button pressed, then a point should // be added when the mouse is released. // But to prevent artefact points due to a fast click & move, // point are only added if the event is not considered as a // click. else if( (mMouseUpTime - mMouseDownTime) > mClickTime ) { if (*point.getValues(point.getNum() - 1) != newPos) point.set1Value( point.getNum(), newPos ); } }
TRIGGER( use )(obj user) { string Q58D; if(hasObjVar(this, "TrapMessageRange")) { int range = getObjVar(this, "TrapMessageRange"); if(hasObjVar(this, "TrapTheMessage")) { Q58D = getObjVar(this, "TrapTheMessage"); } else { Q58D = "blah"; } list Q4OK = list( user, Q58D ); messageToRange(getLocation(this), range, "TRAP", Q4OK); } if(hasObjVar(this, "isLocked")) { if(getDistanceInTiles(getLocation(this), getLocation(user)) < 0x04) { if(isEditing(user)) { barkTo(this, user, "It appears to be locked, but you open it with your godly powers."); } else { barkTo(this, user, "It appears to be locked."); return(0x00); } } } return(0x01); }
void SlimLineEdit::setText(QString text) { ui->lineEdit->setText(text); if (!isEditing()) { ui->label->setText(text); } }
QString SlimLineEdit::text() const { if(isEditing()) { return ui->lineEdit->text(); } else { return ui->label->text(); } }
void ShowBox::reload() { if (!isEditing()) { loadSize(); } loadTopmost(); }
void ContactView::setModified(bool modified) { if (isEditing()) { _modified = modified; setEnabledSaveContact (); } }
void System::completeKeyword(int index) { if (get_focus_edit() && isEditing()) { const char *help = get_focus_edit()->completeKeyword(index); if (help) { runtime->getOutput()->setStatus(help); runtime->getOutput()->redraw(); } } }
void ConnectionTable::sortColumn( int col, bool ascending, bool ) { horizontalHeader()->setSortIndicator( col, ascending ); if ( isEditing() ) endEdit( currEditRow(), currEditCol(), FALSE, FALSE ); QTable::sortColumn( col, ascending, TRUE ); setCurrentCell( 0, 0 ); emit resorted(); }
bool PlaylistItem::anyEditing() const { for( int i = 0; i < NUM_COLUMNS; i++ ) { if( isEditing( i ) ) return true; } return false; }
bool ContactView::CheckSaving() { if (isEditing() && isModyfied()) { QMessageBox::StandardButton ret; ret = QMessageBox::question(this, tr("Application"), tr("The contact has been modified.\nDo you want to save your changes ?"), QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel); if (ret == QMessageBox::Cancel) { ui->firstname->setFocus(); return false; } else { if (ret == QMessageBox::Yes) { if (isValid()) { onSave(); } else { ui->id_edit->setFocus(); ui->id_edit->selectAll(); QMessageBox::warning(this, tr("Application"), tr("Please correct the Keyhotee ID."), QMessageBox::Ok); return false; } } else { onCancel(); } setModyfied(false); } } else if (isEditing() && !isModyfied()) { onCancel(); } return true; }
void ContactView::checkSendMailButton() { auto app = bts::application::instance(); auto profile = app->get_profile(); auto idents = profile->identities(); send_mail->setEnabled(idents.size() > 0); request_contact->setEnabled(idents.size() > 0 && !_current_contact.isOwn() && !isEditing()); }
FUNCTION int Q4V0(obj Q57P) { if(isDead(Q57P)) { return(0x00); } if(isEditing(Q57P) || Q4ZV(Q57P, this)) { return(0x01); } return(0x00); }
bool TextField::handleEventWithText(const char * eventText, bool indentation, bool forceCursorRightOfText) { size_t previousTextLength = strlen(text()); size_t eventTextSize = strlen(eventText) + 1; char buffer[eventTextSize]; size_t bufferIndex = 0; /* DIRTY * We use the notation "_{}" to indicate a subscript layout. In a text field, * such a subscript should be written using parentheses. For instance: "u_{n}" * should be inserted as "u(n)". * We thus remove underscores and changes brackets into parentheses. */ bool specialUnderScore = false; for (size_t i = bufferIndex; i < eventTextSize; i++) { if (eventText[i] == '_') { specialUnderScore = ((i < eventTextSize - 1) && (eventText[i+1] == '{')) ? true : false; if (!specialUnderScore) { buffer[bufferIndex++] = '_'; } } else if (eventText[i] == '{' && specialUnderScore) { buffer[bufferIndex++] = '('; } else if (eventText[i] == '}' && specialUnderScore) { buffer[bufferIndex++] = ')'; specialUnderScore = false; } else { buffer[bufferIndex++] = eventText[i]; } } int cursorIndexInCommand = TextInputHelpers::CursorIndexInCommand(buffer); int newBufferIndex = 0; // Remove EmptyChars for (size_t i = newBufferIndex; i < bufferIndex; i++) { if (buffer[i] != Ion::Charset::Empty) { buffer[newBufferIndex++] = buffer[i]; } } if (!isEditing()) { setEditing(true); } int nextCursorLocation = draftTextLength(); if (insertTextAtLocation(buffer, cursorLocation())) { /* The cursor position depends on the text as we sometimes want to position * the cursor at the end of the text and sometimes after the first * parenthesis. */ nextCursorLocation = cursorLocation() + (forceCursorRightOfText? strlen(buffer) : cursorIndexInCommand); } setCursorLocation(nextCursorLocation); return m_delegate->textFieldDidHandleEvent(this, true, strlen(text()) != previousTextLength); }
void EditableLabel::setPalette(const QPalette &nPalette) { originalPalette = nPalette; QPalette p = nPalette; if (!isEditing()) { p.setBrush(QPalette::Base, p.window()); p.setBrush(QPalette::Text, p.windowText()); } QLineEdit::setPalette(p); }
//------------------------------------------------------------------------ CMouseEventResult COnOffButton::onMouseUp (CPoint& where, const CButtonState& buttons) { if (isEditing ()) { if (where.isInside (getViewSize ())) { value = (value == getMax ()) ? getMin () : getMax (); invalid (); valueChanged (); } endEdit (); } return kMouseEventHandled; }
QString PlaylistItem::text( int column ) const { if( column == Title && listView()->header()->sectionSize( Filename ) ) //don't show the filename twice return exactText( column ); else switch ( column ) { case Artist: case Composer: case Album: case Genre: case Comment: return exactText( column ); //HACK case Rating: return isEditing( column ) ? exactText( column ) : prettyText( column ); default: { if( column != Title && isEditing( column ) ) return editingText(); else return prettyText( column ); } } }
//------------------------------------------------------------------------ CMouseEventResult CCheckBox::onMouseMoved (CPoint& where, const CButtonState& buttons) { if (isEditing ()) { bool wasHilighted = hilight; if (where.isInside (getViewSize ())) hilight = true; else hilight = false; if (wasHilighted != hilight) invalid (); return kMouseEventHandled; } return kMouseEventNotHandled; }
//------------------------------------------------------------------------ CMouseEventResult CKickButton::onMouseMoved (CPoint& where, const CButtonState& buttons) { if (isEditing ()) { if (where.h >= getViewSize ().left && where.v >= getViewSize ().top && where.h <= getViewSize ().right && where.v <= getViewSize ().bottom) value = getMax (); else value = getMin (); if (isDirty ()) invalid (); return kMouseEventHandled; } return kMouseEventNotHandled; }
void VCCueList::addFunctions(QVariantList idsList, int insertIndex) { if (idsList.isEmpty()) return; if (isEditing()) { Chaser *ch = chaser(); if (ch == NULL) return; if (insertIndex == -1) insertIndex = ch->stepsCount(); for (QVariant vID : idsList) // C++11 { quint32 fid = vID.toUInt(); ChaserStep step(fid); if (ch->durationMode() == Chaser::PerStep) { Function *func = m_doc->function(fid); if (func == NULL) continue; step.duration = func->totalDuration(); if (step.duration == 0) step.duration = 1000; step.hold = step.duration; } Tardis::instance()->enqueueAction(Tardis::ChaserAddStep, ch->id(), QVariant(), insertIndex); ch->addStep(step, insertIndex++); } ChaserEditor::updateStepsList(m_doc, chaser(), m_stepsList); emit stepsListChanged(); } else { Function *f = m_doc->function(idsList.first().toUInt()); if (f == NULL || f->type() != Function::ChaserType) return; setChaserID(f->id()); } }
bool TextField::handleEvent(Ion::Events::Event event) { assert(m_delegate != nullptr); if (m_delegate->textFieldDidReceiveEvent(this, event)) { return true; } if (event.hasText()) { return handleEventWithText(event.text()); } if (event == Ion::Events::Paste) { return handleEventWithText(Clipboard::sharedClipboard()->storedText()); } if ((event == Ion::Events::OK || event == Ion::Events::EXE) && !isEditing()) { return handleEventWithText(m_contentView.textBuffer()); } size_t previousTextLength = strlen(text()); bool didHandleEvent = privateHandleEvent(event); return m_delegate->textFieldDidHandleEvent(this, didHandleEvent, strlen(text()) != previousTextLength); }
void SoXipPolygon::mouseMove( const SbVec3f& newPos ) { if( isEditing() ) { if( mControlPointId != -1 ) point.set1Value( mControlPointId, newPos ); } else { // Look if the mouse cursor is near the starting point. // If so it gets anchored to its position, and the user will be // able to close the shape later if( canClose( newPos ) ) point.set1Value( point.getNum() - 1, point[0] ); else point.set1Value( point.getNum() - 1, newPos ); } }
//------------------------------------------------------------------------ CMouseEventResult CTextButton::onMouseUp (CPoint& where, const CButtonState& buttons) { if (isEditing ()) { if (value != fEntryState) { valueChanged (); if (style == kKickStyle) { value = getMin (); // set button to UNSELECTED state valueChanged (); } if (isDirty ()) invalid (); } endEdit (); } return kMouseEventHandled; }
//------------------------------------------------------------------------ CMouseEventResult CMovieButton::onMouseMoved (CPoint& where, const CButtonState& buttons) { if (isEditing ()) { if (where.x >= getViewSize ().left && where.y >= getViewSize ().top && where.x <= getViewSize ().right && where.y <= getViewSize ().bottom) value = (fEntryState == getMax ()) ? getMin () : getMax (); else value = fEntryState; if (isDirty ()) valueChanged (); if (isDirty ()) invalid (); return kMouseEventHandled; } return kMouseEventNotHandled; }
void FileOrganiserWidget::newFolder() { if (!canCreateNewFolder()) // The conditions are not met to create a new folder, so... return; // Either create a folder item below the current folder item or below the // root item, depending on the situation QModelIndexList selectedIndexes = selectionModel()->selectedIndexes(); int selectedIndexesCount = selectedIndexes.count(); QStandardItem *crtItem = !selectedIndexesCount? mModel->invisibleRootItem(): mModel->itemFromIndex(selectedIndexes.first()); QStandardItem *newFolderItem = new QStandardItem(QIcon(CollapsedFolderIcon), newFolderName(crtItem)); newFolderItem->setData(true, Item::Folder); crtItem->appendRow(newFolderItem); // Some post-processing, but only if no other item is currently being edited if (!isEditing()) { // Expand the current index (so that we can see the new folder) // Note: this is only relevant in the case of a folder item being // currently selected (i.e. it's not the root folder item) if (selectedIndexesCount) setExpanded(crtItem->index(), true); // Offer the user to edit the newly added folder item edit(newFolderItem->index()); } // Resize the widget, just to be on the safe side resizeToContents(); }
void ContactView::setEnabledSaveContact () { save_contact->setEnabled(_validForm && isEditing() && isModified()); }
void System::showMenu() { logEntered(); if (!_menuActive) { _menuActive = true; char buffer[64]; if (_systemMenu != NULL) { delete [] _systemMenu; } StringList *items = new StringList(); int completions = 0; if (get_focus_edit() && isEditing()) { completions = get_focus_edit()->getCompletions(items, MAX_COMPLETIONS); } _systemMenu = new int[MENU_SIZE + completions]; int index = 0; if (get_focus_edit() != NULL) { if (isEditing()) { items->add(new String("Undo")); items->add(new String("Redo")); items->add(new String("Cut")); items->add(new String("Copy")); items->add(new String("Paste")); items->add(new String("Select All")); items->add(new String("Save")); items->add(new String("Run")); #if defined(_SDL) items->add(new String("Debug")); items->add(new String("Show Output")); #endif items->add(new String("Help")); for (int i = 0; i < completions; i++) { _systemMenu[index++] = MENU_COMPLETION_0 + i; } _systemMenu[index++] = MENU_UNDO; _systemMenu[index++] = MENU_REDO; _systemMenu[index++] = MENU_CUT; _systemMenu[index++] = MENU_COPY; _systemMenu[index++] = MENU_PASTE; _systemMenu[index++] = MENU_SELECT_ALL; _systemMenu[index++] = MENU_SAVE; _systemMenu[index++] = MENU_RUN; #if defined(_SDL) _systemMenu[index++] = MENU_DEBUG; _systemMenu[index++] = MENU_OUTPUT; #endif _systemMenu[index++] = MENU_HELP; } else if (isRunning()) { items->add(new String("Cut")); items->add(new String("Copy")); items->add(new String("Paste")); items->add(new String("Select All")); _systemMenu[index++] = MENU_CUT; _systemMenu[index++] = MENU_COPY; _systemMenu[index++] = MENU_PASTE; _systemMenu[index++] = MENU_SELECT_ALL; } #if defined(_SDL) items->add(new String("Back")); _systemMenu[index++] = MENU_BACK; #else items->add(new String("Show keypad")); _systemMenu[index++] = MENU_KEYPAD; if (!isEditing()) { bool controlMode = get_focus_edit()->getControlMode(); sprintf(buffer, "Control Mode [%s]", (controlMode ? "ON" : "OFF")); items->add(new String(buffer)); _systemMenu[index++] = MENU_CTRL_MODE; } #endif } else { items->add(new String("Console")); items->add(new String("View source")); _systemMenu[index++] = MENU_CONSOLE; _systemMenu[index++] = MENU_SOURCE; if (!isEditing()) { items->add(new String("Restart")); _systemMenu[index++] = MENU_RESTART; } #if !defined(_SDL) items->add(new String("Show keypad")); _systemMenu[index++] = MENU_KEYPAD; #endif items->add(new String("Screenshot")); _systemMenu[index++] = MENU_SCREENSHOT; if (_mainBas) { sprintf(buffer, "Font Size %d%%", _fontScale - FONT_SCALE_INTERVAL); items->add(new String(buffer)); sprintf(buffer, "Font Size %d%%", _fontScale + FONT_SCALE_INTERVAL); items->add(new String(buffer)); _systemMenu[index++] = MENU_ZOOM_UP; _systemMenu[index++] = MENU_ZOOM_DN; sprintf(buffer, "Editor [%s]", opt_ide == IDE_NONE ? "OFF" : "ON"); items->add(new String(buffer)); _systemMenu[index++] = MENU_EDITMODE; } #if !defined(_SDL) if (!_mainBas && !_activeFile.empty()) { items->add(new String("Desktop Shortcut")); items->add(new String("Share")); _systemMenu[index++] = MENU_SHORTCUT; _systemMenu[index++] = MENU_SHARE; } #endif sprintf(buffer, "Audio [%s]", (opt_mute_audio ? "OFF" : "ON")); items->add(new String(buffer)); _systemMenu[index++] = MENU_AUDIO; #if defined(_SDL) items->add(new String("Back")); _systemMenu[index++] = MENU_BACK; #endif } optionsBox(items); delete items; _menuActive = false; } }
//------------------------------------------------------------------------ CMouseEventResult CSlider::onMouseMoved (CPoint& where, const CButtonState& _buttons) { if (isEditing ()) { CButtonState buttons (_buttons); if (kAlwaysUseZoomFactor) buttons |= kZoomModifier; if (buttons & kLButton) { if (kAlwaysUseZoomFactor) { CCoord distance = fabs ((style & kHorizontal) ? where.y - mouseStartPoint.y : where.x - mouseStartPoint.x); float newZoomFactor = 1.f; if (distance > ((style & kHorizontal) ? getHeight () : getWidth ())) { newZoomFactor = (float)(distance / ((style & kHorizontal) ? getHeight () : getWidth ())); newZoomFactor = static_cast<int32_t>(newZoomFactor * 10.f) / 10.f; } if (zoomFactor != newZoomFactor) { zoomFactor = newZoomFactor; oldVal = (value - getMin ()) / getRange (); delta = calculateDelta (where); } } if (oldVal == getMin () - 1) oldVal = (value - getMin ()) / getRange (); if ((oldButton != buttons) && (buttons & kZoomModifier)) { oldVal = (value - getMin ()) / getRange (); oldButton = buttons; } else if (!(buttons & kZoomModifier)) oldVal = (value - getMin ()) / getRange (); float normValue; if (style & kHorizontal) normValue = (float)(where.x - delta) / (float)rangeHandle; else normValue = (float)(where.y - delta) / (float)rangeHandle; if (style & kRight || style & kBottom) normValue = 1.f - normValue; if (buttons & kZoomModifier) normValue = oldVal + ((normValue - oldVal) / zoomFactor); setValueNormalized (normValue); if (isDirty ()) { valueChanged (); invalid (); } } return kMouseEventHandled; } return kMouseEventNotHandled; }