The Final Cut now also compiles under Solaris
This commit is contained in:
parent
c10a88008c
commit
ec57ec6f74
|
@ -1,6 +1,7 @@
|
||||||
exclude:
|
exclude:
|
||||||
- /fonts/newfont.h
|
- /fonts/newfont.h
|
||||||
- /fonts/vgafont.h
|
- /fonts/vgafont.h
|
||||||
|
- /fonts/unicodemap.h
|
||||||
- /ltmain.sh
|
- /ltmain.sh
|
||||||
component_depth: 3
|
component_depth: 3
|
||||||
languages:
|
languages:
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
2017-12-17 Markus Gans <guru.mail@muenster.de>
|
||||||
|
* The Final Cut now also compiles under Solaris
|
||||||
|
|
||||||
2017-12-14 Markus Gans <guru.mail@muenster.de>
|
2017-12-14 Markus Gans <guru.mail@muenster.de>
|
||||||
* Add Sun Microsystems workstation console support
|
* Add Sun Microsystems workstation console support
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,14 @@
|
||||||
> su -c "make install"
|
> su -c "make install"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Supported platforms
|
||||||
|
* Linux
|
||||||
|
* FreeBSD
|
||||||
|
* NetBSD
|
||||||
|
* OpenBSD
|
||||||
|
* macOS
|
||||||
|
* Solaris
|
||||||
|
|
||||||
The Final Cut
|
The Final Cut
|
||||||
=============
|
=============
|
||||||
The Final Cut is a C++ class library and widget toolkit with full mouse support for creating a [text-based user interface](https://en.wikipedia.org/wiki/Text-based_user_interface). The library supports the programmer to develop an application for the text console. It allows the simultaneous handling of multiple text windows on the screen.
|
The Final Cut is a C++ class library and widget toolkit with full mouse support for creating a [text-based user interface](https://en.wikipedia.org/wiki/Text-based_user_interface). The library supports the programmer to develop an application for the text console. It allows the simultaneous handling of multiple text windows on the screen.
|
||||||
|
|
10
build.sh
10
build.sh
|
@ -91,7 +91,15 @@ esac
|
||||||
JOBS="$((CPU_COUNT/2))"
|
JOBS="$((CPU_COUNT/2))"
|
||||||
test "$JOBS" -eq 0 && JOBS=1
|
test "$JOBS" -eq 0 && JOBS=1
|
||||||
|
|
||||||
if make V=1 -j$JOBS
|
if make -h 2<&1 | grep -q "\\-\\-jobs"
|
||||||
|
then
|
||||||
|
MAKE="make V=1 -j$JOBS"
|
||||||
|
else
|
||||||
|
MAKE="make V=1"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
if $MAKE
|
||||||
then
|
then
|
||||||
echo "${GREEN}Successful compiled${NORMAL}"
|
echo "${GREEN}Successful compiled${NORMAL}"
|
||||||
else
|
else
|
||||||
|
|
|
@ -8,6 +8,7 @@ FONTFILE="8x16graph.bdf"
|
||||||
echo -e "// newfont.h\\n"
|
echo -e "// newfont.h\\n"
|
||||||
echo -e "#ifndef FNEWFONT_H"
|
echo -e "#ifndef FNEWFONT_H"
|
||||||
echo -e "#define FNEWFONT_H\\n"
|
echo -e "#define FNEWFONT_H\\n"
|
||||||
|
echo -e "namespace fc\\n{"
|
||||||
echo -e "\\nstatic unsigned char __8x16graph[] =\\n{"
|
echo -e "\\nstatic unsigned char __8x16graph[] =\\n{"
|
||||||
|
|
||||||
grep -A${HEIGHT} ^BITMAP "$FONTFILE" \
|
grep -A${HEIGHT} ^BITMAP "$FONTFILE" \
|
||||||
|
@ -26,6 +27,7 @@ FONTFILE="8x16graph.bdf"
|
||||||
done
|
done
|
||||||
|
|
||||||
echo -e "};"
|
echo -e "};"
|
||||||
|
echo -e "\\n} // namespace fc"
|
||||||
echo -e "\\n#endif // FNEWFONT_H"
|
echo -e "\\n#endif // FNEWFONT_H"
|
||||||
) > newfont.h
|
) > newfont.h
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@ FONTFILE="8x16std"
|
||||||
echo -e "// vgafont.h\\n"
|
echo -e "// vgafont.h\\n"
|
||||||
echo -e "#ifndef FVGAFONT_H"
|
echo -e "#ifndef FVGAFONT_H"
|
||||||
echo -e "#define FVGAFONT_H\\n"
|
echo -e "#define FVGAFONT_H\\n"
|
||||||
|
echo -e "namespace fc\\n{\\n"
|
||||||
|
|
||||||
xxd -g 1 -i -c $HEIGHT $FONTFILE \
|
xxd -g 1 -i -c $HEIGHT $FONTFILE \
|
||||||
| sed -e 's/ {$/\n{/' \
|
| sed -e 's/ {$/\n{/' \
|
||||||
|
@ -24,5 +25,6 @@ FONTFILE="8x16std"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
echo -e "\\n} // namespace fc"
|
||||||
echo -e "\\n#endif // FVGAFONT_H"
|
echo -e "\\n#endif // FVGAFONT_H"
|
||||||
) > vgafont.h
|
) > vgafont.h
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
#ifndef FNEWFONT_H
|
#ifndef FNEWFONT_H
|
||||||
#define FNEWFONT_H
|
#define FNEWFONT_H
|
||||||
|
|
||||||
|
namespace fc
|
||||||
|
{
|
||||||
|
|
||||||
static unsigned char __8x16graph[] =
|
static unsigned char __8x16graph[] =
|
||||||
{
|
{
|
||||||
|
@ -264,4 +266,6 @@ static unsigned char __8x16graph[] =
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 /* 255 */
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 /* 255 */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // namespace fc
|
||||||
|
|
||||||
#endif // FNEWFONT_H
|
#endif // FNEWFONT_H
|
||||||
|
|
|
@ -3,6 +3,9 @@
|
||||||
#ifndef FUNICODEMAP_H
|
#ifndef FUNICODEMAP_H
|
||||||
#define FUNICODEMAP_H
|
#define FUNICODEMAP_H
|
||||||
|
|
||||||
|
namespace fc
|
||||||
|
{
|
||||||
|
|
||||||
static struct unipair unicode_cp437_pairs[] =
|
static struct unipair unicode_cp437_pairs[] =
|
||||||
{
|
{
|
||||||
// .----------- unicode
|
// .----------- unicode
|
||||||
|
@ -313,4 +316,6 @@ static struct unipair unicode_cp437_pairs[] =
|
||||||
{0xfffd, 0xfe}
|
{0xfffd, 0xfe}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // namespace fc
|
||||||
|
|
||||||
#endif // FUNICODEMAP_H
|
#endif // FUNICODEMAP_H
|
||||||
|
|
|
@ -3,6 +3,9 @@
|
||||||
#ifndef FVGAFONT_H
|
#ifndef FVGAFONT_H
|
||||||
#define FVGAFONT_H
|
#define FVGAFONT_H
|
||||||
|
|
||||||
|
namespace fc
|
||||||
|
{
|
||||||
|
|
||||||
static unsigned char __8x16std[] =
|
static unsigned char __8x16std[] =
|
||||||
{
|
{
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0 */
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0 */
|
||||||
|
@ -263,4 +266,6 @@ static unsigned char __8x16std[] =
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 /* 255 */
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 /* 255 */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // namespace fc
|
||||||
|
|
||||||
#endif // FVGAFONT_H
|
#endif // FVGAFONT_H
|
||||||
|
|
|
@ -0,0 +1,93 @@
|
||||||
|
/***********************************************************************
|
||||||
|
* emptyfstring.h - Creates an empty FString object *
|
||||||
|
* *
|
||||||
|
* This file is part of the Final Cut widget toolkit *
|
||||||
|
* *
|
||||||
|
* Copyright 2015-2017 Markus Gans *
|
||||||
|
* *
|
||||||
|
* The Final Cut is free software; you can redistribute it and/or *
|
||||||
|
* modify it under the terms of the GNU Lesser General Public License *
|
||||||
|
* as published by the Free Software Foundation; either version 3 of *
|
||||||
|
* the License, or (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
* The Final Cut is distributed in the hope that it will be useful, *
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
|
* GNU Lesser General Public License for more details. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the GNU Lesser General Public *
|
||||||
|
* License along with this program. If not, see *
|
||||||
|
* <http://www.gnu.org/licenses/>. *
|
||||||
|
***********************************************************************/
|
||||||
|
|
||||||
|
#ifndef EMPTYFSTRING_H
|
||||||
|
#define EMPTYFSTRING_H
|
||||||
|
|
||||||
|
#if !defined (USE_FINAL_H) && !defined (COMPILE_FINAL_CUT)
|
||||||
|
#error "Only <final/final.h> can be included directly."
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "final/fstring.h"
|
||||||
|
|
||||||
|
namespace fc
|
||||||
|
{
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
// class emptyFString
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
class emptyFString
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
emptyFString()
|
||||||
|
{ }
|
||||||
|
|
||||||
|
static bool isNull();
|
||||||
|
static const FString& get();
|
||||||
|
static void clear();
|
||||||
|
|
||||||
|
private:
|
||||||
|
// Disable copy constructor
|
||||||
|
emptyFString (const emptyFString&);
|
||||||
|
|
||||||
|
// Disable assignment operator (=)
|
||||||
|
emptyFString& operator = (const emptyFString&);
|
||||||
|
|
||||||
|
// Data Member
|
||||||
|
static const FString* empty_string;
|
||||||
|
};
|
||||||
|
|
||||||
|
// emptyFString inline functions
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline bool emptyFString::isNull()
|
||||||
|
{
|
||||||
|
return ( empty_string ) ? false : true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline const FString& emptyFString::get()
|
||||||
|
{
|
||||||
|
if ( ! empty_string )
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
empty_string = new FString("");
|
||||||
|
}
|
||||||
|
catch (const std::bad_alloc& ex)
|
||||||
|
{
|
||||||
|
std::cerr << "not enough memory to alloc " << ex.what() << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return *empty_string;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline void emptyFString::clear()
|
||||||
|
{
|
||||||
|
delete empty_string;
|
||||||
|
empty_string = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace fc
|
||||||
|
|
||||||
|
#endif // EMPTYFSTRING_H
|
|
@ -20,14 +20,6 @@
|
||||||
* <http://www.gnu.org/licenses/>. *
|
* <http://www.gnu.org/licenses/>. *
|
||||||
***********************************************************************/
|
***********************************************************************/
|
||||||
|
|
||||||
/* Standalone class
|
|
||||||
* ════════════════
|
|
||||||
*
|
|
||||||
* ▕▔▔▔▔▔▔▔▔▏
|
|
||||||
* ▕ fc ▏
|
|
||||||
* ▕▁▁▁▁▁▁▁▁▏
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef FC_H
|
#ifndef FC_H
|
||||||
#define FC_H
|
#define FC_H
|
||||||
|
|
||||||
|
@ -35,9 +27,7 @@
|
||||||
#error "Only <final/final.h> can be included directly."
|
#error "Only <final/final.h> can be included directly."
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "final/fstring.h"
|
// ASCII sequences
|
||||||
|
|
||||||
// ascii sequences
|
|
||||||
#define ESC "\033" // Escape
|
#define ESC "\033" // Escape
|
||||||
#define CSI ESC "[" // Control sequence introducer (7-bit)
|
#define CSI ESC "[" // Control sequence introducer (7-bit)
|
||||||
#define ENQ "\005" // Enquiry
|
#define ENQ "\005" // Enquiry
|
||||||
|
@ -50,18 +40,15 @@
|
||||||
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
// class fc
|
// Global constants and enumerations
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
||||||
#pragma pack(push)
|
namespace fc
|
||||||
#pragma pack(1)
|
{
|
||||||
|
|
||||||
class fc
|
// Event types
|
||||||
|
enum events
|
||||||
{
|
{
|
||||||
public:
|
|
||||||
// Event types
|
|
||||||
enum events
|
|
||||||
{
|
|
||||||
None_Event, // invalid event
|
None_Event, // invalid event
|
||||||
KeyPress_Event, // key pressed
|
KeyPress_Event, // key pressed
|
||||||
KeyUp_Event, // key released
|
KeyUp_Event, // key released
|
||||||
|
@ -85,11 +72,11 @@ class fc
|
||||||
Hide_Event, // widget is hidden
|
Hide_Event, // widget is hidden
|
||||||
Close_Event, // widget close
|
Close_Event, // widget close
|
||||||
Timer_Event // timer event occur
|
Timer_Event // timer event occur
|
||||||
};
|
};
|
||||||
|
|
||||||
// Properties of a widget
|
// Properties of a widget
|
||||||
enum widget_flags
|
enum widget_flags
|
||||||
{
|
{
|
||||||
shadow = 0x00000001,
|
shadow = 0x00000001,
|
||||||
trans_shadow = 0x00000002,
|
trans_shadow = 0x00000002,
|
||||||
active = 0x00000004,
|
active = 0x00000004,
|
||||||
|
@ -103,22 +90,22 @@ class fc
|
||||||
always_on_top = 0x00000400,
|
always_on_top = 0x00000400,
|
||||||
flat = 0x00000800,
|
flat = 0x00000800,
|
||||||
no_underline = 0x00001000
|
no_underline = 0x00001000
|
||||||
};
|
};
|
||||||
|
|
||||||
// Internal character encoding
|
// Internal character encoding
|
||||||
enum encoding
|
enum encoding
|
||||||
{
|
{
|
||||||
UTF8,
|
UTF8,
|
||||||
VT100,
|
VT100,
|
||||||
PC,
|
PC,
|
||||||
ASCII,
|
ASCII,
|
||||||
NUM_OF_ENCODINGS, // number of items
|
NUM_OF_ENCODINGS, // number of items
|
||||||
UNKNOWN
|
UNKNOWN
|
||||||
};
|
};
|
||||||
|
|
||||||
// VT100 line graphic keys
|
// VT100 line graphic keys
|
||||||
enum vt100_keys
|
enum vt100_keys
|
||||||
{
|
{
|
||||||
vt100_key_rarrow = '+', // ► - arrow pointing right
|
vt100_key_rarrow = '+', // ► - arrow pointing right
|
||||||
vt100_key_larrow = ',', // ◄ - arrow pointing left
|
vt100_key_larrow = ',', // ◄ - arrow pointing left
|
||||||
vt100_key_uarrow = '-', // ▲ - arrow pointing up
|
vt100_key_uarrow = '-', // ▲ - arrow pointing up
|
||||||
|
@ -157,11 +144,11 @@ class fc
|
||||||
vt100_key_nequal = '|', // ≠ - not-equal
|
vt100_key_nequal = '|', // ≠ - not-equal
|
||||||
vt100_key_sterling = '}', // £ - UK pound sign
|
vt100_key_sterling = '}', // £ - UK pound sign
|
||||||
vt100_key_bullet = '~' // · - bullet
|
vt100_key_bullet = '~' // · - bullet
|
||||||
};
|
};
|
||||||
|
|
||||||
// Unicode characters
|
// Unicode characters
|
||||||
enum SpecialCharacter
|
enum SpecialCharacter
|
||||||
{
|
{
|
||||||
Euro = 0x20ac, // €
|
Euro = 0x20ac, // €
|
||||||
Pound = 0x00a3, // £
|
Pound = 0x00a3, // £
|
||||||
Pi = 0x03c0, // π
|
Pi = 0x03c0, // π
|
||||||
|
@ -254,15 +241,15 @@ class fc
|
||||||
NF_Bullet = 0x1af9, // ● (2)
|
NF_Bullet = 0x1af9, // ● (2)
|
||||||
NF_check_mark = 0x1afb, // ✓ (2)
|
NF_check_mark = 0x1afb, // ✓ (2)
|
||||||
SquareRoot = 0x221a // √
|
SquareRoot = 0x221a // √
|
||||||
};
|
};
|
||||||
/*
|
/*
|
||||||
* (1) Not defined in Windows Glyph List 4 (WGL4)
|
* (1) Not defined in Windows Glyph List 4 (WGL4)
|
||||||
* (2) Only supported in use with newfont
|
* (2) Only supported in use with newfont
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// keyboard - single keys
|
// keyboard - single keys
|
||||||
enum keys
|
enum keys
|
||||||
{
|
{
|
||||||
Fckey_a = 0x0000001, // control-a
|
Fckey_a = 0x0000001, // control-a
|
||||||
Fckey_b = 0x0000002, // control-b
|
Fckey_b = 0x0000002, // control-b
|
||||||
Fckey_c = 0x0000003, // control-c
|
Fckey_c = 0x0000003, // control-c
|
||||||
|
@ -445,11 +432,11 @@ class fc
|
||||||
Fkey_f61 = 0x1000192,
|
Fkey_f61 = 0x1000192,
|
||||||
Fkey_f62 = 0x1000193,
|
Fkey_f62 = 0x1000193,
|
||||||
Fkey_f63 = 0x1000194
|
Fkey_f63 = 0x1000194
|
||||||
};
|
};
|
||||||
|
|
||||||
// Keyboard - modifier key combinations
|
// Keyboard - modifier key combinations
|
||||||
enum metakeys
|
enum metakeys
|
||||||
{
|
{
|
||||||
Fmkey_ic = 0x1500100, // M-insert
|
Fmkey_ic = 0x1500100, // M-insert
|
||||||
Fmkey_dc = 0x1500101, // M-delete
|
Fmkey_dc = 0x1500101, // M-delete
|
||||||
Fmkey_home = 0x1500102, // M-home
|
Fmkey_home = 0x1500102, // M-home
|
||||||
|
@ -656,11 +643,11 @@ class fc
|
||||||
Fmkey_vertical_bar = 0x200015c, // M-|
|
Fmkey_vertical_bar = 0x200015c, // M-|
|
||||||
Fmkey_right_curly_bracket = 0x200015d, // M-}
|
Fmkey_right_curly_bracket = 0x200015d, // M-}
|
||||||
Fmkey_tilde = 0x200015e // M-~
|
Fmkey_tilde = 0x200015e // M-~
|
||||||
};
|
};
|
||||||
|
|
||||||
// Console color names
|
// Console color names
|
||||||
enum colornames
|
enum colornames
|
||||||
{
|
{
|
||||||
Default = -1,
|
Default = -1,
|
||||||
Black = 0,
|
Black = 0,
|
||||||
Blue = 1,
|
Blue = 1,
|
||||||
|
@ -678,7 +665,7 @@ class fc
|
||||||
LightMagenta = 13,
|
LightMagenta = 13,
|
||||||
Yellow = 14,
|
Yellow = 14,
|
||||||
White = 15,
|
White = 15,
|
||||||
/* 256 color terminals */
|
/* 256 color terminals */
|
||||||
Grey0 = 16, // #000000
|
Grey0 = 16, // #000000
|
||||||
NavyBlue = 17, // #00005f
|
NavyBlue = 17, // #00005f
|
||||||
DarkBlue = 18, // #000087
|
DarkBlue = 18, // #000087
|
||||||
|
@ -919,11 +906,11 @@ class fc
|
||||||
Grey85 = 253, // #dadada
|
Grey85 = 253, // #dadada
|
||||||
Grey89 = 254, // #e4e4e4
|
Grey89 = 254, // #e4e4e4
|
||||||
Grey93 = 255 // #eeeeee
|
Grey93 = 255 // #eeeeee
|
||||||
};
|
};
|
||||||
|
|
||||||
// Mouse/keyboard state values
|
// Mouse/keyboard state values
|
||||||
enum ButtonState
|
enum ButtonState
|
||||||
{
|
{
|
||||||
NoButton = 0x00,
|
NoButton = 0x00,
|
||||||
LeftButton = 0x01,
|
LeftButton = 0x01,
|
||||||
RightButton = 0x02,
|
RightButton = 0x02,
|
||||||
|
@ -933,46 +920,46 @@ class fc
|
||||||
ControlButton = 0x10,
|
ControlButton = 0x10,
|
||||||
MetaButton = 0x20,
|
MetaButton = 0x20,
|
||||||
KeyButtonMask = 0x38
|
KeyButtonMask = 0x38
|
||||||
};
|
};
|
||||||
|
|
||||||
// Wheel state values
|
// Wheel state values
|
||||||
enum WheelState
|
enum WheelState
|
||||||
{
|
{
|
||||||
NoWheel = 0x00,
|
NoWheel = 0x00,
|
||||||
WheelUp = 0x01,
|
WheelUp = 0x01,
|
||||||
WheelDown = 0x02,
|
WheelDown = 0x02,
|
||||||
WheelMask = 0x03
|
WheelMask = 0x03
|
||||||
};
|
};
|
||||||
|
|
||||||
// Type of focus
|
// Type of focus
|
||||||
enum FocusTypes
|
enum FocusTypes
|
||||||
{
|
{
|
||||||
FocusNextWidget = 0x00,
|
FocusNextWidget = 0x00,
|
||||||
FocusPreviousWidget = 0x01,
|
FocusPreviousWidget = 0x01,
|
||||||
FocusDefiniteWidget = 0x03 // event default
|
FocusDefiniteWidget = 0x03 // event default
|
||||||
};
|
};
|
||||||
|
|
||||||
// Drag scrolling mode
|
// Drag scrolling mode
|
||||||
enum dragScroll
|
enum dragScroll
|
||||||
{
|
{
|
||||||
noScroll = 0,
|
noScroll = 0,
|
||||||
scrollUp = 1,
|
scrollUp = 1,
|
||||||
scrollDown = 2,
|
scrollDown = 2,
|
||||||
scrollUpSelect = 3,
|
scrollUpSelect = 3,
|
||||||
scrollDownSelect = 4
|
scrollDownSelect = 4
|
||||||
};
|
};
|
||||||
|
|
||||||
// Scroll bar visibility mode
|
// Scroll bar visibility mode
|
||||||
enum scrollBarMode
|
enum scrollBarMode
|
||||||
{
|
{
|
||||||
Auto = 0, // Shows a scroll bar when area is larger than viewport
|
Auto = 0, // Shows a scroll bar when area is larger than viewport
|
||||||
Hidden = 1, // Never shows a scroll bar
|
Hidden = 1, // Never shows a scroll bar
|
||||||
Scroll = 2 // Always shows a scroll bar
|
Scroll = 2 // Always shows a scroll bar
|
||||||
};
|
};
|
||||||
|
|
||||||
// Xterm cursor style
|
// Xterm cursor style
|
||||||
enum xtermCursorStyle
|
enum xtermCursorStyle
|
||||||
{
|
{
|
||||||
blinking_block = 0,
|
blinking_block = 0,
|
||||||
blinking_block_default = 1,
|
blinking_block_default = 1,
|
||||||
steady_block = 2,
|
steady_block = 2,
|
||||||
|
@ -980,11 +967,11 @@ class fc
|
||||||
steady_underline = 4,
|
steady_underline = 4,
|
||||||
blinking_bar_xterm = 5,
|
blinking_bar_xterm = 5,
|
||||||
steady_bar_xterm = 6
|
steady_bar_xterm = 6
|
||||||
};
|
};
|
||||||
|
|
||||||
// Linux console and framebuffer cursor style
|
// Linux console and framebuffer cursor style
|
||||||
enum linuxConsoleCursorStyle
|
enum linuxConsoleCursorStyle
|
||||||
{
|
{
|
||||||
default_cursor = 0,
|
default_cursor = 0,
|
||||||
invisible_cursor = 1,
|
invisible_cursor = 1,
|
||||||
underscore_cursor = 2,
|
underscore_cursor = 2,
|
||||||
|
@ -992,56 +979,56 @@ class fc
|
||||||
lower_half_cursor = 4,
|
lower_half_cursor = 4,
|
||||||
two_thirds_cursor = 5,
|
two_thirds_cursor = 5,
|
||||||
full_block_cursor = 6
|
full_block_cursor = 6
|
||||||
};
|
};
|
||||||
|
|
||||||
// BSD console cursor style
|
// BSD console cursor style
|
||||||
enum freebsdConsoleCursorStyle
|
enum freebsdConsoleCursorStyle
|
||||||
{
|
{
|
||||||
normal_cursor = 0,
|
normal_cursor = 0,
|
||||||
blink_cursor = 1,
|
blink_cursor = 1,
|
||||||
destructive_cursor = 3
|
destructive_cursor = 3
|
||||||
};
|
};
|
||||||
|
|
||||||
// KDE konsole cursor style
|
// KDE konsole cursor style
|
||||||
enum kdeKonsoleCursorShape
|
enum kdeKonsoleCursorShape
|
||||||
{
|
{
|
||||||
BlockCursor = 0,
|
BlockCursor = 0,
|
||||||
IBeamCursor = 1,
|
IBeamCursor = 1,
|
||||||
UnderlineCursor = 2
|
UnderlineCursor = 2
|
||||||
};
|
};
|
||||||
|
|
||||||
enum text_alignment
|
enum text_alignment
|
||||||
{
|
{
|
||||||
alignLeft = 1,
|
alignLeft = 1,
|
||||||
alignCenter = 2,
|
alignCenter = 2,
|
||||||
alignRight = 3
|
alignRight = 3
|
||||||
};
|
};
|
||||||
|
|
||||||
enum orientation
|
enum orientation
|
||||||
{
|
{
|
||||||
vertical = 0,
|
vertical = 0,
|
||||||
horizontal = 1
|
horizontal = 1
|
||||||
};
|
};
|
||||||
|
|
||||||
enum sides
|
enum sides
|
||||||
{
|
{
|
||||||
top = 0,
|
top = 0,
|
||||||
right = 1,
|
right = 1,
|
||||||
bottom = 2,
|
bottom = 2,
|
||||||
left = 3
|
left = 3
|
||||||
};
|
};
|
||||||
|
|
||||||
enum brackets_type
|
enum brackets_type
|
||||||
{
|
{
|
||||||
NoBrackets = 0,
|
NoBrackets = 0,
|
||||||
SquareBrackets = 1, // [ ]
|
SquareBrackets = 1, // [ ]
|
||||||
Parenthesis = 2, // ( )
|
Parenthesis = 2, // ( )
|
||||||
CurlyBrackets = 3, // { }
|
CurlyBrackets = 3, // { }
|
||||||
AngleBrackets = 4 // < >
|
AngleBrackets = 4 // < >
|
||||||
};
|
};
|
||||||
|
|
||||||
enum termcaps
|
enum termcaps
|
||||||
{
|
{
|
||||||
t_bell,
|
t_bell,
|
||||||
t_erase_chars,
|
t_erase_chars,
|
||||||
t_clear_screen,
|
t_clear_screen,
|
||||||
|
@ -1124,12 +1111,8 @@ class fc
|
||||||
t_keypad_xmit,
|
t_keypad_xmit,
|
||||||
t_keypad_local,
|
t_keypad_local,
|
||||||
t_key_mouse
|
t_key_mouse
|
||||||
};
|
|
||||||
|
|
||||||
// Data Member
|
|
||||||
static const FString* empty_string;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#pragma pack(pop)
|
} // namespace fc
|
||||||
|
|
||||||
#endif // FC_H
|
#endif // FC_H
|
||||||
|
|
|
@ -27,6 +27,9 @@
|
||||||
#error "Only <final/final.h> can be included directly."
|
#error "Only <final/final.h> can be included directly."
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
namespace fc
|
||||||
|
{
|
||||||
|
|
||||||
static uInt character[][fc::NUM_OF_ENCODINGS] =
|
static uInt character[][fc::NUM_OF_ENCODINGS] =
|
||||||
{
|
{
|
||||||
// .--------------------- Unicode (UTF-8)
|
// .--------------------- Unicode (UTF-8)
|
||||||
|
@ -319,6 +322,6 @@ static uInt cp437_to_ucs[][2] =
|
||||||
|
|
||||||
const uInt lastCP437Item = uInt ( sizeof(cp437_to_ucs)
|
const uInt lastCP437Item = uInt ( sizeof(cp437_to_ucs)
|
||||||
/ sizeof(cp437_to_ucs[0]) ) - 1;
|
/ sizeof(cp437_to_ucs[0]) ) - 1;
|
||||||
|
} // namespace fc
|
||||||
|
|
||||||
#endif // FCHARMAP_H
|
#endif // FCHARMAP_H
|
||||||
|
|
|
@ -147,7 +147,15 @@ class FFileDialog : public FDialog
|
||||||
struct dir_entry
|
struct dir_entry
|
||||||
{
|
{
|
||||||
char* name;
|
char* name;
|
||||||
uChar type;
|
// Type of file
|
||||||
|
uChar fifo : 1;
|
||||||
|
uChar character_device : 1;
|
||||||
|
uChar directory : 1;
|
||||||
|
uChar block_device : 1;
|
||||||
|
uChar regular_file : 1;
|
||||||
|
uChar symbolic_link : 1;
|
||||||
|
uChar socket : 1;
|
||||||
|
uChar : 1; // padding bits
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::vector<dir_entry> dirEntries;
|
typedef std::vector<dir_entry> dirEntries;
|
||||||
|
@ -157,6 +165,7 @@ class FFileDialog : public FDialog
|
||||||
inline bool pattern_match (const char* const, char*&);
|
inline bool pattern_match (const char* const, char*&);
|
||||||
void clear();
|
void clear();
|
||||||
int numOfDirs();
|
int numOfDirs();
|
||||||
|
void sortDir();
|
||||||
int changeDir (const FString&);
|
int changeDir (const FString&);
|
||||||
void printPath (const FString&);
|
void printPath (const FString&);
|
||||||
static const FString getHomeDir();
|
static const FString getHomeDir();
|
||||||
|
|
|
@ -29,6 +29,9 @@
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
namespace fc
|
||||||
|
{
|
||||||
|
|
||||||
#pragma pack(push)
|
#pragma pack(push)
|
||||||
#pragma pack(1)
|
#pragma pack(1)
|
||||||
|
|
||||||
|
@ -852,4 +855,6 @@ static keyname FkeyName[] =
|
||||||
{ 0 , "\0" }
|
{ 0 , "\0" }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // namespace fc
|
||||||
|
|
||||||
#endif // FKEYMAP_H
|
#endif // FKEYMAP_H
|
||||||
|
|
|
@ -35,18 +35,19 @@
|
||||||
#error "Only <final/final.h> can be included directly."
|
#error "Only <final/final.h> can be included directly."
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <sys/time.h> // need for gettimeofday
|
#include <sys/time.h> // need for gettimeofday
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include "final/emptyfstring.h"
|
||||||
#include "final/fc.h"
|
#include "final/fc.h"
|
||||||
#include "final/fevent.h"
|
#include "final/fevent.h"
|
||||||
#include "final/ftypes.h"
|
#include "final/ftypes.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
// class FObject
|
// class FObject
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
|
@ -35,12 +35,31 @@
|
||||||
#error "Only <final/final.h> can be included directly."
|
#error "Only <final/final.h> can be included directly."
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Typecast to c-string
|
||||||
|
#define C_STR const_cast<char*>
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <term.h> // need for tparm
|
|
||||||
|
#if defined(__sun) && defined(__SVR4)
|
||||||
|
#include <termio.h>
|
||||||
|
typedef struct termio SGTTY;
|
||||||
|
typedef struct termios SGTTYS;
|
||||||
|
|
||||||
|
#ifdef _LP64
|
||||||
|
typedef unsigned int chtype;
|
||||||
|
#else
|
||||||
|
typedef unsigned long chtype;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <term.h> // need for tparm
|
||||||
|
#else
|
||||||
|
#include <term.h> // need for tparm
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <algorithm> // need for std::swap
|
#include <algorithm> // need for std::swap
|
||||||
|
|
||||||
#include "final/fc.h"
|
#include "final/fc.h"
|
||||||
|
#include "final/ftypes.h"
|
||||||
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
|
@ -39,7 +39,22 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <term.h> // need for tparm
|
|
||||||
|
#if defined(__sun) && defined(__SVR4)
|
||||||
|
#include <termio.h>
|
||||||
|
typedef struct termio SGTTY;
|
||||||
|
typedef struct termios SGTTYS;
|
||||||
|
|
||||||
|
#ifdef _LP64
|
||||||
|
typedef unsigned int chtype;
|
||||||
|
#else
|
||||||
|
typedef unsigned long chtype;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <term.h> // need for tparm
|
||||||
|
#else
|
||||||
|
#include <term.h> // need for tparm
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <cctype>
|
#include <cctype>
|
||||||
#include <climits>
|
#include <climits>
|
||||||
|
|
|
@ -234,7 +234,9 @@ class FString
|
||||||
FString clear();
|
FString clear();
|
||||||
|
|
||||||
const wchar_t* wc_str() const;
|
const wchar_t* wc_str() const;
|
||||||
|
wchar_t* wc_str();
|
||||||
const char* c_str() const;
|
const char* c_str() const;
|
||||||
|
char* c_str();
|
||||||
const std::string toString() const;
|
const std::string toString() const;
|
||||||
|
|
||||||
FString toLower() const;
|
FString toLower() const;
|
||||||
|
|
|
@ -29,6 +29,9 @@
|
||||||
|
|
||||||
#include "final/ftermcap.h"
|
#include "final/ftermcap.h"
|
||||||
|
|
||||||
|
namespace fc
|
||||||
|
{
|
||||||
|
|
||||||
static FTermcap::tcap_map term_caps[] =
|
static FTermcap::tcap_map term_caps[] =
|
||||||
{
|
{
|
||||||
// .------------- term string
|
// .------------- term string
|
||||||
|
@ -133,4 +136,6 @@ static FTermcap::tcap_map term_caps[] =
|
||||||
* "XX", "Us" and "Ue" are unofficial and they are only used here.
|
* "XX", "Us" and "Ue" are unofficial and they are only used here.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
} // namespace fc
|
||||||
|
|
||||||
#endif // FTCAPMAP_H
|
#endif // FTCAPMAP_H
|
||||||
|
|
|
@ -51,6 +51,9 @@
|
||||||
#error "Only <final/final.h> can be included directly."
|
#error "Only <final/final.h> can be included directly."
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Typecast to c-string
|
||||||
|
#define C_STR const_cast<char*>
|
||||||
|
|
||||||
#include "final/fconfig.h"
|
#include "final/fconfig.h"
|
||||||
|
|
||||||
#ifdef F_HAVE_LIBGPM
|
#ifdef F_HAVE_LIBGPM
|
||||||
|
@ -83,9 +86,24 @@
|
||||||
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <langinfo.h>
|
#include <langinfo.h>
|
||||||
#include <term.h> // termcap
|
|
||||||
#include <termios.h>
|
#include <termios.h>
|
||||||
|
|
||||||
|
#if defined(__sun) && defined(__SVR4)
|
||||||
|
#include <termio.h>
|
||||||
|
typedef struct termio SGTTY;
|
||||||
|
typedef struct termios SGTTYS;
|
||||||
|
|
||||||
|
#ifdef _LP64
|
||||||
|
typedef unsigned int chtype;
|
||||||
|
#else
|
||||||
|
typedef unsigned long chtype;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <term.h> // termcap
|
||||||
|
#else
|
||||||
|
#include <term.h> // termcap
|
||||||
|
#endif
|
||||||
|
|
||||||
#if F_HAVE_GETTTYNAM && F_HAVE_TTYENT_H
|
#if F_HAVE_GETTTYNAM && F_HAVE_TTYENT_H
|
||||||
#include <ttyent.h>
|
#include <ttyent.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -293,6 +311,11 @@ class FTerm
|
||||||
#endif
|
#endif
|
||||||
;
|
;
|
||||||
static void putstring (const char* const, int = 1);
|
static void putstring (const char* const, int = 1);
|
||||||
|
|
||||||
|
#if defined(__sun) && defined(__SVR4)
|
||||||
|
static int putchar_ASCII (register char);
|
||||||
|
#endif
|
||||||
|
|
||||||
static int putchar_ASCII (register int);
|
static int putchar_ASCII (register int);
|
||||||
static int putchar_UTF8 (register int);
|
static int putchar_UTF8 (register int);
|
||||||
static int UTF8decode (const char[]);
|
static int UTF8decode (const char[]);
|
||||||
|
@ -612,11 +635,11 @@ inline int FTerm::getMaxColor()
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline const FString& FTerm::getAnswerbackString()
|
inline const FString& FTerm::getAnswerbackString()
|
||||||
{ return ( answer_back ) ? *answer_back : *fc::empty_string; }
|
{ return ( answer_back ) ? *answer_back : fc::emptyFString::get(); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline const FString& FTerm::getSecDAString()
|
inline const FString& FTerm::getSecDAString()
|
||||||
{ return ( sec_da ) ? *sec_da : *fc::empty_string; }
|
{ return ( sec_da ) ? *sec_da : fc::emptyFString::get(); }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
#error "Only <final/final.h> can be included directly."
|
#error "Only <final/final.h> can be included directly."
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
#define null NULL
|
#define null NULL
|
||||||
|
|
|
@ -403,6 +403,11 @@ class FVTerm : public FTerm
|
||||||
static int appendLowerRight (char_data*&);
|
static int appendLowerRight (char_data*&);
|
||||||
static void appendOutputBuffer (const std::string&);
|
static void appendOutputBuffer (const std::string&);
|
||||||
static void appendOutputBuffer (const char*&);
|
static void appendOutputBuffer (const char*&);
|
||||||
|
|
||||||
|
#if defined(__sun) && defined(__SVR4)
|
||||||
|
static int appendOutputBuffer (char);
|
||||||
|
#endif
|
||||||
|
|
||||||
static int appendOutputBuffer (int);
|
static int appendOutputBuffer (int);
|
||||||
|
|
||||||
// Data Members
|
// Data Members
|
||||||
|
|
|
@ -82,7 +82,7 @@ FApplication::FApplication ( const int& _argc
|
||||||
|
|
||||||
if ( ! (_argc && _argv) )
|
if ( ! (_argc && _argv) )
|
||||||
{
|
{
|
||||||
static char* empty = const_cast<char*>("");
|
static char* empty = C_STR("");
|
||||||
app_argc = 0;
|
app_argc = 0;
|
||||||
app_argv = static_cast<char**>(&empty);
|
app_argv = static_cast<char**>(&empty);
|
||||||
}
|
}
|
||||||
|
@ -410,12 +410,12 @@ void FApplication::cmd_options (const int& argc, char* argv[])
|
||||||
|
|
||||||
static struct option long_options[] =
|
static struct option long_options[] =
|
||||||
{
|
{
|
||||||
{"encoding", required_argument, 0, 0 },
|
{C_STR("encoding"), required_argument, 0, 0 },
|
||||||
{"no-optimized-cursor", no_argument, 0, 0 },
|
{C_STR("no-optimized-cursor"), no_argument, 0, 0 },
|
||||||
{"no-terminal-detection", no_argument, 0, 0 },
|
{C_STR("no-terminal-detection"), no_argument, 0, 0 },
|
||||||
{"no-color-change", no_argument, 0, 0 },
|
{C_STR("no-color-change"), no_argument, 0, 0 },
|
||||||
{"vgafont", no_argument, 0, 0 },
|
{C_STR("vgafont"), no_argument, 0, 0 },
|
||||||
{"newfont", no_argument, 0, 0 },
|
{C_STR("newfont"), no_argument, 0, 0 },
|
||||||
{0, 0, 0, 0 }
|
{0, 0, 0, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -597,7 +597,7 @@ bool FButtonGroup::isRadioButton (FToggleButton* button) const
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return bool ( std::strcmp ( button->getClassName()
|
return bool ( std::strcmp ( button->getClassName()
|
||||||
, const_cast<char*>("FRadioButton") ) == 0 );
|
, C_STR("FRadioButton") ) == 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
|
@ -39,7 +39,7 @@ bool sortDirFirst ( const FFileDialog::dir_entry& lhs
|
||||||
, const FFileDialog::dir_entry& rhs )
|
, const FFileDialog::dir_entry& rhs )
|
||||||
{
|
{
|
||||||
// sort directories first
|
// sort directories first
|
||||||
if ( lhs.type == DT_DIR && rhs.type != DT_DIR )
|
if ( lhs.directory && ! rhs.directory )
|
||||||
return true;
|
return true;
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
|
@ -164,7 +164,7 @@ const FString FFileDialog::getSelectedFile() const
|
||||||
{
|
{
|
||||||
uLong n = uLong(filebrowser->currentItem() - 1);
|
uLong n = uLong(filebrowser->currentItem() - 1);
|
||||||
|
|
||||||
if ( dir_entries[n].type == DT_DIR )
|
if ( dir_entries[n].directory )
|
||||||
return FString("");
|
return FString("");
|
||||||
else
|
else
|
||||||
return FString(dir_entries[n].name);
|
return FString(dir_entries[n].name);
|
||||||
|
@ -257,7 +257,6 @@ void FFileDialog::onKeyPress (FKeyEvent* ev)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
int FFileDialog::readDir()
|
int FFileDialog::readDir()
|
||||||
{
|
{
|
||||||
int start, dir_num;
|
|
||||||
const char* const dir = directory.c_str();
|
const char* const dir = directory.c_str();
|
||||||
const char* const filter = filter_pattern.c_str();
|
const char* const filter = filter_pattern.c_str();
|
||||||
directory_stream = opendir(dir);
|
directory_stream = opendir(dir);
|
||||||
|
@ -294,9 +293,28 @@ int FFileDialog::readDir()
|
||||||
|
|
||||||
dir_entry entry;
|
dir_entry entry;
|
||||||
entry.name = strdup(next->d_name);
|
entry.name = strdup(next->d_name);
|
||||||
entry.type = next->d_type;
|
|
||||||
|
|
||||||
if ( next->d_type == DT_LNK ) // symbolic link
|
#if defined _DIRENT_HAVE_D_TYPE || defined HAVE_STRUCT_DIRENT_D_TYPE
|
||||||
|
entry.fifo = (next->d_type & DT_FIFO) == DT_FIFO;
|
||||||
|
entry.character_device = (next->d_type & DT_CHR ) == DT_CHR;
|
||||||
|
entry.directory = (next->d_type & DT_DIR ) == DT_DIR;
|
||||||
|
entry.block_device = (next->d_type & DT_BLK ) == DT_BLK;
|
||||||
|
entry.regular_file = (next->d_type & DT_REG ) == DT_REG;
|
||||||
|
entry.symbolic_link = (next->d_type & DT_LNK ) == DT_LNK;
|
||||||
|
entry.socket = (next->d_type & DT_SOCK) == DT_SOCK;
|
||||||
|
#else
|
||||||
|
struct stat s;
|
||||||
|
stat (entry.name, &s);
|
||||||
|
entry.fifo = S_ISFIFO (s.st_mode);
|
||||||
|
entry.character_device = S_ISCHR (s.st_mode);
|
||||||
|
entry.directory = S_ISDIR (s.st_mode);
|
||||||
|
entry.block_device = S_ISBLK (s.st_mode);
|
||||||
|
entry.regular_file = S_ISREG (s.st_mode);
|
||||||
|
entry.symbolic_link = S_ISLNK (s.st_mode);
|
||||||
|
entry.socket = S_ISSOCK (s.st_mode);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if ( entry.symbolic_link ) // symbolic link
|
||||||
{
|
{
|
||||||
char resolved_path[MAXPATHLEN] = {};
|
char resolved_path[MAXPATHLEN] = {};
|
||||||
char symLink[MAXPATHLEN] = {};
|
char symLink[MAXPATHLEN] = {};
|
||||||
|
@ -312,12 +330,12 @@ int FFileDialog::readDir()
|
||||||
if ( lstat(resolved_path, &sb) == 0 )
|
if ( lstat(resolved_path, &sb) == 0 )
|
||||||
{
|
{
|
||||||
if ( S_ISDIR(sb.st_mode) )
|
if ( S_ISDIR(sb.st_mode) )
|
||||||
entry.type = DT_DIR;
|
entry.directory = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( entry.type == DT_DIR )
|
if ( entry.directory )
|
||||||
dir_entries.push_back (entry);
|
dir_entries.push_back (entry);
|
||||||
else if ( pattern_match(filter, entry.name) )
|
else if ( pattern_match(filter, entry.name) )
|
||||||
dir_entries.push_back (entry);
|
dir_entries.push_back (entry);
|
||||||
|
@ -341,24 +359,8 @@ int FFileDialog::readDir()
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( std::strcmp((*dir_entries.begin()).name, "..") == 0 )
|
sortDir();
|
||||||
start = 1;
|
|
||||||
else
|
|
||||||
start = 0;
|
|
||||||
|
|
||||||
dir_num = numOfDirs();
|
|
||||||
// directories first
|
|
||||||
std::sort ( dir_entries.begin() + start
|
|
||||||
, dir_entries.end()
|
|
||||||
, sortDirFirst );
|
|
||||||
// sort directories by name
|
|
||||||
std::sort ( dir_entries.begin() + start
|
|
||||||
, dir_entries.begin() + dir_num
|
|
||||||
, sortByName );
|
|
||||||
// sort files by name
|
|
||||||
std::sort ( dir_entries.begin() + dir_num
|
|
||||||
, dir_entries.end()
|
|
||||||
, sortByName );
|
|
||||||
// fill list with directory entries
|
// fill list with directory entries
|
||||||
filebrowser->clear();
|
filebrowser->clear();
|
||||||
|
|
||||||
|
@ -370,7 +372,7 @@ int FFileDialog::readDir()
|
||||||
|
|
||||||
while ( iter != last )
|
while ( iter != last )
|
||||||
{
|
{
|
||||||
if ( (*iter).type == DT_DIR )
|
if ( (*iter).directory )
|
||||||
filebrowser->insert(FString((*iter).name), fc::SquareBrackets);
|
filebrowser->insert(FString((*iter).name), fc::SquareBrackets);
|
||||||
else
|
else
|
||||||
filebrowser->insert(FString((*iter).name));
|
filebrowser->insert(FString((*iter).name));
|
||||||
|
@ -665,7 +667,7 @@ int FFileDialog::numOfDirs()
|
||||||
|
|
||||||
while ( iter != last )
|
while ( iter != last )
|
||||||
{
|
{
|
||||||
if ( (*iter).type == DT_DIR && std::strcmp((*iter).name, ".") != 0 )
|
if ( (*iter).directory && std::strcmp((*iter).name, ".") != 0 )
|
||||||
n++;
|
n++;
|
||||||
|
|
||||||
++iter;
|
++iter;
|
||||||
|
@ -674,6 +676,31 @@ int FFileDialog::numOfDirs()
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
void FFileDialog::sortDir()
|
||||||
|
{
|
||||||
|
int start, dir_num;
|
||||||
|
|
||||||
|
if ( std::strcmp((*dir_entries.begin()).name, "..") == 0 )
|
||||||
|
start = 1;
|
||||||
|
else
|
||||||
|
start = 0;
|
||||||
|
|
||||||
|
dir_num = numOfDirs();
|
||||||
|
// directories first
|
||||||
|
std::sort ( dir_entries.begin() + start
|
||||||
|
, dir_entries.end()
|
||||||
|
, sortDirFirst );
|
||||||
|
// sort directories by name
|
||||||
|
std::sort ( dir_entries.begin() + start
|
||||||
|
, dir_entries.begin() + dir_num
|
||||||
|
, sortByName );
|
||||||
|
// sort files by name
|
||||||
|
std::sort ( dir_entries.begin() + dir_num
|
||||||
|
, dir_entries.end()
|
||||||
|
, sortByName );
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
int FFileDialog::changeDir (const FString& dirname)
|
int FFileDialog::changeDir (const FString& dirname)
|
||||||
{
|
{
|
||||||
|
@ -709,7 +736,7 @@ int FFileDialog::changeDir (const FString& dirname)
|
||||||
int i = 1;
|
int i = 1;
|
||||||
std::vector<dir_entry>::const_iterator iter, last;
|
std::vector<dir_entry>::const_iterator iter, last;
|
||||||
const char* const baseName = \
|
const char* const baseName = \
|
||||||
basename(const_cast<char*>(lastdir.c_str()));
|
basename(C_STR(lastdir.c_str()));
|
||||||
iter = dir_entries.begin();
|
iter = dir_entries.begin();
|
||||||
last = dir_entries.end();
|
last = dir_entries.end();
|
||||||
|
|
||||||
|
@ -731,7 +758,7 @@ int FFileDialog::changeDir (const FString& dirname)
|
||||||
{
|
{
|
||||||
FString firstname = dir_entries[0].name;
|
FString firstname = dir_entries[0].name;
|
||||||
|
|
||||||
if ( dir_entries[0].type == DT_DIR )
|
if ( dir_entries[0].directory )
|
||||||
filename->setText(firstname + '/');
|
filename->setText(firstname + '/');
|
||||||
else
|
else
|
||||||
filename->setText(firstname);
|
filename->setText(firstname);
|
||||||
|
@ -808,7 +835,7 @@ void FFileDialog::cb_processActivate (FWidget*, data_ptr)
|
||||||
{
|
{
|
||||||
if ( (*iter).name && input && ! input.isNull()
|
if ( (*iter).name && input && ! input.isNull()
|
||||||
&& std::strcmp((*iter).name, input) == 0
|
&& std::strcmp((*iter).name, input) == 0
|
||||||
&& (*iter).type == DT_DIR )
|
&& (*iter).directory )
|
||||||
{
|
{
|
||||||
found = true;
|
found = true;
|
||||||
changeDir(input);
|
changeDir(input);
|
||||||
|
@ -834,7 +861,7 @@ void FFileDialog::cb_processRowChanged (FWidget*, data_ptr)
|
||||||
|
|
||||||
const FString& name = dir_entries[uLong(n - 1)].name;
|
const FString& name = dir_entries[uLong(n - 1)].name;
|
||||||
|
|
||||||
if ( dir_entries[uLong(n - 1)].type == DT_DIR )
|
if ( dir_entries[uLong(n - 1)].directory )
|
||||||
filename->setText( name + '/' );
|
filename->setText( name + '/' );
|
||||||
else
|
else
|
||||||
filename->setText( name );
|
filename->setText( name );
|
||||||
|
@ -847,7 +874,7 @@ void FFileDialog::cb_processClicked (FWidget*, data_ptr)
|
||||||
{
|
{
|
||||||
const uLong n = uLong(filebrowser->currentItem() - 1);
|
const uLong n = uLong(filebrowser->currentItem() - 1);
|
||||||
|
|
||||||
if ( dir_entries[n].type == DT_DIR )
|
if ( dir_entries[n].directory )
|
||||||
changeDir(dir_entries[n].name);
|
changeDir(dir_entries[n].name);
|
||||||
else
|
else
|
||||||
done (FDialog::Accept);
|
done (FDialog::Accept);
|
||||||
|
|
|
@ -102,7 +102,7 @@ FString FListViewItem::getText (int column) const
|
||||||
if ( column < 1
|
if ( column < 1
|
||||||
|| column_list.empty()
|
|| column_list.empty()
|
||||||
|| column > int(column_list.size()) )
|
|| column > int(column_list.size()) )
|
||||||
return *fc::empty_string;
|
return fc::emptyFString::get();
|
||||||
|
|
||||||
column--; // Convert column position to address offset (index)
|
column--; // Convert column position to address offset (index)
|
||||||
return column_list[uInt(column)];
|
return column_list[uInt(column)];
|
||||||
|
@ -498,7 +498,7 @@ FString FListView::getColumnText (int column) const
|
||||||
// Get the text of column
|
// Get the text of column
|
||||||
|
|
||||||
if ( column < 1 || header.empty() || column > int(header.size()) )
|
if ( column < 1 || header.empty() || column > int(header.size()) )
|
||||||
return *fc::empty_string;
|
return fc::emptyFString::get();
|
||||||
|
|
||||||
column--; // Convert column position to address offset (index)
|
column--; // Convert column position to address offset (index)
|
||||||
return header[uInt(column)].name;
|
return header[uInt(column)].name;
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
// static class attributes
|
// static class attributes
|
||||||
bool FObject::timer_modify_lock;
|
bool FObject::timer_modify_lock;
|
||||||
FObject::TimerList* FObject::timer_list = 0;
|
FObject::TimerList* FObject::timer_list = 0;
|
||||||
const FString* fc::empty_string = 0;
|
const FString* fc::emptyFString::empty_string = 0;
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
// class FObject
|
// class FObject
|
||||||
|
@ -60,26 +60,13 @@ FObject::FObject (FObject* parent)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! fc::empty_string )
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
fc::empty_string = new FString("");
|
|
||||||
}
|
|
||||||
catch (const std::bad_alloc& ex)
|
|
||||||
{
|
|
||||||
std::cerr << "not enough memory to alloc " << ex.what() << std::endl;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FObject::~FObject() // destructor
|
FObject::~FObject() // destructor
|
||||||
{
|
{
|
||||||
delOwnTimer(); // delete all timers of this object
|
delOwnTimer(); // Delete all timers of this object
|
||||||
|
|
||||||
if ( ! has_parent && timer_list )
|
if ( ! has_parent && timer_list )
|
||||||
{
|
{
|
||||||
|
@ -87,13 +74,10 @@ FObject::~FObject() // destructor
|
||||||
timer_list = 0;
|
timer_list = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! has_parent && fc::empty_string )
|
if ( ! has_parent && ! fc::emptyFString::isNull() )
|
||||||
{
|
fc::emptyFString::clear();
|
||||||
delete fc::empty_string;
|
|
||||||
fc::empty_string = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// delete children objects
|
// Delete children objects
|
||||||
if ( hasChildren() )
|
if ( hasChildren() )
|
||||||
{
|
{
|
||||||
constFObjectIterator iter, last;
|
constFObjectIterator iter, last;
|
||||||
|
|
|
@ -546,7 +546,7 @@ char* FOptiAttr::changeAttribute (char_data*& term, char_data*& next)
|
||||||
if ( cygwin_terminal && (term->fg_color > 7 || term->bg_color > 7) )
|
if ( cygwin_terminal && (term->fg_color > 7 || term->bg_color > 7) )
|
||||||
{
|
{
|
||||||
// reset blink and bold mode from colors > 7
|
// reset blink and bold mode from colors > 7
|
||||||
char* rst = const_cast<char*>(CSI "m");
|
char* rst = C_STR(CSI "m");
|
||||||
append_sequence (rst);
|
append_sequence (rst);
|
||||||
reset(term);
|
reset(term);
|
||||||
}
|
}
|
||||||
|
@ -1046,7 +1046,7 @@ bool FOptiAttr::setTermDefaultColor (char_data*& term)
|
||||||
}
|
}
|
||||||
else if ( ansi_default_color )
|
else if ( ansi_default_color )
|
||||||
{
|
{
|
||||||
char* sgr_39_49 = const_cast<char*>(CSI "39;49m");
|
char* sgr_39_49 = C_STR(CSI "39;49m");
|
||||||
append_sequence (sgr_39_49);
|
append_sequence (sgr_39_49);
|
||||||
term->fg_color = Default;
|
term->fg_color = Default;
|
||||||
term->bg_color = Default;
|
term->bg_color = Default;
|
||||||
|
@ -1302,7 +1302,7 @@ void FOptiAttr::change_color (char_data*& term, char_data*& next)
|
||||||
}
|
}
|
||||||
else if ( fg == Default && term->fg_color != Default )
|
else if ( fg == Default && term->fg_color != Default )
|
||||||
{
|
{
|
||||||
char* sgr_39 = const_cast<char*>(CSI "39m");
|
char* sgr_39 = C_STR(CSI "39m");
|
||||||
append_sequence (sgr_39);
|
append_sequence (sgr_39);
|
||||||
term->fg_color = Default;
|
term->fg_color = Default;
|
||||||
}
|
}
|
||||||
|
@ -1312,9 +1312,9 @@ void FOptiAttr::change_color (char_data*& term, char_data*& next)
|
||||||
char* op = F_orig_pair.cap;
|
char* op = F_orig_pair.cap;
|
||||||
|
|
||||||
if ( op && std::strncmp (op, CSI "39;49;25m", 11) == 0 )
|
if ( op && std::strncmp (op, CSI "39;49;25m", 11) == 0 )
|
||||||
sgr_49 = const_cast<char*>(CSI "49;25m");
|
sgr_49 = C_STR(CSI "49;25m");
|
||||||
else
|
else
|
||||||
sgr_49 = const_cast<char*>(CSI "49m");
|
sgr_49 = C_STR(CSI "49m");
|
||||||
|
|
||||||
append_sequence (sgr_49);
|
append_sequence (sgr_49);
|
||||||
term->bg_color = Default;
|
term->bg_color = Default;
|
||||||
|
|
|
@ -774,12 +774,35 @@ FString FString::clear()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
const wchar_t* FString::wc_str() const
|
const wchar_t* FString::wc_str() const
|
||||||
{
|
{
|
||||||
|
// Returns a constant wide character string
|
||||||
|
|
||||||
|
return string;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
wchar_t* FString::wc_str()
|
||||||
|
{
|
||||||
|
// Returns a wide character string
|
||||||
|
|
||||||
return string;
|
return string;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
const char* FString::c_str() const
|
const char* FString::c_str() const
|
||||||
{
|
{
|
||||||
|
// Returns a constant c-string
|
||||||
|
|
||||||
|
if ( length > 0 )
|
||||||
|
return wc_to_c_str (string);
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
char* FString::c_str()
|
||||||
|
{
|
||||||
|
// Returns a c-string
|
||||||
|
|
||||||
if ( length > 0 )
|
if ( length > 0 )
|
||||||
return wc_to_c_str (string);
|
return wc_to_c_str (string);
|
||||||
else
|
else
|
||||||
|
|
405
src/fterm.cpp
405
src/fterm.cpp
File diff suppressed because it is too large
Load Diff
|
@ -2521,7 +2521,6 @@ FVTerm::exit_state FVTerm::eraseCharacters ( uInt& x, uInt xmax, uInt y
|
||||||
// Erase a number of characters to draw simple whitespaces
|
// Erase a number of characters to draw simple whitespaces
|
||||||
|
|
||||||
term_area*& vt = vterm;
|
term_area*& vt = vterm;
|
||||||
bool& ut = FTermcap::background_color_erase;
|
|
||||||
char*& ec = TCAP(fc::t_erase_chars);
|
char*& ec = TCAP(fc::t_erase_chars);
|
||||||
char_data* print_char = &vt->text[y * uInt(vt->width) + x];
|
char_data* print_char = &vt->text[y * uInt(vt->width) + x];
|
||||||
|
|
||||||
|
@ -2549,6 +2548,7 @@ FVTerm::exit_state FVTerm::eraseCharacters ( uInt& x, uInt xmax, uInt y
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
uInt start_pos = x;
|
uInt start_pos = x;
|
||||||
|
bool& ut = FTermcap::background_color_erase;
|
||||||
|
|
||||||
if ( whitespace > uInt(erase_ch_length) + uInt(cursor_addres_lengths)
|
if ( whitespace > uInt(erase_ch_length) + uInt(cursor_addres_lengths)
|
||||||
&& (ut || normal) )
|
&& (ut || normal) )
|
||||||
|
@ -2963,16 +2963,38 @@ int FVTerm::appendLowerRight (char_data*& screen_char)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline void FVTerm::appendOutputBuffer (const std::string& s)
|
inline void FVTerm::appendOutputBuffer (const std::string& s)
|
||||||
{
|
{
|
||||||
|
#if defined(__sun) && defined(__SVR4)
|
||||||
|
char* c_string = C_STR(s.c_str());
|
||||||
|
#else
|
||||||
const char* const& c_string = s.c_str();
|
const char* const& c_string = s.c_str();
|
||||||
|
#endif
|
||||||
|
|
||||||
tputs (c_string, 1, appendOutputBuffer);
|
tputs (c_string, 1, appendOutputBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline void FVTerm::appendOutputBuffer (const char*& s)
|
inline void FVTerm::appendOutputBuffer (const char*& s)
|
||||||
{
|
{
|
||||||
|
#if defined(__sun) && defined(__SVR4)
|
||||||
|
tputs (C_STR(s), 1, appendOutputBuffer);
|
||||||
|
#else
|
||||||
tputs (s, 1, appendOutputBuffer);
|
tputs (s, 1, appendOutputBuffer);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(__sun) && defined(__SVR4)
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
int FVTerm::appendOutputBuffer (char ch)
|
||||||
|
{
|
||||||
|
output_buffer->push(ch);
|
||||||
|
|
||||||
|
if ( output_buffer->size() >= TERMINAL_OUTPUT_BUFFER_SIZE )
|
||||||
|
flush_out();
|
||||||
|
|
||||||
|
return ch;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
int FVTerm::appendOutputBuffer (int ch)
|
int FVTerm::appendOutputBuffer (int ch)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue