Some bug fixes

This commit is contained in:
Markus Gans 2015-12-20 23:27:33 +01:00
parent 54c45a6501
commit 27d8b515f1
9 changed files with 53 additions and 33 deletions

View File

@ -1,3 +1,9 @@
2015-12-20 Markus Gans <guru.mail@muenster.de>
* 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 <guru.mail@muenster.de> 2015-12-19 Markus Gans <guru.mail@muenster.de>
* Add delOwnTimer() for FObject * Add delOwnTimer() for FObject
* Close sub-menu on right and middle click * Close sub-menu on right and middle click

View File

@ -69,6 +69,9 @@ void FCheckBox::drawCheckButton()
else else
{ {
print ('['); print ('[');
if ( isTeraTerm() )
print ('x');
else
print (fc::Times); // Times × print (fc::Times); // Times ×
print (']'); print (']');
} }

View File

@ -706,6 +706,8 @@ void FMenu::drawItems()
{ {
if ( isNewFont() ) 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 else
print (fc::SquareRoot); // SquareRoot √ print (fc::SquareRoot); // SquareRoot √
} }
@ -777,7 +779,9 @@ void FMenu::drawItems()
if ( len > 0 ) if ( len > 0 )
{ {
FString spaces (len, wchar_t(' ')); FString spaces (len, wchar_t(' '));
// BlackRightPointingPointer ► if ( isTeraTerm() )
print (spaces + wchar_t('>'));
else // BlackRightPointingPointer ►
print (spaces + wchar_t(fc::BlackRightPointingPointer)); print (spaces + wchar_t(fc::BlackRightPointingPointer));
to_char = int(maxItemWidth) - (c + 2); to_char = int(maxItemWidth) - (c + 2);
} }
@ -1298,9 +1302,11 @@ void FMenu::onMouseMove (FMouseEvent* ev)
delete _ev; delete _ev;
return; return;
} }
else if ( ! hasSelectedItem() && statusBar() && mouse_over_menu ) else if ( ! hasSelectedItem() && mouse_over_menu )
{ {
// Mouse is over border or separator // Mouse is over border or separator
if ( statusBar() )
{
FString msg = getStatusbarMessage(); FString msg = getStatusbarMessage();
FString curMsg = statusBar()->getMessage(); FString curMsg = statusBar()->getMessage();
if ( curMsg != msg ) if ( curMsg != msg )
@ -1308,6 +1314,7 @@ void FMenu::onMouseMove (FMouseEvent* ev)
statusBar()->setMessage(msg); statusBar()->setMessage(msg);
statusBar()->drawMessage(); statusBar()->drawMessage();
} }
}
if ( open_sub_menu ) if ( open_sub_menu )
hide_sub_menu = true; hide_sub_menu = true;
} }

View File

@ -467,6 +467,7 @@ void FMenuBar::leaveMenuBar()
resetMenu(); resetMenu();
redraw(); redraw();
activatePrevWindow(); activatePrevWindow();
raiseWindow (getActiveWindow());
getActiveWindow()->getFocusWidget()->setFocus(); getActiveWindow()->getFocusWidget()->setFocus();
getActiveWindow()->redraw(); getActiveWindow()->redraw();
if ( statusBar() ) if ( statusBar() )
@ -543,8 +544,12 @@ void FMenuBar::onMouseDown (FMouseEvent* ev)
if ( ev->getButton() != LeftButton ) if ( ev->getButton() != LeftButton )
{ {
mouse_down = false; mouse_down = false;
if ( ! itemlist.empty() )
if ( ! itemlist.empty() && hasSelectedItem() )
leaveMenuBar(); leaveMenuBar();
else
return;
if ( statusBar() ) if ( statusBar() )
statusBar()->clearMessage(); statusBar()->clearMessage();
return; return;
@ -680,10 +685,13 @@ void FMenuBar::onMouseUp (FMouseEvent* ev)
{ {
(*iter)->unsetSelected(); (*iter)->unsetSelected();
if ( getSelectedItem() == *iter ) if ( getSelectedItem() == *iter )
{
setSelectedItem(0); setSelectedItem(0);
redraw(); leaveMenuBar();
(*iter)->processClicked();
drop_down = false; drop_down = false;
(*iter)->processClicked();
return;
}
} }
} }
else else

