void ShowGate() { SetLCDVals(); // update display if (currmode == MODE_GATE) { blinkCursor(LCD_GCLN,LCD_GROW,true); } else { blinkCursor(LCD_GCLN,LCD_GROW,false); } }
void UITextEdit::moveCursorHorizontally(bool right) { if(right) { if((uint)m_cursorPos+1 <= m_text.length()) { m_cursorPos++; blinkCursor(); } } else { if(m_cursorPos-1 >= 0) { m_cursorPos--; blinkCursor(); } } update(true); }
void UILineEdit::moveCursor(bool right) { if(right) { if((uint)m_cursorPos+1 <= m_text.length()) { m_cursorPos++; blinkCursor(); } } else { if(m_cursorPos-1 >= 0) { m_cursorPos--; blinkCursor(); } } update(); }
void UILineEdit::onTextChange(const std::string& text) { m_cursorPos = text.length(); blinkCursor(); update(); UIWidget::onTextChange(text); }
void UITextEdit::appendText(std::string text) { if(m_cursorPos >= 0) { // replace characters that are now allowed if(!m_multiline) boost::replace_all(text, "\n", ""); boost::replace_all(text, "\r", " "); if(text.length() > 0) { // only add text if textedit can add it if(m_maxLength > 0 && m_text.length() + text.length() > m_maxLength) return; // only ignore text append if it contains invalid characters if(m_validCharacters.size() > 0) { for(uint i = 0; i < text.size(); ++i) { if(m_validCharacters.find(text[i]) == std::string::npos) return; } } std::string oldText = m_text; m_text.insert(m_cursorPos, text); m_cursorPos += text.length(); blinkCursor(); update(); UIWidget::onTextChange(m_text, oldText); } } }
void UILineEdit::setText(const std::string& text) { if(m_text != text) { m_text = text; m_cursorPos = text.length(); blinkCursor(); update(); } }
void UILineEdit::onFocusChange(bool focused, Fw::FocusReason reason) { if(focused && !m_alwaysActive) { if(reason == Fw::TabFocusReason) setCursorPos(m_text.length()); else blinkCursor(); } }
void UILineEdit::setCursorEnabled(bool enable) { if(enable) { m_cursorPos = 0; blinkCursor(); } else m_cursorPos = -1; update(); }
void nextLCDdisp(int nextstate) { gv_long_sw = false; blinkCursor(0, 0, false); DispLED(false); gv_dispstate = nextstate; gv_showscreen = false; delay(100); }
void UITextEdit::onFocusChange(bool focused, Fw::FocusReason reason) { if(focused) { if(reason == Fw::KeyboardFocusReason) setCursorPos(m_text.length()); else blinkCursor(); } UIWidget::onFocusChange(focused, reason); }
UILineEdit::UILineEdit() { m_align = Fw::AlignLeftCenter; m_cursorPos = 0; m_startRenderPos = 0; m_textHorizontalMargin = 0; m_textHidden = false; m_alwaysActive = false; blinkCursor(); }
UITextEdit::UITextEdit() { m_cursorPos = 0; m_textAlign = Fw::AlignTopLeft; m_startRenderPos = 0; m_textHorizontalMargin = 0; m_textHidden = false; m_shiftNavigation = false; m_multiline = false; m_maxLength = 0; blinkCursor(); }
void UITextEdit::onFocusChange(bool focused, Fw::FocusReason reason) { if(focused) { if(reason == Fw::KeyboardFocusReason) setCursorPos(m_text.length()); else blinkCursor(); update(true); } else clearSelection(); UIWidget::onFocusChange(focused, reason); }
void UILineEdit::appendCharacter(char c) { if(c == '\n' || c == '\r') return; if(m_cursorPos >= 0) { std::string tmp; tmp = c; m_text.insert(m_cursorPos, tmp); m_cursorPos++; blinkCursor(); update(); } }
void UITextEdit::updateText() { if(m_cursorPos > (int)m_text.length()) m_cursorPos = m_text.length(); // any text changes reset the selection if(m_selectable) { m_selectionEnd = 0; m_selectionStart = 0; } blinkCursor(); update(true); }
void UILineEdit::removeCharacter(bool right) { if(m_cursorPos >= 0 && m_text.length() > 0) { if((uint)m_cursorPos >= m_text.length()) { m_text.erase(m_text.begin() + (--m_cursorPos)); } else { if(right) m_text.erase(m_text.begin() + m_cursorPos); else if(m_cursorPos > 0) m_text.erase(m_text.begin() + --m_cursorPos); } blinkCursor(); update(); } }
void UILineEdit::appendText(std::string text) { if(m_cursorPos >= 0) { // replace characters that are now allowed boost::replace_all(text, "\n", ""); boost::replace_all(text, "\r", " "); if(text.length() > 0) { m_text.insert(m_cursorPos, text); m_cursorPos += text.length(); blinkCursor(); update(); } } }
void UITextEdit::removeCharacter(bool right) { std::string oldText = m_text; if(m_cursorPos >= 0 && m_text.length() > 0) { if((uint)m_cursorPos >= m_text.length()) { m_text.erase(m_text.begin() + (--m_cursorPos)); } else { if(right) m_text.erase(m_text.begin() + m_cursorPos); else if(m_cursorPos > 0) m_text.erase(m_text.begin() + --m_cursorPos); } blinkCursor(); update(); UIWidget::onTextChange(m_text, oldText); } }
QHexEditPrivate::QHexEditPrivate(QScrollArea *scrollarea, QScrollBar *vscrollbar, QWidget *parent): QWidget(parent) { if(QHexEditPrivate::UNPRINTABLE_CHAR.isEmpty()) QHexEditPrivate::UNPRINTABLE_CHAR = "."; this->_lastkeyevent = nullptr; this->_writer = nullptr; this->_reader = nullptr; this->_highlighter = nullptr; this->_comments = nullptr; this->_hexeditdata = nullptr; this->_scrollarea = scrollarea; this->_vscrollbar = vscrollbar; this->_blink = this->_readonly = false; this->_lastvisiblelines = this->_lastvscrollpos = this->_baseaddress = this->_cursorX = this->_cursorY = this->_cursorpos = this->_selectionstart = this->_selectionend = this->_charidx = this->_charheight = this->_charwidth = 0; this->_selpart = QHexEditPrivate::HexPart; this->_insmode = QHexEditPrivate::Overwrite; connect(this->_vscrollbar, SIGNAL(valueChanged(int)), this, SLOT(onVScrollBarValueChanged(int))); connect(this->_vscrollbar, SIGNAL(valueChanged(int)), this, SIGNAL(verticalScrollBarValueChanged(int))); QFont f("Monospace", qApp->font().pointSize()); f.setStyleHint(QFont::TypeWriter); /* Use monospace fonts! */ this->setMouseTracking(true); this->setFont(f); this->setWheelScrollLines(5); /* By default: scroll 5 lines */ this->setAddressWidth(8); this->setCursor(Qt::IBeamCursor); this->setFocusPolicy(Qt::StrongFocus); this->setBackgroundRole(QPalette::Base); this->setSelectedCursorBrush(Qt::lightGray); this->setLineColor(QColor(0xFF, 0xFF, 0xA0, 0x20)); this->setAddressForeColor(Qt::darkBlue); this->setAddressBackColor(QColor(0xF0, 0xF0, 0xFE, 0x20)); this->setAlternateLineColor(QColor(0xF0, 0xF0, 0xFE, 0x20)); this->_timBlink = new QTimer(); this->_timBlink->setInterval(QHexEditPrivate::CURSOR_BLINK_INTERVAL); connect(this->_timBlink, SIGNAL(timeout()), this, SLOT(blinkCursor())); this->_timBlink->start(); }
void UITextEdit::appendCharacter(char c) { if((c == '\n' && !m_multiline) || c == '\r') return; if(m_cursorPos >= 0) { if(m_maxLength > 0 && m_text.length() + 1 > m_maxLength) return; if(m_validCharacters.size() > 0 && m_validCharacters.find(c) == std::string::npos) return; std::string tmp; tmp = c; std::string oldText = m_text; m_text.insert(m_cursorPos, tmp); m_cursorPos++; blinkCursor(); update(); UIWidget::onTextChange(m_text, oldText); } }
UITextEdit::UITextEdit() { m_cursorPos = 0; m_textAlign = Fw::AlignTopLeft; m_textHidden = false; m_shiftNavigation = false; m_multiline = false; m_cursorVisible = true; m_cursorInRange = true; m_maxLength = 0; m_editable = true; m_selectable = true; m_autoScroll = true; m_changeCursorImage = true; m_selectionReference = 0; m_selectionStart = 0; m_selectionEnd = 0; m_updatesEnabled = true; m_selectionColor = Color::white; m_selectionBackgroundColor = Color::black; blinkCursor(); }
void getScreen5() { switch(gv_scr5state) { case SC5NULL: if (gv_short_sw) { nextSC5(SC5YEAR); } break; case SC5YEAR: blinkCursor(0, 0, true); if (gv_rot_active) { gv_rot_active = false; if (gv_rot_pos) { gv_rot_pos = false; gv_year_val++; } if (gv_rot_neg) { gv_rot_neg = false; gv_year_val--; } if (gv_year_val > 2099) { gv_year_val = 2015; } if (gv_year_val < 2015) { gv_year_val = 2099; } } lcd->setCursor(2,0); lcd->print(gv_year_val); lcd->setCursor(0,0); if (gv_short_sw) { nextSC5(SC5MON); } break; case SC5MON: blinkCursor(7, 0, true); if (gv_rot_active) { gv_rot_active = false; if (gv_rot_pos) { gv_rot_pos = false; gv_mon_num++; } if (gv_rot_neg) { gv_rot_neg = false; gv_mon_num--; } if (gv_mon_num > 12) { gv_mon_num = 1; } if (gv_mon_num < 1) { gv_mon_num = 12; } } lcd->setCursor(9,0); lcd->print(gv_mon_num); lcd->setCursor(7,0); if (gv_short_sw) { nextSC5(SC5DAY); } break; case SC5DAY: lcd->setCursor(12,0); blinkCursor(12, 0, true); if (gv_rot_active) { gv_rot_active = false; if (gv_rot_pos) { gv_rot_pos = false; gv_day_val++; } if (gv_rot_neg) { gv_rot_neg = false; gv_day_val--; } if (gv_day_val > 31) { gv_day_val = 1; } if (gv_day_val < 1) { gv_day_val = 31; } } lcd->setCursor(14,0); lcd->print(gv_day_val); lcd->setCursor(12,0); if (gv_short_sw) { nextSC5(SC5HOUR); } break; case SC5HOUR: blinkCursor(0, 1, true); if (gv_rot_active) { gv_rot_active = false; if (gv_rot_pos) { gv_rot_pos = false; gv_currhour++; } if (gv_rot_neg) { gv_rot_neg = false; gv_currhour--; } if (gv_currhour > 23) { gv_currhour = 0; } if (gv_currhour < 0) { gv_currhour = 23; } } lcd->setCursor(2,1); lcd->print("00"); if (gv_currhour < 10) lcd->setCursor(3,1); else lcd->setCursor(2,1); lcd->print(gv_currhour); lcd->setCursor(0,1); if (gv_short_sw) { nextSC5(SC5MIN); } break; case SC5MIN: blinkCursor(5, 1, true); if (gv_rot_active) { gv_rot_active = false; if (gv_rot_pos) { gv_rot_pos = false; gv_currmin++; } if (gv_rot_neg) { gv_rot_neg = false; gv_currmin--; } if (gv_currmin > 59) { gv_currmin = 0; } if (gv_currmin < 0) { gv_currmin = 59; } } lcd->setCursor(7,1); lcd->print("00"); if (gv_currmin < 10) lcd->setCursor(8,1); else lcd->setCursor(7,1); lcd->print(gv_currmin); lcd->setCursor(5,1); if (gv_short_sw) { nextSC5(SC5SET); } break; case SC5SET: lcd->clear(); lcd->setCursor(0,0); // Set the RTC with new time/day values if (setTstatTime()) lcd->print("Clock set OK"); else lcd->print("Clock set failed"); delay(2000); Screen5(); nextSC5(SC5NULL); break; } }
// Current settings // Saved as profile entry 0 (profile OFF) void getScreen3() { gv_sc4mode = SHOW_PSET; if (!gv_prof_set) { switch(gv_scr3npstate) { case SC3NPNULL: if (!gv_show3Aonce) { Screen3(SHOW_ALL); gv_show3Aonce = true; } if (gv_short_sw) { nextSC3NP(SC3NPTEMP); } break; case SC3NPTEMP: // Set target temp blinkCursor(0, 0, true); if (gv_rot_active) { gv_rot_active = false; if (gv_rot_pos) { gv_rot_pos = false; if (gv_curr_scale == SCALE_F) gv_temp_set += 0.59; else gv_temp_set += 1; } if (gv_rot_neg) { gv_rot_neg = false; if (gv_curr_scale == SCALE_F) gv_temp_set -= 0.59; else gv_temp_set -= 1; } lcd->setCursor(2, 0); lcd->print(convtemp(gv_temp_set)); } if (gv_short_sw) { nextSC3NP(SC3NPCYCL); } break; case SC3NPCYCL: // Set hyst range lcd->setCursor(0, 1); blinkCursor(0, 1, true); if (gv_rot_active) { gv_rot_active = false; if (gv_rot_pos) { gv_rot_pos = false; if (gv_curr_scale == SCALE_F) gv_hyst_set += 0.59; else gv_hyst_set += 1.0; } if (gv_rot_neg) { gv_rot_neg = false; if (gv_curr_scale == SCALE_F) gv_hyst_set -= 0.59; else gv_hyst_set -= 1.0; } if (gv_hyst_set == NULL) gv_hyst_set = 0.0; if (gv_hyst_set > 9.0) gv_hyst_set = 0.0; if (gv_hyst_set < 0.0) gv_hyst_set = 9.0; // gv_hyst_set = 4.0; lcd->setCursor(2, 1); lcd->print(convrange(gv_hyst_set)); } // lcd->setCursor(4, 1); // lcd->print(gv_hyst_set); if (gv_short_sw) { nextSC3NP(SC3NPTSCL); } break; case SC3NPTSCL: // Set display scale (C or F) blinkCursor(5, 0, true); if (gv_rot_active) { gv_rot_active = false; if (gv_rot_pos || gv_rot_neg) { gv_rot_pos = false; gv_rot_neg = false; if (gv_curr_scale == SCALE_F) gv_curr_scale = SCALE_C; else gv_curr_scale = SCALE_F; } lcd->setCursor(5,0); if (gv_curr_scale == SCALE_F) lcd->print("F"); else lcd->print("C"); } if (gv_short_sw) { nextSC3NP(SC3NPOVRT); } break; case SC3NPOVRT: blinkCursor(6, 1, true); if (gv_rot_active) { gv_rot_active = false; if (gv_rot_pos) { gv_rot_pos = false; gv_over_time++; } if (gv_rot_neg) { gv_rot_neg = false; gv_over_time--; } lcd->setCursor(8, 1); lcd->print(gv_over_time); } if (gv_short_sw) { nextSC3NP(SC3NPMODE); } break; case SC3NPMODE: // Set operation mode blinkCursor(13, 0, true); if (gv_rot_active) { gv_rot_active = false; if (gv_rot_pos) { gv_rot_pos = false; gv_mode_set++; } if (gv_rot_neg) { gv_rot_neg = false; gv_mode_set--; } if (gv_mode_set > MODE_AUTO) gv_mode_set = MODE_OFF; if (gv_mode_set < MODE_OFF) gv_mode_set = MODE_AUTO; showMode(8, 0); lcd->setCursor(15,0); lcd->print(gv_mode_set); } lcd->setCursor(15,0); lcd->print(gv_mode_set); lcd->setCursor(13,0); if (gv_short_sw) { nextSC3NP(SC3NPPROF); } break; case SC3NPPROF: // Set profile number blinkCursor(13, 1, true); if (gv_rot_active) { gv_rot_active = false; if (gv_rot_pos) { gv_rot_pos = false; gv_prof_set++; } if (gv_rot_neg) { gv_rot_neg = false; gv_prof_set--; } if (gv_prof_set > PROF_WKND) gv_prof_set = PROF_OFF; if (gv_prof_set < PROF_OFF) gv_prof_set = PROF_WKND; showProf(15, 1); if (gv_prof_set != PROF_OFF) { gv_show3Bonce = false; } } if (gv_short_sw) { nextSC3NP(SC3NPSET); } break; case SC3NPSET: if (gv_prof_set == PROF_OFF) { gv_profile[gv_prof_set].op_mode = gv_mode_set; gv_profile[gv_prof_set].start_hr = 0; gv_profile[gv_prof_set].start_min = 0; gv_profile[gv_prof_set].duration = gv_over_time; gv_profile[gv_prof_set].tset = gv_temp_set; gv_profile[gv_prof_set].hystrange = gv_hyst_set; lcd->clear(); lcd->setCursor(0,0); lcd->print("Settings saved"); saveProf(gv_prof_set); saveGVData(); gv_inputchange = true; delay(2000); } Screen3(SHOW_ALL); nextSC3NP(SC3NPNULL); break; } } else { // If any profile is active then only allow edit of the // temp units and the profile number if (!gv_show3Bonce) { Screen3(SHOW_SUB); gv_show3Bonce = true; } switch(gv_scr3prstate) { case SC3PRNULL: if (gv_short_sw) { nextSC3PR(SC3PRTSCL); } break; case SC3PRTSCL: // Set display scale (C or F) blinkCursor(5, 0, true); if (gv_rot_active) { gv_rot_active = false; if (gv_rot_pos || gv_rot_neg) { gv_rot_pos = false; gv_rot_neg = false; if (gv_curr_scale == SCALE_F) gv_curr_scale = SCALE_C; else gv_curr_scale = SCALE_F; } lcd->setCursor(5,0); if (gv_curr_scale == SCALE_F) lcd->print("F"); else lcd->print("C"); } if (gv_short_sw) { nextSC3PR(SC3PRPROF); } break; case SC3PRPROF: // Set profile number blinkCursor(13, 1, true); if (gv_rot_active) { gv_rot_active = false; if (gv_rot_pos) { gv_rot_pos = false; gv_prof_set++; } if (gv_rot_neg) { gv_rot_neg = false; gv_prof_set--; } if (gv_prof_set > PROF_WKND) gv_prof_set = PROF_OFF; if (gv_prof_set < PROF_OFF) gv_prof_set = PROF_WKND; showProf(15, 1); if (gv_prof_set == PROF_OFF) { gv_show3Aonce = false; } } if (gv_short_sw) { gv_inputchange = true; nextSC3PR(SC3PRNULL); } break; } } }
void getScreen4() { switch(gv_scr4state) { case SC4NULL: if (gv_short_sw) { gv_prof_get = gv_prof_set; nextSC4(SC4PROF); } break; case SC4PROF: lcd->setCursor(0, 0); blinkCursor(0, 0, true); if (gv_rot_active) { gv_rot_active = false; if (gv_rot_pos) { gv_rot_pos = false; gv_prof_get++; } if (gv_rot_neg) { gv_rot_neg = false; gv_prof_get--; } if (gv_prof_get > PROF_WKND) gv_prof_get = PROF_OFF; if (gv_prof_get < PROF_OFF) gv_prof_get = PROF_WKND; if (gv_prof_get > PROF_OFF) gv_sc4mode = SHOW_PGET; else gv_sc4mode = SHOW_PSET; showProf(2, 0); } if (gv_short_sw) { if (gv_prof_get > PROF_OFF) { gv_profget.op_mode = gv_profile[gv_prof_get].op_mode; gv_profget.start_hr = gv_profile[gv_prof_get].start_hr; gv_profget.start_min = gv_profile[gv_prof_get].start_min; gv_profget.duration = gv_profile[gv_prof_get].duration; gv_profget.tset = gv_profile[gv_prof_get].tset; gv_profget.hystrange = gv_profile[gv_prof_get].hystrange; nextSC4(SC4MODE); // go to next edit state } else { nextSC4(SC4NULL); // return to start state } Screen4(gv_sc4mode); } break; case SC4MODE: lcd->setCursor(0, 1); blinkCursor(0, 1, true); if (gv_rot_active) { gv_rot_active = false; if (gv_rot_pos) { gv_rot_pos = false; gv_profget.op_mode++; } if (gv_rot_neg) { gv_rot_neg = false; gv_profget.op_mode--; } if (gv_profget.op_mode > MODE_AUTO) gv_profget.op_mode = MODE_OFF; if (gv_profget.op_mode < MODE_OFF) gv_profget.op_mode = MODE_AUTO; lcd->setCursor(2,1); lcd->print(gv_profget.op_mode); } if (gv_short_sw) { nextSC4(SC4BTIME); } break; case SC4BTIME: blinkCursor(4, 0, true); if (gv_rot_active) { gv_rot_active = false; if (gv_rot_pos) { gv_rot_pos = false; gv_profget.start_min++; } if (gv_rot_neg) { gv_rot_neg = false; gv_profget.start_min--; } if (gv_profget.start_min > 59) { gv_profget.start_min = 0; gv_profget.start_hr++; if (gv_profget.start_hr > 23) gv_profget.start_hr = 0; } if (gv_profget.start_min < 0) { gv_profget.start_min = 59; gv_profget.start_hr--; if (gv_profget.start_hr < 0) gv_profget.start_hr = 23; } // Show start time in 24 hour format lcd->setCursor(6, 0); lcd->print("0000"); if (gv_profget.start_hr) { if (gv_profget.start_hr < 10) lcd->setCursor(7, 0); else lcd->setCursor(6, 0); lcd->print(gv_profget.start_hr); } else { lcd->setCursor(6, 0); lcd->print("0000"); } if (gv_profget.start_min < 10) lcd->setCursor(9, 0); else lcd->setCursor(8, 0); lcd->print(gv_profget.start_min); } if (gv_short_sw) { nextSC4(SC4ETIME); } break; case SC4ETIME: blinkCursor(4, 1, true); if (gv_rot_active) { gv_rot_active = false; if (gv_rot_pos) { gv_rot_pos = false; gv_profget.duration++; } if (gv_rot_neg) { gv_rot_neg = false; gv_profget.duration--; } if (gv_profget.duration > 23) { gv_profget.duration = 0; } if (gv_profget.duration < 0) { gv_profget.duration = 23; } lcd->setCursor(6, 1); lcd->print("00"); if (gv_profget.duration < 10) lcd->setCursor(7, 1); else lcd->setCursor(6, 1); lcd->print(gv_profget.duration); } if (gv_short_sw) { nextSC4(SC4TEMP); } break; case SC4TEMP: blinkCursor(11, 0, true); if (gv_rot_active) { gv_rot_active = false; if (gv_rot_pos) { gv_rot_pos = false; gv_profget.tset++; } if (gv_rot_neg) { gv_rot_neg = false; gv_profget.tset--; } if (gv_profget.tset > 99) { gv_profget.tset = 0; } if (gv_profget.tset < 0) { gv_profget.tset = 99; } lcd->setCursor(13, 0); lcd->print(convrange(gv_profget.tset)); } if (gv_short_sw) { nextSC4(SC4CSET); } break; case SC4CSET: blinkCursor(11, 1, true); if (gv_rot_active) { gv_rot_active = false; if (gv_rot_pos) { gv_rot_pos = false; if (gv_curr_scale == SCALE_F) gv_profget.hystrange += 0.59; else gv_profget.hystrange += 1; } if (gv_rot_neg) { gv_rot_neg = false; if (gv_curr_scale == SCALE_F) gv_profget.hystrange -= 0.59; else gv_profget.hystrange -= 1; } if (gv_profget.hystrange > 9) gv_profget.hystrange = 0; if (gv_profget.hystrange < 0) gv_profget.hystrange = 9; lcd->setCursor(13,1); lcd->print(convrange(gv_profget.hystrange)); } if (gv_short_sw) { nextSC4(SC4SAVE); } break; case SC4SAVE: gv_profile[gv_prof_get].op_mode = gv_profget.op_mode; gv_profile[gv_prof_get].start_hr = gv_profget.start_hr; gv_profile[gv_prof_get].start_min = gv_profget.start_min; gv_profile[gv_prof_get].duration = gv_profget.duration; gv_profile[gv_prof_get].tset = gv_profget.tset; gv_profile[gv_prof_get].hystrange = gv_profget.hystrange; lcd->clear(); lcd->setCursor(0,0); saveProf(gv_prof_get); // Save the modified data lcd->print("Profile"); // Message for user showProf(8, 0); lcd->setCursor(10,0); lcd->print("saved"); gv_inputchange = true; // Set input change flag delay(1000); if (gv_prof_get > PROF_OFF) Screen4(SHOW_PSET); // Refresh display else Screen4(SHOW_PGET); nextSC4(SC4NULL); break; } }
void nextSC5(int nextState) { blinkCursor(0, 0, false); gv_short_sw = false; gv_scr5state = nextState; }