config.h.in

This commit is contained in:
Markus Gans 2015-09-15 23:07:24 +02:00
parent db4eafb5ec
commit 8c7c2fc7a2
12 changed files with 342 additions and 75 deletions

7
.gitignore vendored
View File

@ -9,7 +9,12 @@
*.gcno
*.gcda
_configs.sed
config.*
config.guess
config.h
config.log
config.lt
config.status
config.sub
Makefile
libtool
/autom4te.cache

110
config.h.in Normal file
View File

@ -0,0 +1,110 @@
/* config.h.in. Generated from configure.ac by autoheader. */
/* Define to 1 if you have the <cmath> header file. */
#undef HAVE_CMATH
/* Define to 1 if you have the <csignal> header file. */
#undef HAVE_CSIGNAL
/* Define to 1 if you have the <cstdlib> header file. */
#undef HAVE_CSTDLIB
/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
/* Define to 1 if you have the <fcntl.h> header file. */
#undef HAVE_FCNTL_H
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define to 1 if you have the <langinfo.h> header file. */
#undef HAVE_LANGINFO_H
/* Define to 1 if GPM mouse is enabled */
#undef HAVE_LIBGPM
/* Define to 1 if you have the <linux/fb.h> header file. */
#undef HAVE_LINUX_FB_H
/* Define to 1 if you have the <list> header file. */
#undef HAVE_LIST
/* Define to 1 if you have the <map> header file. */
#undef HAVE_MAP
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define to 1 if you have the <queue> header file. */
#undef HAVE_QUEUE
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define to 1 if you have the <sys/io.h> header file. */
#undef HAVE_SYS_IO_H
/* Define to 1 if you have the <sys/kd.h> header file. */
#undef HAVE_SYS_KD_H
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/time.h> header file. */
#undef HAVE_SYS_TIME_H
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
/* Define to 1 if you have the <termios.h> header file. */
#undef HAVE_TERMIOS_H
/* Define to 1 if you have the <term.h> header file. */
#undef HAVE_TERM_H
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define to 1 if you have the <vector> header file. */
#undef HAVE_VECTOR
/* Define to the sub-directory in which libtool stores uninstalled libraries.
*/
#undef LT_OBJDIR
/* Name of package */
#undef PACKAGE
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#undef PACKAGE_NAME
/* Define to the full name and version of this package. */
#undef PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the home page for this package. */
#undef PACKAGE_URL
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Version number of package */
#undef VERSION

View File

