diff --git a/ChangeLog b/ChangeLog index 1c7e2b9b..5ff5a439 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2015-12-20 Markus Gans + * Bug fix in FTerm updateVTerm() for updates from vdesktop + * Add raiseWindow() to FMenuBar::leaveMenuBar() + * Fix allocation of null strings with the FString = operator + * Fix for non printable characters in Cygwin and TeraTerm + 2015-12-19 Markus Gans * Add delOwnTimer() for FObject * Close sub-menu on right and middle click diff --git a/src/fcheckbox.cpp b/src/fcheckbox.cpp index f74c3e60..cec6d6a1 100644 --- a/src/fcheckbox.cpp +++ b/src/fcheckbox.cpp @@ -69,7 +69,10 @@ void FCheckBox::drawCheckButton() else { print ('['); - print (fc::Times); // Times × + if ( isTeraTerm() ) + print ('x'); + else + print (fc::Times); // Times × print (']'); } } diff --git a/src/fmenu.cpp b/src/fmenu.cpp index 2a7968b4..ae3414e5 100644 --- a/src/fmenu.cpp +++ b/src/fmenu.cpp @@ -698,16 +698,18 @@ void FMenu::drawItems() if ( is_radio_btn ) { if ( isNewFont() ) - print (fc::NF_Bullet); // NF_Bullet ● + print (fc::NF_Bullet); // NF_Bullet ● else - print (fc::Bullet); // Bullet ● + print (fc::Bullet); // Bullet ● } else { if ( isNewFont() ) - print (fc::NF_check_mark); // NF_check_mark ✓ + print (fc::NF_check_mark); // NF_check_mark ✓ + else if ( isCygwinTerminal() ) + print (fc::Times); // Times × else - print (fc::SquareRoot); // SquareRoot √ + print (fc::SquareRoot); // SquareRoot √ } } else @@ -777,8 +779,10 @@ void FMenu::drawItems() if ( len > 0 ) { FString spaces (len, wchar_t(' ')); - // BlackRightPointingPointer ► - print (spaces + wchar_t(fc::BlackRightPointingPointer)); + if ( isTeraTerm() ) + print (spaces + wchar_t('>')); + else // BlackRightPointingPointer ► + print (spaces + wchar_t(fc::BlackRightPointingPointer)); to_char = int(maxItemWidth) - (c + 2); } } @@ -1298,15 +1302,18 @@ void FMenu::onMouseMove (FMouseEvent* ev) delete _ev; return; } - else if ( ! hasSelectedItem() && statusBar() && mouse_over_menu ) + else if ( ! hasSelectedItem() && mouse_over_menu ) { // Mouse is over border or separator - FString msg = getStatusbarMessage(); - FString curMsg = statusBar()->getMessage(); - if ( curMsg != msg ) + if ( statusBar() ) { - statusBar()->setMessage(msg); - statusBar()->drawMessage(); + FString msg = getStatusbarMessage(); + FString curMsg = statusBar()->getMessage(); + if ( curMsg != msg ) + { + statusBar()->setMessage(msg); + statusBar()->drawMessage(); + } } if ( open_sub_menu ) hide_sub_menu = true; diff --git a/src/fmenubar.cpp b/src/fmenubar.cpp index 8906856c..5a4f7c08 100644 --- a/src/fmenubar.cpp +++ b/src/fmenubar.cpp @@ -467,6 +467,7 @@ void FMenuBar::leaveMenuBar() resetMenu(); redraw(); activatePrevWindow(); + raiseWindow (getActiveWindow()); getActiveWindow()->getFocusWidget()->setFocus(); getActiveWindow()->redraw(); if ( statusBar() ) @@ -543,8 +544,12 @@ void FMenuBar::onMouseDown (FMouseEvent* ev) if ( ev->getButton() != LeftButton ) { mouse_down = false; - if ( ! itemlist.empty() ) + + if ( ! itemlist.empty() && hasSelectedItem() ) leaveMenuBar(); + else + return; + if ( statusBar() ) statusBar()->clearMessage(); return; @@ -680,10 +685,13 @@ void FMenuBar::onMouseUp (FMouseEvent* ev) { (*iter)->unsetSelected(); if ( getSelectedItem() == *iter ) + { setSelectedItem(0); - redraw(); - (*iter)->processClicked(); - drop_down = false; + leaveMenuBar(); + drop_down = false; + (*iter)->processClicked(); + return; + } } } else diff --git a/src/fstring.cpp b/src/fstring.cpp index 38c482ae..8fb83490 100644 --- a/src/fstring.cpp +++ b/src/fstring.cpp @@ -539,7 +539,7 @@ FString& FString::operator = (const FString& s) if ( s ) _replace (s.string); else - length = bufsize = 0, string = 0; + clear(); return (*this); } @@ -549,7 +549,7 @@ FString& FString::operator = (const std::wstring& s) if ( ! s.empty() ) _replace (s.c_str()); else - length = bufsize = 0, string = 0; + clear(); return (*this); } @@ -559,7 +559,7 @@ const FString& FString::operator = (const wchar_t* s) if ( s ) _replace (s); else - length = bufsize = 0, string = 0; + clear(); return (*this); } @@ -573,7 +573,7 @@ FString& FString::operator = (const std::string& s) delete[] wc_string; } else - length = bufsize = 0, string = 0; + clear(); return (*this); } @@ -587,7 +587,7 @@ const FString& FString::operator = (const char* s) delete[] wc_string; } else - length = bufsize = 0, string = 0; + clear(); return (*this); } diff --git a/src/fterm.cpp b/src/fterm.cpp index 5d231a1f..01a0e36b 100644 --- a/src/fterm.cpp +++ b/src/fterm.cpp @@ -2057,10 +2057,12 @@ void FTerm::updateVTerm (FTerm::term_area* area) if ( ax == 0 ) line_xmin = ol; + else if ( aw + rsh + ax - ol >= vterm->width ) + line_xmax = vterm->width + ol - ax - 1; + if ( ax + line_xmin >= vterm->width ) continue; - if ( aw + rsh + ax - ol >= vterm->width ) - line_xmax = vterm->width + ol - ax - 1; + for (register int x=line_xmin; x <= line_xmax; x++) { int gx, gy, line_len; diff --git a/test/calculator.cpp b/test/calculator.cpp index aca4affe..4addf7d0 100644 --- a/test/calculator.cpp +++ b/test/calculator.cpp @@ -155,6 +155,7 @@ class Calc : public FDialog void setInfixOperator(char); void clearInfixOperator(); void calcInfixOperator(); + void adjustSize(); public: explicit Calc (FWidget* parent=0); // constructor @@ -163,9 +164,6 @@ class Calc : public FDialog void onAccel (FAccelEvent*); void onClose (FCloseEvent*); void cb_buttonClicked (FWidget*, void*); - - protected: - void adjustSize(); }; #pragma pack(pop) diff --git a/test/mandelbrot.cpp b/test/mandelbrot.cpp index 29d7f418..4ffa9054 100644 --- a/test/mandelbrot.cpp +++ b/test/mandelbrot.cpp @@ -15,15 +15,13 @@ class Mandelbrot : public FDialog { private: virtual void draw(); + void adjustSize(); public: explicit Mandelbrot (FWidget* = 0); // constructor ~Mandelbrot(); // destructor void onAccel (FAccelEvent*); void onClose (FCloseEvent*); - - protected: - void adjustSize(); }; #pragma pack(pop) diff --git a/test/menu.cpp b/test/menu.cpp index f8ce0877..ee2cbc53 100644 --- a/test/menu.cpp +++ b/test/menu.cpp @@ -27,13 +27,11 @@ class Menu : public FDialog void onClose (FCloseEvent*); void cb_message (FWidget*, void*); void cb_exitApp (FWidget*, void*); + void adjustSize(); public: explicit Menu (FWidget* = 0); // constructor ~Menu(); // destructor - - protected: - void adjustSize(); }; #pragma pack(pop)