View File

@ -539,7 +539,7 @@ FString& FString::operator = (const FString& s)
if ( s ) if ( s )
_replace (s.string); _replace (s.string);
else else
length = bufsize = 0, string = 0; clear();
return (*this); return (*this);
} }
@ -549,7 +549,7 @@ FString& FString::operator = (const std::wstring& s)
if ( ! s.empty() ) if ( ! s.empty() )
_replace (s.c_str()); _replace (s.c_str());
else else
length = bufsize = 0, string = 0; clear();
return (*this); return (*this);
} }
@ -559,7 +559,7 @@ const FString& FString::operator = (const wchar_t* s)
if ( s ) if ( s )
_replace (s); _replace (s);
else else
length = bufsize = 0, string = 0; clear();
return (*this); return (*this);
} }
@ -573,7 +573,7 @@ FString& FString::operator = (const std::string& s)
delete[] wc_string; delete[] wc_string;
} }
else else
length = bufsize = 0, string = 0; clear();
return (*this); return (*this);
} }
@ -587,7 +587,7 @@ const FString& FString::operator = (const char* s)
delete[] wc_string; delete[] wc_string;
} }
else else
length = bufsize = 0, string = 0; clear();
return (*this); return (*this);
} }

View File

@ -2057,10 +2057,12 @@ void FTerm::updateVTerm (FTerm::term_area* area)
if ( ax == 0 ) if ( ax == 0 )
line_xmin = ol; line_xmin = ol;
else if ( aw + rsh + ax - ol >= vterm->width )
line_xmax = vterm->width + ol - ax - 1;
if ( ax + line_xmin >= vterm->width ) if ( ax + line_xmin >= vterm->width )
continue; 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++) for (register int x=line_xmin; x <= line_xmax; x++)
{ {
int gx, gy, line_len; int gx, gy, line_len;

View File

@ -155,6 +155,7 @@ class Calc : public FDialog
void setInfixOperator(char); void setInfixOperator(char);
void clearInfixOperator(); void clearInfixOperator();
void calcInfixOperator(); void calcInfixOperator();
void adjustSize();
public: public:
explicit Calc (FWidget* parent=0); // constructor explicit Calc (FWidget* parent=0); // constructor
@ -163,9 +164,6 @@ class Calc : public FDialog
void onAccel (FAccelEvent*); void onAccel (FAccelEvent*);
void onClose (FCloseEvent*); void onClose (FCloseEvent*);
void cb_buttonClicked (FWidget*, void*); void cb_buttonClicked (FWidget*, void*);
protected:
void adjustSize();
}; };
#pragma pack(pop) #pragma pack(pop)

View File

@ -15,15 +15,13 @@ class Mandelbrot : public FDialog
{ {
private: private:
virtual void draw(); virtual void draw();
void adjustSize();
public: public:
explicit Mandelbrot (FWidget* = 0); // constructor explicit Mandelbrot (FWidget* = 0); // constructor
~Mandelbrot(); // destructor ~Mandelbrot(); // destructor
void onAccel (FAccelEvent*); void onAccel (FAccelEvent*);
void onClose (FCloseEvent*); void onClose (FCloseEvent*);
protected:
void adjustSize();
}; };
#pragma pack(pop) #pragma pack(pop)

View File

@ -27,13 +27,11 @@ class Menu : public FDialog
void onClose (FCloseEvent*); void onClose (FCloseEvent*);
void cb_message (FWidget*, void*); void cb_message (FWidget*, void*);
void cb_exitApp (FWidget*, void*); void cb_exitApp (FWidget*, void*);
void adjustSize();
public: public:
explicit Menu (FWidget* = 0); // constructor explicit Menu (FWidget* = 0); // constructor
~Menu(); // destructor ~Menu(); // destructor
protected:
void adjustSize();
}; };
#pragma pack(pop) #pragma pack(pop)