Moved FTerm debug access methods to FTermDebugData

This commit is contained in:
Markus Gans 2018-11-02 01:17:57 +01:00
parent c2df8ac7d9
commit deb62c2914
5 changed files with 129 additions and 68 deletions

View File

@ -1052,13 +1052,13 @@ int main (int argc, char* argv[])
app.setTermTitle (title);
// Force vt100 encoding
//app.getFTerm().setEncoding(finalcut::fc::VT100);
//app.setEncoding(finalcut::fc::VT100);
// Sets the terminal size to 94×30
//app.setTermSize(94,30);
// Enable the final cut graphical font
//app.getFTerm().setNewFont();
//app.setNewFont();
// Create main dialog object d
MyDialog d(&app);

View File

@ -115,6 +115,7 @@ finalcutinclude_HEADERS = \
include/final/ftermfreebsd.h \
include/final/ftermopenbsd.h \
include/final/ftermlinux.h \
include/final/ftermdebugdata.h \
include/final/ftermdetection.h \
include/final/ftermios.h \
include/final/fterm.h \

View File

@ -127,6 +127,7 @@
#include "final/ftermcap.h"
#include "final/ftermcapquirks.h"
#include "final/ftermdata.h"
#include "final/ftermdebugdata.h"
#include "final/ftermdetection.h"
#if defined(__linux__)
@ -143,9 +144,6 @@
namespace finalcut
{
// class forward declaration
class FTermDebugData;
//----------------------------------------------------------------------
// class FTerm
//----------------------------------------------------------------------
@ -579,69 +577,6 @@ inline FOptiMove* FTerm::getFOptiMove()
inline void FTerm::changeTermSizeFinished()
{ data->setTermResized(false); }
#if DEBUG
//----------------------------------------------------------------------
// class FTermDebugData
//----------------------------------------------------------------------
class FTermDebugData
{
public:
// Accessors
const FString& getAnswerbackString();
const FString& getSecDAString();
const char* getTermType_256color();
const char* getTermType_Answerback();
const char* getTermType_SecDA();
#if defined(__linux__)
int getFramebufferBpp();
#endif
// Mutators
void setFTermDetection (FTermDetection*);
void setFTermData (FTermData*);
private:
FTermDetection* term_detection;
FTermData* data;
};
//----------------------------------------------------------------------
inline void FTermDebugData::setFTermDetection (FTermDetection* obj)
{ term_detection = obj; }
//----------------------------------------------------------------------
inline void FTermDebugData::setFTermData (FTermData* obj)
{ data = obj; }
//----------------------------------------------------------------------
inline const FString& FTermDebugData::getAnswerbackString()
{ return term_detection->getAnswerbackString(); }
//----------------------------------------------------------------------
inline const FString& FTermDebugData::getSecDAString()
{ return term_detection->getSecDAString(); }
//----------------------------------------------------------------------
inline const char* FTermDebugData::getTermType_256color()
{ return term_detection->getTermType_256color(); }
//----------------------------------------------------------------------
inline const char* FTermDebugData::getTermType_Answerback()
{ return term_detection->getTermType_Answerback(); }
//----------------------------------------------------------------------
inline const char* FTermDebugData::getTermType_SecDA()
{ return term_detection->getTermType_SecDA(); }
//----------------------------------------------------------------------
#if defined(__linux__)
inline int FTermDebugData::getFramebufferBpp()
{ return data->getFramebufferBpp(); }
#endif // defined(__linux__)
#endif // DEBUG
} // namespace finalcut
#endif // FTERM_H

View File

@ -0,0 +1,105 @@
/***********************************************************************
* ftermdebugdata.h - Debug data class for FTerm *
* *
* This file is part of the Final Cut widget toolkit *
* *
* Copyright 2018 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/>. *
***********************************************************************/
/* Standalone class
*
*
*
* FTermDebugData
*
*/
#ifndef FTERMDEBUGDATA_H
#define FTERMDEBUGDATA_H
#if !defined (USE_FINAL_H) && !defined (COMPILE_FINAL_CUT)
#error "Only <final/final.h> can be included directly."
#endif
namespace finalcut
{
#if DEBUG
//----------------------------------------------------------------------
// class FTermDebugData
//----------------------------------------------------------------------
class FTermDebugData
{
public:
// Accessors
const FString& getAnswerbackString();
const FString& getSecDAString();
const char* getTermType_256color();
const char* getTermType_Answerback();
const char* getTermType_SecDA();
#if defined(__linux__)
int getFramebufferBpp();
#endif
// Mutators
void setFTermDetection (FTermDetection*);
void setFTermData (FTermData*);
private:
FTermDetection* term_detection;
FTermData* data;
};
//----------------------------------------------------------------------
inline void FTermDebugData::setFTermDetection (FTermDetection* obj)
{ term_detection = obj; }
//----------------------------------------------------------------------
inline void FTermDebugData::setFTermData (FTermData* obj)
{ data = obj; }
//----------------------------------------------------------------------
inline const FString& FTermDebugData::getAnswerbackString()
{ return term_detection->getAnswerbackString(); }
//----------------------------------------------------------------------
inline const FString& FTermDebugData::getSecDAString()
{ return term_detection->getSecDAString(); }
//----------------------------------------------------------------------
inline const char* FTermDebugData::getTermType_256color()
{ return term_detection->getTermType_256color(); }
//----------------------------------------------------------------------
inline const char* FTermDebugData::getTermType_Answerback()
{ return term_detection->getTermType_Answerback(); }
//----------------------------------------------------------------------
inline const char* FTermDebugData::getTermType_SecDA()
{ return term_detection->getTermType_SecDA(); }
//----------------------------------------------------------------------
#if defined(__linux__)
inline int FTermDebugData::getFramebufferBpp()
{ return data->getFramebufferBpp(); }
#endif // defined(__linux__)
#endif // DEBUG
} // namespace finalcut
#endif // FTERMDEBUGDATA_H

View File

@ -221,6 +221,10 @@ class FVTerm
static bool unsetInheritBackground();
static void setTermTitle (const FString&);
static void setEncoding (fc::encoding);
static bool setVGAFont();
static bool setNewFont();
static bool setOldFont();
// Inquiries
static bool isBold();
@ -880,6 +884,22 @@ inline bool FVTerm::unsetInheritBackground()
inline void FVTerm::setTermTitle (const FString& title)
{ FTerm::setTermTitle(title); }
//----------------------------------------------------------------------
inline void FVTerm::setEncoding (fc::encoding enc)
{ FTerm::setEncoding(enc); }
//----------------------------------------------------------------------
inline bool FVTerm::setVGAFont()
{ return FTerm::setVGAFont(); }
//----------------------------------------------------------------------
inline bool FVTerm::setNewFont()
{ return FTerm::setNewFont(); }
//----------------------------------------------------------------------
inline bool FVTerm::setOldFont()
{ return FTerm::setOldFont(); }
//----------------------------------------------------------------------
inline bool FVTerm::isBold()
{ return next_attribute.attr.bit.bold; }