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 *.gcno
*.gcda *.gcda
_configs.sed _configs.sed
config.* config.guess
config.h
config.log
config.lt
config.status
config.sub
Makefile Makefile
libtool libtool
/autom4te.cache /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 ) if ( on )
this->flags |= NO_UNDERLINE; 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); 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); FWidget::setFocus(on);
@ -496,7 +496,7 @@ bool FButton::setFocus(bool on)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
bool FButton::setFlat(bool on) bool FButton::setFlat (bool on)
{ {
if ( on ) if ( on )
this->flags |= FLAT; 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 ) if ( on && Encoding != fc::VT100 && Encoding != fc::ASCII )
this->flags |= SHADOW; 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 ) if ( button_down != on )
{ {

View File

@ -1,6 +1,6 @@
#ifndef _SRC_FCONFIG_H #ifndef _SRC_FCONFIG_H
#define _SRC_FCONFIG_H 1 #define _SRC_FCONFIG_H 1
/* src/fconfig.h. Generated automatically at end of configure. */ /* src/fconfig.h. Generated automatically at end of configure. */
/* config.h. Generated from config.h.in by configure. */ /* config.h. Generated from config.h.in by configure. */
/* config.h.in. Generated from configure.ac by autoheader. */ /* config.h.in. Generated from configure.ac by autoheader. */
@ -171,6 +171,6 @@
#ifndef F_VERSION #ifndef F_VERSION
#define F_VERSION "0.1.1" #define F_VERSION "0.1.1"
#endif #endif
/* once: _SRC_FCONFIG_H */ /* once: _SRC_FCONFIG_H */
#endif #endif

View File

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

View File

@ -44,8 +44,7 @@ FMenu::~FMenu()
const FRect& geometry = getGeometryGlobalShadow(); const FRect& geometry = getGeometryGlobalShadow();
restoreVTerm (geometry); restoreVTerm (geometry);
parentWidget()->redraw(); // ????
if ( vwin != 0 ) if ( vwin != 0 )
{ {
if ( vwin->changes != 0 ) if ( vwin->changes != 0 )
@ -61,6 +60,7 @@ FMenu::~FMenu()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FMenu::init() void FMenu::init()
{ {
current = 0;
width = 10; width = 10;
height = 2; height = 2;
xmin = 1; xmin = 1;
@ -76,22 +76,48 @@ void FMenu::init()
bottom_padding = 1; bottom_padding = 1;
right_padding = 1; right_padding = 1;
createArea (vwin); createArea (vwin);
setGeometry (1, 1, 10, 2, false); // initialize geometry values setGeometry (1, 1 , 10, 2, false); // initialize geometry values
ignore_padding = true;
window_object = true; window_object = true;
addWindow(this); addWindow(this);
setActiveWindow(this);
foregroundColor = wc.menu_active_fg;
backgroundColor = wc.menu_active_bg;
FWidget* old_focus = FWidget::getFocusWidget(); FWidget* old_focus = FWidget::getFocusWidget();
if ( old_focus ) if ( old_focus )
{ {
setFocus(); setFocus();
old_focus->redraw(); old_focus->redraw();
} }
item->setMenu(this); 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 bool FMenu::isMenuBar (FWidget* w) const
{ {
@ -138,22 +164,92 @@ void FMenu::draw()
if ( itemlist.empty() ) if ( itemlist.empty() )
return; return;
if ( current < 1 )
{
current = 1;
itemlist[0]->setSelected();
}
menu_dimension();
// fill the background // fill the background
setColor (foregroundColor, backgroundColor); setColor (foregroundColor, backgroundColor);
setUpdateVTerm(false); setUpdateVTerm(false);
clrscr(); clrscr();
drawBorder(); drawBorder();
drawItems(); drawItems();
setUpdateVTerm(true); 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() void FMenu::drawItems()
{ {
std::vector<FMenuItem*>::const_iterator iter, end; std::vector<FMenuItem*>::const_iterator iter, end;
int y = 1; int y = 0;
iter = itemlist.begin(); iter = itemlist.begin();
end = itemlist.end(); end = itemlist.end();
@ -190,7 +286,7 @@ void FMenu::drawItems()
foregroundColor = wc.menu_inactive_fg; foregroundColor = wc.menu_inactive_fg;
backgroundColor = wc.menu_inactive_bg; backgroundColor = wc.menu_inactive_bg;
} }
gotoxy (xpos+xmin+1, ypos+ymin+y); gotoxy (xpos+xmin, ypos+ymin+y);
setColor (foregroundColor, backgroundColor); setColor (foregroundColor, backgroundColor);
print (' '); print (' ');
@ -226,6 +322,12 @@ void FMenu::drawItems()
print (item_text[z]); print (item_text[z]);
} }
if ( isSelected )
{
for (uInt i=to_char; i <= maxItemWidth; i++)
print (' ');
}
if ( isActive && isSelected ) if ( isActive && isSelected )
setReverse(false); setReverse(false);
delete[] item_text; delete[] item_text;
@ -401,6 +503,18 @@ void FMenu::setGeometry (int xx, int yy, int ww, int hh, bool adjust)
resizeArea (vwin); 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*) void FMenu::cb_menuitem_activated (FWidget* widget, void*)
{ {

View File

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

View File

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

View File

@ -1,6 +1,7 @@
// fmenuitem.cpp // fmenuitem.cpp
// class FMenuItem // class FMenuItem
#include "fmenu.h"
#include "fmenubar.h" #include "fmenubar.h"
#include "fmenuitem.h" #include "fmenuitem.h"
#include "fmenulist.h" #include "fmenulist.h"
@ -55,20 +56,38 @@ void FMenuItem::init (FWidget* parent)
menu = 0; menu = 0;
setGeometry (1,1,1,1); setGeometry (1,1,1,1);
if ( parent && isMenuBar(parent) ) if ( parent )
{ {
setSuperMenu( dynamic_cast<FMenuList*>(parent) ); if ( isMenuBar(parent) ) // Parent is menubar
superMenu()->insert(this); {
setSuperMenu( dynamic_cast<FMenuList*>(parent) );
//addAccelerator (item->getKey(), item); superMenu()->insert(this);
this->addCallback //addAccelerator (item->getKey(), item);
(
"activate", this->addCallback
(FWidget*)superMenu(), (
reinterpret_cast<FWidget::FMemberCallback>(&FMenuBar::cb_item_activated), "activate",
null (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 ); 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 FMenuList* FMenuItem::superMenu() const
{ {

View File

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

View File

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

View File

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