@ -436,7 +436,7 @@ void FButton::hide()
}
//----------------------------------------------------------------------
bool FButton::setNoUnderline(bool on)
bool FButton::setNoUnderline (bool on)
{
if ( on )
this->flags |= NO_UNDERLINE;
@ -446,7 +446,7 @@ bool FButton::setNoUnderline(bool on)
}
//----------------------------------------------------------------------
bool FButton::setEnable(bool on)
bool FButton::setEnable (bool on)
{
FWidget::setEnable(on);
@ -465,7 +465,7 @@ bool FButton::setEnable(bool on)
}
//----------------------------------------------------------------------
bool FButton::setFocus(bool on)
bool FButton::setFocus (bool on)
{
FWidget::setFocus(on);
@ -496,7 +496,7 @@ bool FButton::setFocus(bool on)
}
//----------------------------------------------------------------------
bool FButton::setFlat(bool on)
bool FButton::setFlat (bool on)
{
if ( on )
this->flags |= FLAT;
@ -506,7 +506,7 @@ bool FButton::setFlat(bool on)
}
//----------------------------------------------------------------------
bool FButton::setShadow(bool on)
bool FButton::setShadow (bool on)
{
if ( on && Encoding != fc::VT100 && Encoding != fc::ASCII )
this->flags |= SHADOW;
@ -516,7 +516,7 @@ bool FButton::setShadow(bool on)
}
//----------------------------------------------------------------------
bool FButton::setDown(bool on)
bool FButton::setDown (bool on)
{
if ( button_down != on )
{

View File

@ -567,6 +567,10 @@ void FDialog::onWindowInactive (FEvent*)
void FDialog::onWindowRaised (FEvent*)
{
widgetList::const_iterator iter, end;
if ( ! isVisible() || ! isShown() )
return;
putArea (getGlobalPos(), vwin);
if ( ! window_list )

View File

@ -44,7 +44,6 @@ FMenu::~FMenu()
const FRect& geometry = getGeometryGlobalShadow();
restoreVTerm (geometry);
parentWidget()->redraw(); // ????
if ( vwin != 0 )
{
@ -61,6 +60,7 @@ FMenu::~FMenu()
//----------------------------------------------------------------------
void FMenu::init()
{
current = 0;
width = 10;
height = 2;
xmin = 1;
@ -76,11 +76,12 @@ void FMenu::init()
bottom_padding = 1;
right_padding = 1;
createArea (vwin);
setGeometry (1, 1, 10, 2, false); // initialize geometry values
ignore_padding = true;
setGeometry (1, 1 , 10, 2, false); // initialize geometry values
window_object = true;
addWindow(this);
setActiveWindow(this);
foregroundColor = wc.menu_active_fg;
backgroundColor = wc.menu_active_bg;
FWidget* old_focus = FWidget::getFocusWidget();
if ( old_focus )
@ -92,6 +93,31 @@ void FMenu::init()
item->setMenu(this);
}
//----------------------------------------------------------------------
void FMenu::menu_dimension()
{
std::vector<FMenuItem*>::const_iterator iter, end;
iter = itemlist.begin();
end = itemlist.end();
maxItemWidth = 0;
// find the max item width
while ( iter != end )
{
FString item_text = (*iter)->getText();
uInt len = item_text.getLength();
if ( item_text.includes(L'&') ) // item has a hotkey '&'
len--;
if ( len > maxItemWidth )
maxItemWidth = len;
++iter;
}
setGeometry (xpos, ypos, maxItemWidth + 4, count() + 2);
}
//----------------------------------------------------------------------
bool FMenu::isMenuBar (FWidget* w) const
{
@ -138,6 +164,14 @@ void FMenu::draw()
if ( itemlist.empty() )
return;
if ( current < 1 )
{
current = 1;
itemlist[0]->setSelected();
}
menu_dimension();
// fill the background
setColor (foregroundColor, backgroundColor);
setUpdateVTerm(false);
@ -149,11 +183,73 @@ void FMenu::draw()
setUpdateVTerm(true);
}
//----------------------------------------------------------------------
void FMenu::drawBorder()
{
int x1, x2, y1, y2;
x1 = xpos+xmin-1;
x2 = xpos+xmin-2+width;
y1 = ypos+ymin-1;
y2 = ypos+ymin-2+height;
if ( isNewFont() )
{
gotoxy (x1, y1);
print (fc::NF_border_corner_upper_left); // ⎡
for (int x=x1+1; x < x2; x++)
print (fc::NF_border_line_upper); // ¯
print (fc::NF_rev_border_corner_upper_right); // ⎤
for (int y=y1+1; y <= y2; y++)
{
gotoxy (x1, y);
// border left ⎸
print (fc::NF_border_line_left);
gotoxy (x2, y);
// border right⎹
print (fc::NF_rev_border_line_right);
}
if ( (flags & SHADOW) == 0 )
{
gotoxy (x1, y2);
// lower left corner border ⎣
print (fc::NF_border_corner_lower_left);
for (int x=1; x < width-1; x++) // low line _
print (fc::NF_border_line_bottom);
gotoxy (x2, y2);
// lower right corner border ⎦
print (fc::NF_rev_border_corner_lower_right);
}
}
else
{
gotoxy (x1, y1);
print (fc::BoxDrawingsDownAndRight); // ┌
for (int x=x1+1; x < x2; x++)
print (fc::BoxDrawingsHorizontal); // ─
print (fc::BoxDrawingsDownAndLeft); // ┐
gotoxy (x1, y2);
print (fc::BoxDrawingsUpAndRight); // └
for (int x=x1+1; x < x2; x++)
print (fc::BoxDrawingsHorizontal); // ─
print (fc::BoxDrawingsUpAndLeft); // ┘
for (int y=y1+1; y < y2; y++)
{
gotoxy (x1, y);
print (fc::BoxDrawingsVertical); // │
gotoxy (x2, y);
print (fc::BoxDrawingsVertical); // │
}
}
}
//----------------------------------------------------------------------
void FMenu::drawItems()
{
std::vector<FMenuItem*>::const_iterator iter, end;
int y = 1;
int y = 0;
iter = itemlist.begin();
end = itemlist.end();
@ -190,7 +286,7 @@ void FMenu::drawItems()
foregroundColor = wc.menu_inactive_fg;
backgroundColor = wc.menu_inactive_bg;
}
gotoxy (xpos+xmin+1, ypos+ymin+y);
gotoxy (xpos+xmin, ypos+ymin+y);
setColor (foregroundColor, backgroundColor);
print (' ');
@ -226,6 +322,12 @@ void FMenu::drawItems()
print (item_text[z]);
}
if ( isSelected )
{
for (uInt i=to_char; i <= maxItemWidth; i++)
print (' ');
}
if ( isActive && isSelected )
setReverse(false);
delete[] item_text;
@ -401,6 +503,18 @@ void FMenu::setGeometry (int xx, int yy, int ww, int hh, bool adjust)
resizeArea (vwin);
}
//----------------------------------------------------------------------
void FMenu::insert (FMenuItem* item)
{
FMenuList::insert(item);
}
//----------------------------------------------------------------------
void FMenu::remove (FMenuItem* item)
{
FMenuList::remove(item);
}
//----------------------------------------------------------------------
void FMenu::cb_menuitem_activated (FWidget* widget, void*)
{

View File

@ -20,17 +20,22 @@ class FMenu : public FWindow, public FMenuList
private:
FMenuItem* item;
FMenuList* super_menu;
bool mouse_down;
uInt maxItemWidth;
int current;
bool mouse_down;
private:
FMenu (const FMenu&);
FMenu& operator = (const FMenu&);
void init();
void menu_dimension();
bool isMenuBar (FWidget*) const;
FMenuList* superMenu() const;
void setSuperMenu (FMenuList*);
int getHotkeyPos (wchar_t*&, wchar_t*&, uInt);
void draw();
void drawBorder();
void drawItems();
void processActivate();
@ -63,6 +68,8 @@ class FMenu : public FWindow, public FMenuList
void setText (FString&);
void setText (const std::string&);
void setText (const char*);
void insert (FMenuItem*);
void remove (FMenuItem*);
void cb_menuitem_activated (FWidget*, void*);
};
#pragma pack(pop)

View File

@ -42,8 +42,8 @@ void FMenuBar::init()
getRootWidget()->setTopPadding(1, true);
x = -1;
setMenuBar(this);
foregroundColor = wc.statusbar_fg;
backgroundColor = wc.statusbar_bg;
foregroundColor = wc.menu_active_fg;
backgroundColor = wc.menu_active_bg;
window_object = true;
mouse_down = false;
ignore_padding = true;

View File

@ -1,6 +1,7 @@
// fmenuitem.cpp
// class FMenuItem
#include "fmenu.h"
#include "fmenubar.h"
#include "fmenuitem.h"
#include "fmenulist.h"
@ -55,20 +56,38 @@ void FMenuItem::init (FWidget* parent)
menu = 0;
setGeometry (1,1,1,1);
if ( parent && isMenuBar(parent) )
if ( parent )
{
setSuperMenu( dynamic_cast<FMenuList*>(parent) );
superMenu()->insert(this);
if ( isMenuBar(parent) ) // Parent is menubar
{
setSuperMenu( dynamic_cast<FMenuList*>(parent) );
superMenu()->insert(this);
//addAccelerator (item->getKey(), item);
//addAccelerator (item->getKey(), item);
this->addCallback
(
"activate",
(FWidget*)superMenu(),
reinterpret_cast<FWidget::FMemberCallback>(&FMenuBar::cb_item_activated),
null
);
this->addCallback
(
"activate",
(FWidget*)superMenu(),
reinterpret_cast<FWidget::FMemberCallback>(&FMenuBar::cb_item_activated),
null
);
}
else if ( isMenu(parent) ) // Parent is menu
{
setSuperMenu( dynamic_cast<FMenuList*>(parent) );
superMenu()->insert(this);
//addAccelerator (item->getKey(), item);
this->addCallback
(
"activate",
(FWidget*)superMenu(),
reinterpret_cast<FWidget::FMemberCallback>(&FMenu::cb_menuitem_activated),
null
);
}
}
}
@ -95,6 +114,13 @@ bool FMenuItem::isMenuBar (FWidget* w) const
const_cast<char*>("FMenuBar") ) == 0 );
}
//----------------------------------------------------------------------
bool FMenuItem::isMenu (FWidget* w) const
{
return bool ( strcmp ( w->getClassName(),
const_cast<char*>("FMenu") ) == 0 );
}
//----------------------------------------------------------------------
FMenuList* FMenuItem::superMenu() const
{

View File

@ -19,15 +19,15 @@ class FMenuList;
class FMenuItem : public FWidget
{
private:
FString text;
bool active;
bool selected;
bool separator;
bool checked;
int hotkey;
//int accel_key;
FMenu* menu;
FMenuList* super_menu;
FString text;
bool active;
bool selected;
bool separator;
bool checked;
int hotkey;
//int accel_key;
FMenu* menu;
FMenuList* super_menu;
private:
FMenuItem (const FMenuItem&);
@ -35,6 +35,7 @@ class FMenuItem : public FWidget
void init (FWidget*);
uChar getHotkey();
bool isMenuBar (FWidget*) const;
bool isMenu (FWidget*) const;
FMenuList* superMenu() const;
void setSuperMenu (FMenuList*);
void processActivate();
@ -47,26 +48,26 @@ class FMenuItem : public FWidget
FMenuItem (const char*, FWidget* parent=0);
virtual ~FMenuItem();
void onAccel (FAccelEvent*);
FString getText() const;
void setActive();
void unsetActive();
bool isActivated() const;
void setSelected();
void unsetSelected();
bool isSelected() const;
void setSeparator();
void unsetSeparator();
bool isSeparator() const;
void setChecked();
void unsetChecked();
bool isChecked() const;
bool hasHotkey() const;
void setMenu(FMenu*);
bool hasMenu() const;
void setText (FString&);
void setText (const std::string&);
void setText (const char*);
void onAccel (FAccelEvent*);
FString getText() const;
void setActive();
void unsetActive();
bool isActivated() const;
void setSelected();
void unsetSelected();
bool isSelected() const;
void setSeparator();
void unsetSeparator();
bool isSeparator() const;
void setChecked();
void unsetChecked();
bool isChecked() const;
bool hasHotkey() const;
void setMenu(FMenu*);
bool hasMenu() const;
void setText (FString&);
void setText (const std::string&);
void setText (const char*);
private:
friend class FMenuList;

View File

@ -41,17 +41,17 @@ class FMenuList
virtual ~FMenuList();
virtual const char* getClassName() const;
uInt count() const;
FMenuItem* item (int) const;
void activateItem (int);
void deactivateItem (int);
bool isSelected (int) const;
bool hasSelectedItem();
uInt count() const;
FMenuItem* item (int) const;
void activateItem (int);
void deactivateItem (int);
bool isSelected (int) const;
bool hasSelectedItem();
void insert (FMenuItem*);
void remove (FMenuItem*);
void remove (int);
void clear();
virtual void insert (FMenuItem*);
virtual void remove (FMenuItem*);
void remove (int);
void clear();
};
#pragma pack(pop)

View File

@ -1408,7 +1408,7 @@ bool FWidget::setFocus(bool on)
{
bool has_raised = window->raiseWindow();
FWindow::setActiveWindow(window);
if ( has_raised )
if ( has_raised && window->isVisible() && window->isShown() )
window->redraw();
}
window->setFocusWidget(this);