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>
* Add delOwnTimer() for FObject
* Close sub-menu on right and middle click

View File

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

View File

@ -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;

View File

@ -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

View File

@ -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);
}

View File

@ -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;

View File

@ -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)

View File

@ -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)

View File

@ -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)