2017-11-04 07:03:53 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* ftermcap.h - Provides access to terminal capabilities *
|
|
|
|
* *
|
|
|
|
* This file is part of the Final Cut widget toolkit *
|
|
|
|
* *
|
2018-10-01 22:27:54 +02:00
|
|
|
* Copyright 2016-2018 Markus Gans *
|
2017-11-04 07:03:53 +01:00
|
|
|
* *
|
|
|
|
* 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/>. *
|
|
|
|
***********************************************************************/
|
2017-10-02 07:32:33 +02:00
|
|
|
|
|
|
|
/* Standalone class
|
|
|
|
* ════════════════
|
|
|
|
*
|
|
|
|
* ▕▔▔▔▔▔▔▔▔▔▔▏
|
|
|
|
* ▕ FTermcap ▏
|
|
|
|
* ▕▁▁▁▁▁▁▁▁▁▁▏
|
|
|
|
*/
|
2016-10-11 04:57:36 +02:00
|
|
|
|
2017-04-09 20:08:53 +02:00
|
|
|
#ifndef FTERMCAP_H
|
|
|
|
#define FTERMCAP_H
|
2016-10-11 04:57:36 +02:00
|
|
|
|
2017-10-31 00:41:59 +01:00
|
|
|
#if !defined (USE_FINAL_H) && !defined (COMPILE_FINAL_CUT)
|
|
|
|
#error "Only <final/final.h> can be included directly."
|
|
|
|
#endif
|
|
|
|
|
2018-10-08 04:14:20 +02:00
|
|
|
#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 // _LP64
|
|
|
|
|
|
|
|
#include <term.h> // termcap
|
|
|
|
#else
|
|
|
|
#include <term.h> // termcap
|
|
|
|
#endif // defined(__sun) && defined(__SVR4)
|
|
|
|
|
|
|
|
#ifdef F_HAVE_LIBGPM
|
|
|
|
#undef buttons // from term.h
|
|
|
|
#endif
|
2017-09-11 03:06:02 +02:00
|
|
|
|
|
|
|
#include <string>
|
2018-10-08 04:14:20 +02:00
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
#include "final/emptyfstring.h"
|
|
|
|
#include "final/fkey_map.h"
|
|
|
|
#include "final/ftermdetection.h"
|
|
|
|
|
|
|
|
|
|
|
|
// FTermcap string macro
|
|
|
|
#define TCAP(s) tcap[(s)].string
|
2016-10-11 04:57:36 +02:00
|
|
|
|
2018-09-20 23:59:01 +02:00
|
|
|
namespace finalcut
|
|
|
|
{
|
2017-10-02 07:32:33 +02:00
|
|
|
|
2016-10-11 04:57:36 +02:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// class FTermcap
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
#pragma pack(push)
|
|
|
|
#pragma pack(1)
|
|
|
|
|
|
|
|
class FTermcap
|
|
|
|
{
|
2017-09-11 03:06:02 +02:00
|
|
|
public:
|
|
|
|
// Typedef
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
char* string;
|
|
|
|
char tname[3];
|
|
|
|
}
|
|
|
|
tcap_map;
|
2016-10-13 02:16:51 +02:00
|
|
|
|
2017-09-11 03:06:02 +02:00
|
|
|
// Constructors
|
2018-10-01 22:27:54 +02:00
|
|
|
FTermcap();
|
2016-10-11 04:57:36 +02:00
|
|
|
|
2017-09-11 03:06:02 +02:00
|
|
|
// Destructor
|
2018-10-01 22:27:54 +02:00
|
|
|
~FTermcap();
|
2016-10-11 04:57:36 +02:00
|
|
|
|
2018-08-09 00:04:00 +02:00
|
|
|
// Accessors
|
|
|
|
const char* getClassName() const;
|
|
|
|
|
2017-09-11 03:06:02 +02:00
|
|
|
static tcap_map* getTermcapMap()
|
|
|
|
{
|
|
|
|
return tcap;
|
|
|
|
}
|
2016-10-14 13:02:35 +02:00
|
|
|
|
2018-10-08 04:14:20 +02:00
|
|
|
// Mutator
|
2018-11-01 21:29:54 +01:00
|
|
|
static void setFTermData (FTermData*);
|
2018-10-08 04:14:20 +02:00
|
|
|
static void setFTermDetection (FTermDetection*);
|
|
|
|
|
|
|
|
// Methods
|
|
|
|
static void init();
|
|
|
|
|
2017-09-11 03:06:02 +02:00
|
|
|
// Data Members
|
|
|
|
static bool background_color_erase;
|
2018-10-09 00:33:26 +02:00
|
|
|
static bool can_change_color_palette;
|
2017-09-11 03:06:02 +02:00
|
|
|
static bool automatic_left_margin;
|
|
|
|
static bool automatic_right_margin;
|
|
|
|
static bool eat_nl_glitch;
|
|
|
|
static bool ansi_default_color;
|
|
|
|
static bool osc_support;
|
|
|
|
static bool no_utf8_acs_chars;
|
|
|
|
static int max_color;
|
|
|
|
static int tabstop;
|
|
|
|
static int attr_without_color;
|
2016-11-02 00:37:58 +01:00
|
|
|
|
2017-09-11 03:06:02 +02:00
|
|
|
private:
|
2018-10-08 04:14:20 +02:00
|
|
|
// Methods
|
|
|
|
static void termcap();
|
|
|
|
static void termcapError (int);
|
|
|
|
static void termcapVariables (char*&);
|
|
|
|
static void termcapBoleans();
|
|
|
|
static void termcapNumerics();
|
|
|
|
static void termcapStrings (char*&);
|
|
|
|
static void termcapKeys (char*&);
|
|
|
|
static void termcapKeysVt100 (char*&);
|
|
|
|
|
2018-10-01 22:27:54 +02:00
|
|
|
// Data Member
|
2018-10-08 04:14:20 +02:00
|
|
|
static tcap_map tcap[];
|
|
|
|
static FTermData* fterm_data;
|
|
|
|
static FTermDetection* term_detection;
|
2016-10-11 04:57:36 +02:00
|
|
|
};
|
|
|
|
#pragma pack(pop)
|
|
|
|
|
2018-10-01 22:27:54 +02:00
|
|
|
// FTermcap inline functions
|
2018-08-09 00:04:00 +02:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
inline const char* FTermcap::getClassName() const
|
|
|
|
{ return "FTermcap"; }
|
|
|
|
|
2018-09-20 23:59:01 +02:00
|
|
|
} // namespace finalcut
|
|
|
|
|
2018-10-01 22:27:54 +02:00
|
|
|
|
2017-04-09 20:08:53 +02:00
|
|
|
#endif // FTERMCAP_H
|